import-js/eslint-plugin-import

Feature request: import/extensions autofix

开放

#1,749 创建于 2020年5月5日

 (20 条评论) (42 个反应) (0 位负责人)JavaScript (1,549 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (5,939 个星标)
PR 合并指标
 (平均合并 138天 22小时) (30 天内合并 3 个 PR)

描述

With Node 13.2 and up now having near-stable support for ESM modules, existing projects will need to update their imports in order to make use of it. According to the docs:

A file extension must be provided when using the import keyword. Directory indexes (e.g. './startup/index.js') must also be fully specified. This behavior matches how import behaves in browser environments, assuming a typically configured server.

(https://nodejs.org/api/esm.html#esm_mandatory_file_extensions)

Currently, while the import/extensions plugin can be configured to throw if an import doesn't have a proper ending, it does not provide a way to autofix it. Having that would be a tremendeous benefits to existing, large codebases migrating to native modules.

贡献者指南