react/jsx-wrap-multilines
eslint-plugin-react
Safe autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-wrap-multilines": "error",
},
},
];var Hello = createReactClass({
render: function() {
return <div>
<p>Hello {this.props.name}</p>
</div>;
}
});var Hello = createReactClass({
render: function() {
return (<div>
<p>Hello {this.props.name}</p>
</div>);
}
});var singleLineJSX = <p>Hello</p>
var Hello = createReactClass({
render: function() {
return (
<div>
<p>Hello {this.props.name}</p>
</div>
);
}
});var singleLineJSX = <p>Hello</p>
var Hello = createReactClass({
render: function() {
return (
<div>
<p>Hello {this.props.name}</p>
</div>
);
}
});var singleLineJSX = <p>Hello</p>
var Hello = createReactClass({
render: function() {
return <div>
<p>Hello {this.props.name}</p>
</div>;
}
});var hello = (
<div>
<p>Hello</p>
</div>
);Examples from the ESLint documentation.
react/jsx-wrap-multilines
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-wrap-multilines": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce whitespace in and around the JSX opening and closing brackets
Disallow when this.state is accessed within setState
Disallow multiple spaces between inline JSX props
Lifecycle methods should be methods on the prototype, not class fields