Uh oh!
There was an error while loading. Please reload this page.
tools: switch from closure-linter to eslint - #1539
Conversation
There was a problem hiding this comment.
Style guide is to put two blank newlines between top-level statements.
There was a problem hiding this comment.
I don't think the current linter enforces this, but if possible, I'd loosen that rule to permit double empty lines in jscs. Otherwise, I'd be fine if we drop that requirement.
There was a problem hiding this comment.
thanks. two blank lines between functions is useful.
chrisdickinson
commented
Apr 27, 2015
Would it be possible to re-cut these commits into commits per-lib-file, one commit removing gjslint, one commit adding eslint, and one commit adding the eslint config? My computer can't handle showing the diff right now. |
There was a problem hiding this comment.
I'd allow this through "quotes": [2, "single", "avoid-escape"]
silverwind
commented
Apr 27, 2015
I think generally we should keep unused args where possible, if just for future reference. I'd suggest "no-unused-vars": [2,{"vars": "all","args": "none"}]For the DTRACE vars, I think we could create a custom rule. I'd be vary of template strings in performance-critical parts, I think they aren't optimized as well as regular string concatenation. Overall I like it as a first step, we can use this as a base to further tighten the rules later. |
yosuke-furukawa
commented
Apr 29, 2015
@chrisdickinson@silverwind Thanks for your review.
But I have not fixed the I would like to discuss the rules. two blank newlinesUnfortunately, I could not find the "two blank newlines between top-level statements" on current If we don't have the interest to permit the rule, we set IMO, I would like to change the rule "two blank newlines" to "single newline". If so, no need to change current commits. :) |
silverwind
commented
Apr 29, 2015
I'd be fine with single newline, I love compact code. |
yosuke-furukawa
commented
Apr 29, 2015
@silverwind Thanks! And we also discuss about the ES6 rules. "ecmaFeatures": {"blockBindings": true,"templateStrings": true,"octalLiterals": true,"binaryLiterals": true},
And I just use templateStrings on some exception messages. |
silverwind
commented
Apr 29, 2015
Would like a quick TC consensus whether we should drop or keep the 'two empty lines' rule between top-level 'blocks' in JavaScript files. Me and @yosuke-furukawa would like to drop that rule. |
There was a problem hiding this comment.
IMO, we should use condition in conditional sentences.
I am happy if linter checks the following bug.
if(a='test'){// a == 'test' is really needed code // ...}There was a problem hiding this comment.
Hmm, while assignment inside a condition is a common error, I like the conciseness of how it was before.
There was a problem hiding this comment.
The common practice for those assignments is to write them like this:
// good codeif((a='test')){// ...}So additional parentheses are a signal to a linter that a developer is intended to write this code as is.
But this is very verbose and completely unnecessary:
// don't do thisif((a='test')===true){// ...}Fishrock123
commented
Apr 29, 2015
I am +1 on moving to a more modern linter. I am very -1 on the current state of style changes. This is currently far too strict. (Also more than one-line-spacing shouldn't matter to the linter..) |
There was a problem hiding this comment.
I feel like it's more common style to leave blank space on { }. Could we leave that?
There was a problem hiding this comment.
Agree, looks subjectively cleaner with the spaces.
There was a problem hiding this comment.
Agree. We should change disallowSpacesInsideObjectBrackets on .jscsrc .
rlidwka
commented
Apr 30, 2015
Same thought here. This PR is about changing linter, not changing code style. If eslint/jscs can't validate the existing code style, it is not a good reason to change the existing code (you know, I don't have much of experience with |
silverwind
commented
Apr 30, 2015
Agreed, we should first get the linter in with the minimal necessary changes. Further changes to the rules can be discussed in seperate PRs. |
rlidwka
commented
Apr 30, 2015
Maybe enable only a minimal subset of eslint rules first (I personally use only 11 rules that detect most of the errors). After that we could discuss each and every rule you want to enable on top of that in separate PRs. |
yosuke-furukawa
commented
Apr 30, 2015
Agreed. I should separate the eslint/jscs change request and code style change request. |
yosuke-furukawa
commented
May 1, 2015
@chrisdickinson@silverwind@Fishrock123@trevnorris@rlidwka I loosen the eslint and jscs rules and I applied the minimum rule sets. I just use semicolon, comma, comment rules. please see the following eslint / jscs rules.
LGTY???? |
rlidwka
commented
May 1, 2015
I don't like that list of disabled rules in Maybe use I'm not familiar with |
silverwind
commented
May 6, 2015
@yosuke-furukawa can you rebase please? The recent revert of |
yosuke-furukawa
commented
May 7, 2015
@silverwind Done. But If this pull request merged, I will re-rebase them. #1650 |
silverwind
commented
May 7, 2015
LGTM |
Fishrock123
commented
May 7, 2015
I'm ok with these style fixes. @iojs/collaborators ptal |
indutny
commented
May 7, 2015
I'm fine with this! LGTM |
jbergstroem
commented
May 7, 2015
LGTM |
trevnorris
commented
May 8, 2015
Great job keeping it as close to how things are currently done. LGTM |
yosuke-furukawa
commented
May 8, 2015
Thank you for your review! I would like to push the changes. I will squash my commits to 3 commits like:
Is that OK??? Does anyone have some suggestions ? |
silverwind
commented
May 8, 2015
I'd do two commits, one for the whole of eslint, including settings, the other for style fixes. |
yosuke-furukawa
commented
May 8, 2015
@silverwind No problem! |
PR-URL: #1539Fixes: #1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: #1539Fixes: #1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: #1539Fixes: #1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: #1539Fixes: #1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
yosuke-furukawa
commented
May 9, 2015
PR-URL: nodejs#1539Fixes: nodejs#1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
PR-URL: nodejs#1539Fixes: nodejs#1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
As we discussed before #1253, I would like to propose to switch from closure-linter to other
ES6 friendlylinter.Because closure-linter does not recognize
template string literals,classsyntax andarrow functions, etc...I have a motivation to improve our code to ES6. closure linter may be a blocker.
Currently, I just switched the closure linter to eslint and jscs.
And I fixed eslint errors in our existing JS files without test folder.
If you have any concerns, please tell me.
Reviewer: @chrisdickinson
Reviewer: @silverwind