You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a comment at the end of a jsx line can unexpectedly raise jsx-one-expression-per-line. Although I don't assume comment in jsx as a common expression.
For example:
<Foo>bar</Foo>{/* TODO: This line may be deleted. */}
However, the comment {/* */} will be treat as a common expression {}.
Suggested solution
Add a ignoreComments option to the jsx-one-expression-per-line rule.
The rule from eslint-plugin-react added a non-jsx option "to allow non-JSX children in one line". I wonder if that change would resolve this issue too?
Clear and concise description of the problem
Adding a comment at the end of a jsx line can unexpectedly raise
jsx-one-expression-per-line
. Although I don't assume comment in jsx as a common expression.For example:
However, the comment
{/* */}
will be treat as a common expression{}
.Suggested solution
Add a
ignoreComments
option to thejsx-one-expression-per-line
rule.Alternative
Or add a new rule
jsx-lines-around-comment
which similar tolines-around-comment
but in JSX, and also ignore comments injsx-one-expression-per-line
.Additional context
Although maybe it is better to write as
I am more accustomed to add a comment after lines in JavaScript.
Validations
Contributes
The text was updated successfully, but these errors were encountered: