import-js/eslint-plugin-import

Feature request: import/extensions autofix

オープン

#1,749 opened on 2020/05/05

 (20 件のコメント) (42 件のリアクション) (0 人の担当者)JavaScript (1,549 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (5,940 個のスター)
PR merge metrics
 (平均マージ 138d 22h) (30d で 3 merged PRs)

説明

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.

コントリビューターガイド