-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
[no-missing-imports]: add tryExtensions
option
#33
Comments
if using esm, technically it's a bug to use "tryExtensions" - the ext is always required, just like the web. to support the nodejs esm, we have removed the option in d24be36. |
ESM requires to have extensions always, and I agree on that, but Typescript on the other hand forbids them, so without extensions, files are not found... |
well, we could reintroduce the option to support something like ts. |
that would be really nice :-) Maybe disabled by default, enforcing extensions to be added. |
@piranna Can you clarify what you mean? TypeScript allows you to have extensions in your module specifiers because it just copies them verbatim. import util from './util.js' transpiles to const util = require('./util.js') So you shouldn't use import util from './util.ts' because it just transpiles to const util = require('./util.ts') which breaks because Node.js and browsers can't parse TypeScript. Note that you can still have a |
Yes, but that feels like a nasty hack, because in source code there's no |
Thanks for clarifying. I agree that adding the |
Any progress on this? I'm using |
@aladdin-add Any progress on this? |
I'm experiencing the same issue. It is blocking me from migrating from eslint-plugin-node to eslint-plugin-n. |
mmm, it looks like this is supported from the settings block, but not from the rule's option 🤔 https://github.com/eslint-community/eslint-plugin-n/blob/master/lib/util/visit-import.js#L35 So this in theory is as simple as adding |
Similar to https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-import.md, add support for the
tryExtensions
option.The text was updated successfully, but these errors were encountered: