Skip to content

Commit d2b10ae

Browse files
xM8WVqaGljharb
authored andcommitted
[Docs] extensions: reference node ESM behavior
This behavior largely didn't change despite the functionality becoming more widely adopted. Even though the document assumes CJS, It's probably worth including at least a footnote about the resolver behaving differently for ESM. See: #2043
1 parent 6be042b commit d2b10ae

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1414
### Changed
1515
- [Docs] [`no-duplicates`]: fix example schema ([#2684], thanks [@simmo])
1616
- [Docs] [`group-exports`]: fix syntax highlighting ([#2699], thanks [@devinrhode2])
17+
- [Docs] [`extensions`]: reference node ESM behavior ([#2748], thanks [@xM8WVqaG])
1718

1819
## [2.27.5] - 2023-01-16
1920

@@ -1067,6 +1068,7 @@ for info on changes for earlier releases.
10671068
[`memo-parser`]: ./memo-parser/README.md
10681069

10691070
[#2754]: https://github.com/import-js/eslint-plugin-import/pull/2754
1071+
[#2748]: https://github.com/import-js/eslint-plugin-import/pull/2748
10701072
[#2699]: https://github.com/import-js/eslint-plugin-import/pull/2699
10711073
[#2664]: https://github.com/import-js/eslint-plugin-import/pull/2664
10721074
[#2613]: https://github.com/import-js/eslint-plugin-import/pull/2613
@@ -1853,6 +1855,7 @@ for info on changes for earlier releases.
18531855
[@wKich]: https://github.com/wKich
18541856
[@wschurman]: https://github.com/wschurman
18551857
[@wtgtybhertgeghgtwtg]: https://github.com/wtgtybhertgeghgtwtg
1858+
[@xM8WVqaG]: https://github.com/xM8WVqaG
18561859
[@xpl]: https://github.com/xpl
18571860
[@yordis]: https://github.com/yordis
18581861
[@zloirock]: https://github.com/zloirock

docs/rules/extensions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- end auto-generated rule header -->
44

5-
Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default. Depending on the resolver you can configure more extensions to get resolved automatically.
5+
Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver (which does not yet support ESM/`import`) can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default in CJS. Depending on the resolver you can configure more extensions to get resolved automatically.
66

77
In order to provide a consistent use of file extensions across your code base, this rule can enforce or disallow the use of certain file extensions.
88

@@ -170,3 +170,5 @@ import foo from '@/foo';
170170
## When Not To Use It
171171

172172
If you are not concerned about a consistent usage of file extension.
173+
174+
In the future, when this rule supports native node ESM resolution, and the plugin is configured to use native rather than transpiled ESM (a config option that is not yet available) - setting this to `always` will have no effect.

0 commit comments

Comments
 (0)