Skip to content

Commit

Permalink
fix: Allow linting of typescript with module resolution set to `node1…
Browse files Browse the repository at this point in the history
…6` or `nodenext`

Node16 module resolution with Typescript requires every relative import to have
a file extension, but Typescript does not allow `.ts` so you have to use `.js`.
As this file obviously does not exist on build time, but only after it has been created
ESLint will complain about an unresolved import. Fixing it by using a different resolver for this.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed May 17, 2023
1 parent 62fdb09 commit c4780ab
Show file tree
Hide file tree
Showing 3 changed files with 693 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Expand Up @@ -146,6 +146,9 @@ module.exports = {
},
settings: {
'import/resolver': {
typescript: {
"alwaysTryTypes": true,

Check failure on line 150 in index.js

View workflow job for this annotation

GitHub Actions / eslint

Unnecessarily quoted property 'alwaysTryTypes' found

Check failure on line 150 in index.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote
},
node: {
paths: ['src'],
extensions: ['.(m|c)?js', '.ts', '.tsx', '.vue'],
Expand Down

0 comments on commit c4780ab

Please sign in to comment.