Eslint最大道具每行缩进问题

时间:2019-09-05 21:19:53

标签: reactjs eslint prettier

设置规则时,我的漂亮自动缩进出现问题 "react/jsx-max-props-per-line": [1, { "maximum": 1 }] in eslint

这是在eslint 6.3,更漂亮的1.18.2和16.9上做出的反应。以及VS代码的最新版本。

这是我的eslint配置:

    "parser": "babel-eslint",
    "parserOptions": {
        "sourceType": "module",
        "allowImportExportEverywhere": false,
        "codeFrame": false
    },
    "extends": ["airbnb", "prettier"],
    "env": { "browser": true, "jest": true },
    "rules": {
        "no-param-reassign": "off",
        "react/jsx-max-props-per-line": [1, { "maximum": 1 }],
        "indent": ["error", 4],
        "react/jsx-indent": ["error", 4],
        "react/jsx-indent-props": ["error", 4],
        "max-len": ["error", { "code": 120 }],
        "prefer-promise-reject-errors": ["off"],
        "react/jsx-filename-extension": ["off"],
        "react/prop-types": ["warn"],
        "no-return-assign": ["off"]
    }
}

如果我尝试缩进<Avatar src={candidate.picture} className={classes.avatar} /> 它会在行的开头向我返回所有道具,而没有正确的缩进,这将给我一个错误expected indentation of 8 but found 0,因为现在一切都在错误的位置。

我正试图找到一种方法来获得类似的东西:

<Avatar 
    src={candidate.picture}
    className={classes.avatar} 
/>

感谢您的帮助。

0 个答案:

没有答案