-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
lib: use consistent indentation for ternaries #14078
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
In anticipation of stricter linting for indentation issues, modify ternary operators in lib that do not conform with the expected ESLint settings.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,8 +276,8 @@ | |
| get: function() { | ||
| if (!console) { | ||
| console = originalConsole === undefined ? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe parans around the conditional?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will do. |
||
| NativeModule.require('console') : | ||
| installInspectorConsole(originalConsole); | ||
| NativeModule.require('console') : | ||
| installInspectorConsole(originalConsole); | ||
| } | ||
| return console; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -395,10 +395,10 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { | |
| this.query = Object.create(null); | ||
| } | ||
|
|
||
| var firstIdx = (questionIdx !== -1 && | ||
| (hashIdx === -1 || questionIdx < hashIdx) ? | ||
| questionIdx : | ||
| hashIdx); | ||
| var firstIdx = | ||
| questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx) ? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: assign the condition to a variable, and fit it in one line (
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, done. |
||
| questionIdx : | ||
| hashIdx; | ||
| if (firstIdx === -1) { | ||
| if (rest.length > 0) | ||
| this.pathname = rest; | ||
|
|
@@ -586,8 +586,8 @@ Url.prototype.format = function format() { | |
| host = auth + this.host; | ||
| } else if (this.hostname) { | ||
| host = auth + (this.hostname.indexOf(':') === -1 ? | ||
| this.hostname : | ||
| '[' + this.hostname + ']'); | ||
| this.hostname : | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I was once asked to explain this snippet in a job interview 😵 host = auth + (
this.hostname.indexOf(':') === -1 ?
this.hostname :
'[' + this.hostname + ']'
);
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is tricky to fix that way because the custom There are some other ways to make this code clearer, but they will require benchmarks to confirm that they don't adversely affect performance. Stay tuned.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Obviously my comment can be deffered, or replaced with a TODO |
||
| '[' + this.hostname + ']'); | ||
| if (this.port) { | ||
| host += ':' + this.port; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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'm not particularly a fan of this multi-line inline substitution stuff. Can't we just set it to a variable and use the variable name instead?
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 agree. Yes, I did it, but I did not feel good about it. Will fix.