规则“re​​act/jsx-indent”的配置无效:值“4,[object Object]”不应超过 1 个项目

Fab*_*zzi 3 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
}
Run Code Online (Sandbox Code Playgroud)

}

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

任何帮助将不胜感激 :)

Fab*_*zzi 8

以防万一将来有人遇到这个问题,我发现了这个问题。

"react/jsx-indent" : ["error", 4, { "props": 4 }],
Run Code Online (Sandbox Code Playgroud)

应该

"react/jsx-indent" : ["error", 4],
Run Code Online (Sandbox Code Playgroud)

我认为有人试图对解构感兴趣:P