-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
jsx-one-expression-per-line doesn't work with plain text #2152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See #1855. |
I did see those threads so I somewhat get the gist of what's happening. On further inspection I think this is actually related to the indenting style of spaces vs tabs:
vs without (after converting tabs to spaces): Regardless of intent, it seems like a bug that it reports the jsx-one-expression-per-line only along with tab enforcement over spaces - not sure if any other issues cover this, so apologies if this is a duplicate. |
I found a problem: It is because of tab indention for closed tag UPDATE Here is PR (#2198) |
@Ohar Thanks for fixing this. I ran into this same problem yesterday and was scratching my head about what was going wrong. Likewise I feel it'd be great if it were possible to release a new version including this fix (though of course I understand the maintainers are no doubt very busy). |
full disclosure: I'm mostly self-learned so I believe there's a nonzero possibility that I don't understand React best practices, but that being said I couldn't find any reason this code wouldn't be valid
The reason why I mention code validity is because everything performs as expected if I change the text to a string literal
{'Clear'}
or wrap it in some sort of React component / fragment<>Clear</>
. I've never seen code written that way without good reason, like a conditional text, so unless I'm mistaken, I don't think I need to wrap it in the aforementioned ways... but again, could be my inexperience.I've isolated it to the following rules, but I think they're part of the same package, so I'm not sure why they produce an error when together. Matching eslint tab rules to the eslint-plugin-react rules doesn't change my error.
Using the AirBnB defaults with these rules and the following versions:
The text was updated successfully, but these errors were encountered: