小编Flo*_*ood的帖子

ESLint 损坏:带有建议的规则必须将 `meta.hasSuggestions` 属性设置为 `true`

我正在使用 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)

reactjs eslint eslintrc react-hooks

45
推荐指数
1
解决办法
3万
查看次数

标签 统计

eslint ×1

eslintrc ×1

react-hooks ×1

reactjs ×1