-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enforce JSX new-line style #1680
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
I'm not sure a rule exists; your third example looks fine to me (the prop alignment would need fixing, ofc, but that's a separate rule) - but your second example; why would someone want that to pass? |
Sorry, that was very poorly written. My second example is currently a pass. I'm saying I want to enforce dropdown onto the next line for children, as shown in example 3. Currently, my config will let example 2 pass (and example 3 - but it won't enforce that style). I think I'm looking for the extra options from Mostly just looking for guidance as to how to enforce the third style (and not allow the second). |
A combination of closing bracket location, closing tag location, jsx-first-prop-new-line, jsx-indent-props, jsx-indent, jsx-one-expression-per-line, jsx-tag-spacing, and jsx-child-element-spacing, seems like it would be able to handle it? |
I'm also searching for how to achieve this effect. I think the missing piece, for me, is that I'm unwilling to use jsx-one-expression-per-line due to issues #1848 and #1855. Without jsx-one-expression-per-line I'm able to achieve the following fixed output:
With the desired output being:
|
I'm at best a hack when it comes to writing eslint rules, but I've cooked up one that implements what @codynova has described. It's up @ https://www.npmjs.com/package/@studysync/eslint-plugin-persnickety Light on docs but it should be pretty self-explanatory. HTH! |
@dkadrios if #1680 (comment) isn't accurate, I'd love a PR to one of the relevant rules to add an option to achieve it. |
Closing for now, but still happy to solve this issue if someone has a concrete idea. |
Hey,
Not sure if this rule already exists (I couldn't find it based on name), but this is an error:
This is a pass:
Is there a lint to enforce this? In words, if the component is multiline, the end of the open tag is not followed by anything (only a newline). It would also be good to validate that the children are indented one level further than the parent.
The text was updated successfully, but these errors were encountered: