Eslint Typescript";没有任何隐含的“任何”;规则
我正在用eslint建立一个新的typescript项目。我正在尝试正确设置eslint规则,以便Eslint Typescript";没有任何隐含的“任何”;规则,typescript,eslint,Typescript,Eslint,我正在用eslint建立一个新的typescript项目。我正在尝试正确设置eslint规则,以便tsc命令运行时不会出错。我在tsconfig.json中使用了“noImplicitAny”规则,但我无法在eslint中检查该规则 .eslintrc.js: module.exports = { extends: [ "eslint:recommended", "plugin:@typescript-eslint/eslin
tsc
命令运行时不会出错。我在tsconfig.json
中使用了“noImplicitAny”规则,但我无法在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__/*"]
}
简而言之,我希望eslint检查隐式any并警告其用法。如何在
.eslintrc.js
中配置规则以实现这一点?也许这有帮助:我已经检查了该线程,它建议在.eslintrc中设置noImplicitAny
,但是在ESLint中不存在这样的规则。我知道有“@typescript eslint/no explicit any”
,但这不是我想要的。也许这有帮助:我已经检查了该线程,它建议在.eslintrc中设置noImplicitAny
,但是在eslint中不存在这样的规则。我知道有“@typescript eslint/no explicit any”
,但这不是我想要的。