eslint - 规则 "react/jsx-indent"的配置无效 : Value "4,[object Object]" should NOT have more than 1 items

标签 eslint eslint-config-airbnb eslintrc

我今天上类时发现我的 linter 包出现了一个不寻常的错误。我查看了该包的文档,没有发现我的 eslintrc 文件有任何问题。

这是我正在使用的副本

{
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
    "import/no-extraneous-dependencies": "off",
    "import/extensions": "off",
    "import/no-unresolved": "off",
    "eol-last": "off",
    "no-unused-expressions": ["error",{
        "allowTernary": true,
        "allowShortCircuit": true
        }],
    "react/jsx-indent-props": "off",
    "react/jsx-indent" : ["error", 4, { "props": 4 }],
    "indent": [ "error", 4],
    "react/jsx-filename-extension": "off",
    "jsx-a11y/anchor-is-valid": [
        "error",
        {
            "components": [],
            "specialLink": [
                "hrefLeft",
                "hrefRight"
            ],
            "aspects": [
                "noHref",
                "invalidHref",
                "preferButton"
            ]
        }
    ],
    "no-bitwise": "off"
},
"env": {
    "browser": true,
    "jest": true
}

}

当我从命令行运行 eslint 时,我没有遇到任何问题,这使得这更加令人困惑!

任何帮助将不胜感激:)

最佳答案

为了防止将来有人遇到这个问题,我发现了这个问题。

"react/jsx-indent" : ["error", 4, { "props": 4 }],

应该是

"react/jsx-indent" : ["error", 4],

我认为有人试图尝试解构:P

关于eslint - 规则 "react/jsx-indent"的配置无效 : Value "4,[object Object]" should NOT have more than 1 items,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49533844/

相关文章:

reactjs - 使用 Airbnb 规则在带有粗箭头的 ESLint 类中

reactjs - 在 eslintrc.json 中关闭 eslint 规则

import - 如何在 Svelte 中使用 Vite 和 ESlint 解析绝对路径?

ecmascript-6 - 夹在两个不受限制的语法违规之间

react-native - .eslintrc.js 不适用于规则 "off"

javascript - handle-callback-err 预期要处理的错误

javascript - 有没有办法用 eslint 来检查特定的变量名

angular - Visual Studio 警告 : (ESLint) Failed to load config "defaults/configurations/eslint" to extend from. 引用自 C :\Users\{username}\. eslintrc

typescript - 如何使用 ESLint TypeScript Airbnb 配置?

javascript - 'const' 在 ES6 中可用(使用 'esversion: 6' )