Skip to content
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

[New] jsx-indent-props: add ignoreTernaryOperator option #2846

Merged
merged 1 commit into from Dec 23, 2020
Merged

[New] jsx-indent-props: add ignoreTernaryOperator option #2846

merged 1 commit into from Dec 23, 2020

Conversation

polyrainbow
Copy link

No description provided.

Copy link
Member

@ljharb ljharb left a 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?

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`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`).

Comment on lines 157 to 172
code: [
'{this.props.test',
' ? <span',
' className="value"',
' some={{aaa}}',
' />',
' : null}'
].join('\n'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

@polyrainbow
Copy link
Author

Let's pick an option name where absence and false are the same.

How about, ignoreTernaryOperator that defaults to false?

Good idea, I've changed it that way and adjusted documentation and tests.

@ljharb ljharb changed the title [New] Added increaseByTernaryOperator option for jsx-indent-props [New] jsx-indent-props: add ignoreTernaryOperator option Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants