Open jwbth opened 3 months ago
try changing
'import/resolver': {
node: true,
typescript: true,
},
to:
'import/resolver': {
typescript: true,
node: true,
},
No effect, unfortunately.
I should also note that the highlight will appear also if:
Unexpected use of file extension "js" for "./exported_nonexistentBase.js" eslint(import/extensions) Unable to resolve path to module './exported_nonexistentBase.js'. eslint(import/no-unresolved)
Unable to resolve path to module './exported.jsx'. eslint(import/no-unresolved)
Unexpected use of file extension "js" for "./exported.js". eslint(import/extensions)
So, this seems to be a pretty unique case with a nonexistent .js silently mapping to an existent .ts with the same basename.
@ljharb did you solve it ?
try changing
'import/resolver': { node: true, typescript: true, },
to:
'import/resolver': { typescript: true, node: true, },
This works to me
Certainly you'd basically always want node
to be last in that object.
Take this simple setup:
eslint.config.js
index.ts
exported.ts
In index.ts,
./exported.js
points to a nonexistent file. Neitherimport/extensions
, norimport/no-unresolved
highlight it though.I narrowed down the problem to
typescript: true
– as soon as I comment that line, I see both errors:I assume it may be something to do with the eslint-import-resolver-typescript package, so I tried messing with it in some ways, but to no avail.