我想在我的.eslintrc.json文件中启用对“默认”typescript命名约定的警告。您如何做到这一点?
//package.json
//...
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"easy-peasy": "^5.0.3",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
//..//.eslintrc.json
//
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "react-hooks"],
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
//enable warnings for default naming convetions?
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true
}
]
},
"settings": {
"react": {
"pragma": "React",
"version": "detect"
}
}
}发布于 2021-05-28 08:08:20
只需在.eslintrc.json的“@typescript-eslint/命名约定”值中添加"warn“即可
"rules": {
//..
"@typescript-eslint/naming-convention": "warn",
//..
},了解有关@typescript-eslint/命名约定设置here的更多信息
https://stackoverflow.com/questions/67731339
复制相似问题