react/jsx-indent
eslint-plugin-react
Safe autofix
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-indent": "error",
},
},
];// 2 spaces indentation
<App>
<Hello />
</App>
// no indentation
<App>
<Hello />
</App>
// 1 tab indentation
<App>
<Hello />
</App>// 2 spaces indentation
// [2, 2]
<App>
<Hello />
</App>
// tab indentation
// [2, 'tab']
<App>
<Hello />
</App>
// no indentation
// [2, 0]
<App>
<Hello />
</App>
// [2, 2, {checkAttributes: false}]
<App render={
<Hello render={
(bar) => <div>hi</div>
}
/>
}>
</App>
// [2, 2, {indentLogicalExpressions: true}]
<App>
{condition && (
<Hello />
)}
// …Examples from the ESLint documentation.
react/jsx-indent
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/jsx-indent": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce proper position of the first property in JSX
Enforce or disallow spaces around equal signs in JSX attributes
Enforce maximum of props on a single line in JSX
Enforce or disallow spaces inside of curly braces in JSX attributes and expressions