在我的新项目中,ESLint 没有像以前那样输出警告,我使用的是 VSCode。如果我的代码中某处有 unsed var,它不会再在终端输出中显示警告。仅在问题选项卡中。
这是我的 eslint 配置文件:
.eslintrc.json
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"plugin:react/recommended",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"react-hooks/rules-of-hooks":"error",
"react-hooks/exhaustive-deps": "warn",
"camelcase": "off",
"@typescript-eslint/camelcase": "off",
"react/jsx-filename-extension": [1, {"extensions": [".tsx"]}],
"import/prefer-default-export": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
"no-unused-expressions": …
Run Code Online (Sandbox Code Playgroud)