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

[eslint] change operator-linebreak option for ternary operators #2578

Merged
merged 1 commit into from May 12, 2020

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Feb 22, 2020

Current configuration enforces ternary expressions to be written like:

a ?
b :
c

This is the opposite of the popular style. It is probably a mistake introduced during the time when this project was being converted to Airbnb style.

.eslintrc Outdated
@@ -23,7 +23,7 @@
"ignoreTemplateLiterals": true,
"ignoreComments": true,
}],
"operator-linebreak": [2, "after"],
"operator-linebreak": [2, "after", {"overrides": {"?": "before", ":": "before" }}],
Copy link
Member

Choose a reason for hiding this comment

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

if this line is removed, isn’t this what the Airbnb config already mandates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

oh right. how much would change if we switched to that? Alternately, could we use before here, and use explicit overrides for the ones we want set to after, to match the Airbnb config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will be 840 lines of codes changed if that said option were to be switched to Airbnb style.
golopot@2678544
I would like to see the option being kept as is, due to my personal preference for "after" style, and for the sake of avoiding git diffs in history.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer the "before" style personally; but even if we wanted to continue setting operators like && to "after", that seems better to me (ie, to be overriding airbnb's "before" setting for specific operators, instead of replacing them)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose the next action is you come up with an configuration and I will accept it. I believe you.

@ljharb ljharb force-pushed the eslint-operator-linebreak branch from 6c96412 to e293f1f Compare May 12, 2020 18:39
@ljharb
Copy link
Member

ljharb commented May 12, 2020

I'm going ahead with the "before" style by removing the override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants