-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[New] jsx-indent-props: add ignoreTernaryOperator option
#2846
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
Conversation
ljharb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pick an option name where absence and false are the same.
How about, ignoreTernaryOperator that defaults to false?
docs/rules/jsx-indent-props.md
Outdated
| It takes an option as the second parameter which can either be the indent mode or an object to define further settings. | ||
| The indent mode can be `"tab"` for tab-based indentation, a positive number for space indentations or `"first"` for aligning the first prop for each line with the tag's first prop. | ||
| Note that using the `"first"` option allows very inconsistent indentation unless you also enable a rule that enforces the position of the first prop. | ||
| If second parameter is an object, it can be used to specify the indent mode as well as if the indent level is increased by a `?` operator `:` (default is `true`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If second parameter is an object, it can be used to specify the indent mode as well as if the indent level is increased by a `?` operator `:` (default is `true`). | |
| If the second parameter is an object, it can be used to specify the indent mode as well as if the indent level is increased by a `?`or `:` operator (default is `true`). |
| code: [ | ||
| '{this.props.test', | ||
| ' ? <span', | ||
| ' className="value"', | ||
| ' some={{aaa}}', | ||
| ' />', | ||
| ' : null}' | ||
| ].join('\n'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| code: [ | |
| '{this.props.test', | |
| ' ? <span', | |
| ' className="value"', | |
| ' some={{aaa}}', | |
| ' />', | |
| ' : null}' | |
| ].join('\n'), | |
| code: [ | |
| '{this.props.test', | |
| ' ? <span', | |
| ' className="value"', | |
| ' some={{aaa}}', | |
| ' />', | |
| ' : null}' | |
| ].join('\n'), |
i think that with increaseByTernaryOperator set to true, this should be what's valid, no?
Good idea, I've changed it that way and adjusted documentation and tests. |
increaseByTernaryOperator option for jsx-indent-propsjsx-indent-props: add ignoreTernaryOperator option
No description provided.