-
-
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
Rule proposal: indentation of closing bracket #64
Comments
aside: from self-closing brackets, i would always like a space before it. Yes; <div /> No: <div/> |
Would be a welcome rule. I personally use: <MyComponent
myProp="..."
>
Children
</MyComponent>
<MyComponent
myProp="..."
/> |
I think it can be an option for #14 |
Great work on adding this rule. However, I think it should support the following style: <MyComponent
myProp="..."
>
Children
</MyComponent>
<MyComponent
myProp="..."
/> This way you can clearly see where each component begins and ends based on the indentation. This style is especially beneficial when you have nesting: <MyComponent
myProp="..."
>
<MyComponent
myProp="..."
>
<MyComponent
myProp="..."
>
Children
</MyComponent>
</MyComponent>
</MyComponent> Would you be open to adding this as an option to this rule? Should I open a different issue? |
Since You should be able to enforce this style with the following configuration: "jsx-closing-bracket-location": [1, {
"nonEmpty": "props-aligned", // Align the bracket with the last prop
"selfClosing": "tag-aligned" // Align the bracket with the opening tag
}] |
Ah! I see. Thanks. I think I misread the documentation. :) |
Similar to #14 and #15, it might be nice to have a rule that specifies the indentation of closing brackets for JSX.
For non-self-closing tags, I've seen three different patterns: on the same line as last prop (should maybe be handled by #14), on new line but same indentation as props, and on new line but same indentation as opening bracket.
Same line:
New line, same indentation as props:
New line, same indentation as opening bracket:
For self-closing tags, I've seen the same patterns, but one might want to be able to specify differences. For example, one might want to have non-self-closing be at same indentation as props, but self closing to be at same indentation as opening bracket:
The text was updated successfully, but these errors were encountered: