我正在使用 VSCode,当我将该行添加'react-hooks/exhaustive-deps': 'warn'到 .eslintrc.js 时,我在 ESLint 输出中得到以下内容:
Rules with suggestions must set the `meta.hasSuggestions` property to `true`. Occurred while linting
C:\Users\filepath.jsx:72 Rule: "react-hooks/exhaustive-deps"
Run Code Online (Sandbox Code Playgroud)
这会破坏所有其他 linting。我尝试将以下内容添加到我的 .eslintrc.js 中:
meta: {
hasSuggestions: true
},
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
UnhandledPromiseRejectionWarning: Error: ESLint configuration in .eslintrc.js is invalid:
- Unexpected top-level property "meta".
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。
这是我的 .eslintrc.js:
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
settings: {
'react': {
'version': 'detect'
}
},
parserOptions: {
ecmaFeatures: {
jsx: true,
}, …Run Code Online (Sandbox Code Playgroud)