react/jsx-newline
eslint-plugin-react
Safe autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-newline": "error",
},
},
];<div>
<Button>{data.label}</Button>
<List />
</div><div>
<Button>{data.label}</Button>
{showSomething === true && <Something />}
</div><div>
{showSomething === true && <Something />}
{showSomethingElse === true ? (
<SomethingElse />
) : (
<ErrorMessage />
)}
</div><div>
<Button>{data.label}</Button>
<List />
<Button>
<IconPreview />
Button 2
<span></span>
</Button>
{showSomething === true && <Something />}
<Button>Button 3</Button>
{showSomethingElse === true ? (
<SomethingElse />
) : (
<ErrorMessage />
)}
</div><div>
<Button>{data.label}</Button>
<List />
</div><div>
<Button>{data.label}</Button>
{showSomething === true && <Something />}
</div>Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
react/jsx-newline
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-newline": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
Disallow adjacent inline elements not separated by whitespace.
Enforce React components to have a shouldComponentUpdate method