Starting a fresh typescript project with eslint, I'm facing an issue in setting up eslint rules for the tsc
command to run smoothly without errors. Specifically, I'm encountering difficulty with the "noImplicitAny" rule defined in tsconfig.json
, but I'm unsure how to enforce it using eslint.
.eslintrc.js:
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json"],
sourceType: "module",
},
rules: {
"no-undef": "warn",
},
plugins: ["@typescript-eslint"],
settings: {
"import/resolver": {
node: {
extensions: [".js", ".ts"],
},
},
},
};
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "ES6",
"declaration": true,
"outDir": "./lib",
"strict": true,
"noImplicitAny": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "**/__tests__/*"]
}
To summarize, I aim to configure eslint within the .eslintrc.js
file to actively identify and warn against any implicit usage of 'any'. How can I adjust the rules to achieve this?