In a new project, I installed typescript, eslint, @typescript-eslint/parser, @typescipt-eslint/eslint-plugin. I also added the following .eslintrc file:
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"]
}
and the following tsconfig.json file:
{
"compilerOptions": {
"strict": true
}
}
The problem is that the option from tsconfig.json is not applied when I run the command eslint. It works as expected with the command tsc, though.
For example, with a file index.ts containing:
function sum(a, b) {}
If I run npx eslint index.js, I have no error while if I run tsc --noEmit, I have two:
- error TS7006: Parameter 'a' implicitly has an 'any' type.
- error TS7006: Parameter 'b' implicitly has an 'any' type.
I would like the eslint command to return the same errors as the tsc command.
Any idea?
Edit I tried with and without the following in the .eslintrc:
"parserOptions": {
"project": "./tsconfig.json"
}