jsx-one-expression-per-line
UnreleasedConfiguration
rslint.config.ts
Rule Details
Require one JSX element or expression per line. The fixer inserts line breaks
between expressions that share a line and preserves meaningful spaces with an
explicit {' '} expression.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
The rule accepts an optional object with an allow property:
allow
Defaults to "none".
"none": Require every child expression or element to be on its own line."literal": Allow a single literal or JSX text child on the same line."single-child": Allow any single child on the same line."non-jsx": Allow children when there is no direct JSX element or fragment child.
Examples of correct code with "literal":
Examples of correct code with "single-child":
Examples of correct code with "non-jsx":
Differences from ESLint
- For member-expression tags, rslint uses the complete authored tag name in
diagnostics, such as
Foo.Bar. ESLint's v7.37.5 implementation reads a missingnameproperty and reportsundefinedinstead. - For namespaced tags, rslint uses the complete namespace-qualified name,
such as
svg:path. ESLint's v7.37.5 implementation coerces the AST object and reports[object Object]instead. These readable descriptors are an intentional divergence from those upstream artifacts.