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.

@ljharb
ljharb approved these changes Feb 22, 2020
.eslintrc Outdated
@@ -23,7 +23,7 @@
"ignoreTemplateLiterals": true,
"ignoreComments": true,
}],
"operator-linebreak": [2, "after"],
"operator-linebreak": [2, "after", {"overrides": {"?": "before", ":": "before" }}],

This comment has been minimized.

@ljharb

ljharb Feb 22, 2020
Collaborator

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

This comment has been minimized.

@ljharb

ljharb Feb 22, 2020
Collaborator

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?

This comment has been minimized.

@golopot

golopot Feb 22, 2020
Author Contributor

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.

This comment has been minimized.

@ljharb

ljharb Feb 22, 2020
Collaborator

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)

This comment has been minimized.

@golopot

golopot Feb 22, 2020
Author Contributor

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 golopot:eslint-operator-linebreak branch from 6c96412 to e293f1f May 12, 2020
@ljharb
Copy link
Collaborator

@ljharb ljharb commented May 12, 2020

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

@ljharb ljharb force-pushed the golopot:eslint-operator-linebreak branch from e293f1f to 88d404d May 12, 2020
@ljharb ljharb merged commit 88d404d into yannickcr:master May 12, 2020
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 97.621%
Details
@golopot golopot deleted the golopot:eslint-operator-linebreak branch May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants