The eslint-plugin-import and eslint-import-resolver-typescript docs are quite clear that the latter is needed to support tsconfig @-rules (compilerOptions.path
).
I have set it up correctly, with these:
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
typescript: {
project,
},
}
}
Where project is resolved as such:
const project = resolve(process.cwd(), "tsconfig.json");
I know that works, it comes from turborepo's examples.
The issue is when I use JavaScript files (as opposed to TypeScript). import/no-unresolved
then throws an error.
Any way to fix this. Ideally, the typescript resolver should also be applied to the JavaScript files.