首页 > 解决方案 > 值...不应该有额外的属性

问题描述

在我的 ESLint 配置文件 ( eslintrc.json) 中,我有以下规则:

// ...
"no-underscore-dangle": [
  "error",
  {
    "enforceInMethodNames": true,
    "allowFunctionParams": false
  }
],
// ...

文档似乎建议的相反,它会导致以下错误:

Error: .eslintrc.json:
        Configuration for rule "no-underscore-dangle" is invalid:
        Value {"enforceInMethodNames":true,"allowFunctionParams":false,"allowAfterThis":false,"allowAfterSuper":false,"allowAfterThisConstructor":false} should NOT have additional properties.

如果我从其选项中删除规则,我不会收到任何错误:"no-underscore-dangle": "error". 我更喜欢使用这两个选项。我错过了什么?有任何想法吗?

ESLint 版本:7.6.0
节点版本:12.17.0

标签: eslint

解决方案


我将 ESLint 更新为 7.10.0,现在错误消失了:

npm i -D eslint

推荐阅读