When using the arrow-body-style rule along with the Prettier, the output can result in invalid code.
Here's a thread with a working example: airbnb/javascript#1987
Since prettier handles arrow style well, can we switch this rule off in this repo?
arrow-body-style config that results in invalid code:
['error', 'as-needed', { requireReturnForObjectLiteral: false, }],
code
const foo = (paramA, paramB, paramC) => {
return Object.keys(paramB.prop.nestedProp[0])
.filter(attribute => paramC.includes(attribute))
.map(attribute => {
return Object.keys(paramB.prop.nestedProp[0][attribute]).map(
attributeKey => {
return {
key: `${paramA.name} ${paramB.type} ${attribute} ${attributeKey}`,
value: paramB.prop.nestedProp[0][attribute][attributeKey],
}
}
)
})
}
eslint config:
{
"parser": "babel-eslint",
"plugins": ["prettier", "react", "jest"],
"env": {
"browser": true,
"node": true,
"jasmine": true,
"jest/globals": true
},
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"import/resolver": {
"webpack": {
"config": "webpack.common.js"
}
}
},
"rules": {},
"extends": ["airbnb", "plugin:prettier/recommended"]
}
When using the
arrow-body-stylerule along with the Prettier, the output can result in invalid code.Here's a thread with a working example: airbnb/javascript#1987
Since prettier handles arrow style well, can we switch this rule off in this repo?
arrow-body-styleconfig that results in invalid code:code
eslint config:
{ "parser": "babel-eslint", "plugins": ["prettier", "react", "jest"], "env": { "browser": true, "node": true, "jasmine": true, "jest/globals": true }, "parserOptions": { "ecmaVersion": 2017, "sourceType": "module", "ecmaFeatures": { "jsx": true } }, "settings": { "import/resolver": { "webpack": { "config": "webpack.common.js" } } }, "rules": {}, "extends": ["airbnb", "plugin:prettier/recommended"] }