New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node/no-missing-import does not support node protocol #299
Comments
This works around an issue with node/no-missing-import that doesn't properly see that `node:path` is a valid module on Node 12.x. They are using `is-core-module` to figure out if it is a module or not, and it seems that `is-core-module` doesn't differentiate between core modules that are available for CJS (the `node:` prefixed paths are only available in 14.18+ and 16+ in CJS files) and those that are available to ESM. This is really just a bandaid, the right fix would be to send a PR to is-core-module to allow it to check CJS vs MJS modules (since they are actually different). See mysticatea/eslint-plugin-node#299
I did some quick investigation here (as I ran into the same issue). It seems that this package is using |
I opened an issue over in inspect-js/is-core-module#10 to see if there is any possibility to allow support for either CJS or MJS (as appropriate) over there. |
This works around an issue with node/no-missing-import that doesn't properly see that `node:path` is a valid module on Node 12.x. They are using `is-core-module` to figure out if it is a module or not, and it seems that `is-core-module` doesn't differentiate between core modules that are available for CJS (the `node:` prefixed paths are only available in 14.18+ and 16+ in CJS files) and those that are available to ESM. This is really just a bandaid, the right fix would be to send a PR to is-core-module to allow it to check CJS vs MJS modules (since they are actually different). See mysticatea/eslint-plugin-node#299
You can pass a "faked" node version to is-core-module, but you can also strip |
import path from 'node:path';
fails incorrectly with messageerror "node:path" is not found node/no-missing-import
(see node: Imports)The text was updated successfully, but these errors were encountered: