Closed
Description
For jsx-closing-bracket-location (tag-aligned), if the last prop is declared on the same line as the opening bracket, the rule expects the closing bracket to be after the last prop even when the last prop spans multiple lines:
const MyComponent = () => (
<div>
<div className={[
"some",
"stuff",
2 ]}> {/* expected error, but passes lint */}
Some text
</div>
<div className={[
"some",
"stuff",
2 ]}
> {/* expected to pass, but produces error */}
Some text
</div>
</div>
);
The error is correctly reported when the prop is moved to the next line:
<div
className={[
"some",
"stuff",
2 ]}> {/* errors here, as expected (closing bracket should be aligned with opening bracket) */}
Some text
</div>
Here's my eslint config:
// [email protected]
// [email protected]
module.exports = {
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {
"jsx": true
}
},
plugins: ['react'],
rules: {
'react/jsx-closing-bracket-location': ['error', 'tag-aligned']
}
};
I've done a quick look at the source with @captbaritone - if I find a solution I'll make a PR.