-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
jsx-curly-spacing should support "consistent" option #1493
Comments
Can you provide some code samples that it should warn on, and what it would autofix to? |
No newlines at either end is good:
Newlines at both ends is also good:
But mixing and matching is bad:
Related eslint rules that support |
Sounds like a great addition! The airbnb config would use this option. |
Definitely need this. There is also no rule to enforce a newline if the JSX curly brace block is multiline. Optionally I would not mind a rule that enforces curly brace blocks to be on their own lines too (the second example would be changed to Bad). Bad:
Good:
Good:
Not sure if it is possible, but inheriting the config settings from |
The third example is the one I'd want. |
I agree with you @ljharb. Currently I cannot enforce that with eslint-plugin-react. I can try and find some time to do a dirty addition, but I am not familiar with writing eslint rules. It might go faster with someone else who is more familiar. |
Is anybody found the way how to configure eslint for 3rd example above? |
This rule effectively doesn't exist. :( |
Should also enforce consistent spacing around content. BAD (missing space at end) GOOD (space before + after) GOOD? (no spaces before/after) |
A PR to implement this is most welcome. |
Similar to how other eslint rules provide a "consistent" option for square brackets, curly braces, and parens, there should be a similar option for the curly braces in JSX. Basically, the absence or presence of a newline after the opening curly brace should be matched at the closing curly brace.
The text was updated successfully, but these errors were encountered: