eslint-config-canonical icon indicating copy to clipboard operation
eslint-config-canonical copied to clipboard

Change `import/extensions`

Open brettz9 opened this issue 4 years ago • 3 comments

I would recommending changing import/extensions to "always" and adding ignorePackages: true.

Extensions are required in native ESM both in the browser and in Node (see https://nodejs.org/api/esm.html#esm_mandatory_file_extensions ). In the case of the browser, some packages wish to import without a build step, e.g., so as to import in a demo and be able to do rapid development.

However, I suggest the ignorePackages: true option because it seems that though one can whitelist use of ".js" for an explicit path per https://nodejs.org/api/packages.html#packages_package_entry_points , I see no way to use wildcards to support extensions--they seem to only support lack of extensions, at least for nested wildcard paths. But this is only for packages; relative/absolute paths as mentioned above need to have the extension.

brettz9 avatar Jun 23 '21 02:06 brettz9

This is the likely path forward after TypeScript releases ESM module compatibility.

gajus avatar Nov 09 '21 23:11 gajus

This will be added once 4.7 comes out

https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/

gajus avatar Apr 09 '22 14:04 gajus

@gajus TS 5 is out by now

kurtextrem avatar Apr 27 '23 08:04 kurtextrem