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
Conversation
.eslintrc
Outdated
@@ -23,7 +23,7 @@ | |||
"ignoreTemplateLiterals": true, | |||
"ignoreComments": true, | |||
}], | |||
"operator-linebreak": [2, "after"], | |||
"operator-linebreak": [2, "after", {"overrides": {"?": "before", ":": "before" }}], |
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 this line is removed, isn’t this what the Airbnb config already mandates?
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.
Airbnb config uses "before".
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.
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?
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.
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.
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.
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)
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.
I suppose the next action is you come up with an configuration and I will accept it. I believe you.
6c96412
to
e293f1f
Compare
I'm going ahead with the "before" style by removing the override. |
e293f1f
to
88d404d
Compare
Current configuration enforces ternary expressions to be written like:
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.