Open jwbth opened 5 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.
How is the order of the keys in an object relevant? As far as I know, there is nothing in the ECMAScript specification that guarantees anything about the order of the keys in an object. In particular Object.keys
and friends do not guarantee returning the keys in any particular order.
@guillaumebrunerie that's actually false; since 2015 (ES6) object key ordering has been deterministic (modulo "insertion order"), and yes Object.keys and friends all guarantee that.
@guillaumebrunerie that's actually false; since 2015 (ES6) object key ordering has been deterministic (modulo "insertion order"), and yes Object.keys and friends all guarantee that.
Ah indeed, my bad, not sure why I thought it was still unspecified.
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.