-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow resolving .js module path endings to .ts equivalent #82
Comments
It's supported already #56, and I'm using it very well. |
Just remove "import/extensions" this setting. This resolver resolves the |
Thanks @JounQin! I was able to get this working but I had to REMOVE Failure
|
In my case, I also found it necessary to disable the |
@JounQin this is not done, the PR that you linked doesn't support the option to force an extension like |
Forcing an extension is out of scope for this plugin, it's just a resolver. |
Moving this from import-js/eslint-plugin-import#2111 (comment) after import-js/eslint-plugin-import#2111 (comment).
It looks like this was previously discussed in #80 and it was requested that an issue get filed in
eslint-plugin-import
. import-js/eslint-plugin-import#2111 discusses this but it was recommended that this functionality move toeslint-import-resolver-typescript
.Below is my original comment from the
eslint-plugin-import
issue slightly modified for clarity.I'm migrating a large project written in TypeScript to output native ESM modules for Node. This requires all the
import
statements in TypeScript to end in.js
so they get output with the.js
extensions and I would like to lint that import statements of file paths end in.js
.I don't think TypeScript is going to budge on their treatment of extensions, see microsoft/TypeScript#16577 (comment), neither will Node JS back off of required extensions for ESM so it is perfectly valid TypeScript to write this if you are compiling to ESM for Node:
Compiles to:
Currently this config produces
Missing file extension "ts" for "./foo.js"
which is illogical since TypeScript doesn't actually support.ts
on file paths microsoft/TypeScript#37582.The text was updated successfully, but these errors were encountered: