react/jsx-one-expression-per-line
See original GitHub issueThere’s a bug with the --fix
part of this rule when you have plain text inside of the jsx element.
Original code:
const something = () => (
<Text>Plain text</Text>
)
Result of eslint --fix
:
const something = () => (
<Text>
Plain text
</Text>
)
Expected result:
const something = () => (
<Text>
Plain text
</Text>
)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:25
- Comments:16 (13 by maintainers)
Top Results From Across the Web
eslint-plugin-react/jsx-one-expression-per-line.md at master
This option limits every line in JSX to one expression each. Note: The fixer will insert line breaks between any expression that are...
Read more >Eslint react/jsx-one-expression-per-line: allow variables and ...
Eslint react/jsx-one-expression-per-line: allow variables and JSX strings on the same line, but not elements · Subscribe to RSS.
Read more >JS.REACT.JSX.ONE.EXPRESSION.PER.LINE
This option limits every line in JSX to one expression each. This rule is automatically fixable using the --fix flag on the command...
Read more >https://docs.roguewave.com/en/klocwork/current/js....
No information is available for this page.
Read more >eslint-plugin-react/README.md - UNPKG
The CDN for eslint-plugin-react. ... 215, | | | [react/jsx-one-expression-per-line](docs/rules/jsx-one-expression-per-line.md) | Limit to one expression ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It looks like neither
indent
norreact/jsx-indent
can perform the proper indentation in this case unless you wrap “Plain Text” in brackets and quotes like so:ESLint Rules:
Original code:
Result of
eslint --fix
:So while the
react/jsx-one-expression-per-line
rule should definitely not be expected to perform indentation, maybereact/jsx-indent
should handle this indentation problem?The only fix, besides someone submitting a PR here, is disabling the rule for the time being.