eslint-config-canonical
eslint-config-canonical copied to clipboard
Change `import/extensions`
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.
This is the likely path forward after TypeScript releases ESM module compatibility.
This will be added once 4.7 comes out
https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/
@gajus TS 5 is out by now