-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
tools: enable no-extra-semi rule in eslint #2205
Conversation
Oh damn, looks like we were working on this at the same time (#2207). |
Regarding Regarding bodyless loops: I see you wenn with a |
Closed #2207 in favor of this. Maybe you can take a hint from the few changes I did differently. |
|
ESLint already fixed the issue with the bodyless loops in eslint/eslint@25f14ae, which will eliminate 7 changes in this diff. I'd say let's wait until the ESLint 1.0 is out, which shouldn't be too far off, and then revisit this PR. |
OK then let's wait for v1.0. Good job on making them fix this issue so fast ! |
@@ -9,7 +9,7 @@ assert(Array.isArray(start)); | |||
|
|||
// busy-loop for 2 seconds | |||
var now = Date.now(); | |||
while (Date.now() - now < 2000); | |||
while (Date.now() - now < 2000) {} |
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.
This style shouldn't actually be enforced. You can do useful things inside while();
and for(;;);
statements.
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.
That's what the mentioned ESlint bugfix is about: bodyless loops :)
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 reverted those changes
@targos @joaocgreis @thefourtheye I forgot to mention in the onboarding session: We try to avoid purely style changes as much as possible. This is mostly because it makes Some concessions can be made for bringing the style to be more cohesive though. |
@@ -46,6 +48,8 @@ rules: | |||
comma-spacing: 2 | |||
## put semi-colon | |||
semi: 2 | |||
## disable semi-spacing | |||
semi-spacing: 0 |
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.
might as well remove it completely ;)
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.
all right
I started to work on the eslint update on my fork, using the latest rc2. |
No rule settings to avoid the errors?? If so, we need to suggest the settings to eslint |
@targos could you either report that to them, or pull one of the maintainers in here? Thanks. :) |
@Fishrock123 will do |
This issue might be relevant - eslint/eslint#3139. Looks like it was fixed yesterday. |
Still present in rc-3. |
We could do var x;
var y;
var z; instead of var x,
y,
z; Its easier to handle because you don't have to think whether to put a comma or semicolon on each line, but I fear a 500+ line diff might be too much noise. Another argument against the second style is that the 4-character alignment doesn't work anymore with Any thoughts on this? |
That'd be so purely style changes that it wouldn't be approved. That's not even a lint fixing change really. Let's just wait until it gets fixed. |
Looks the error on 4-space alignment is intended and I think I have to agree that strictly speaking it's an violation of 2-space indent. We could either go with disabling the rule, doing my suggestion above, or do a ugly var a,
b,
c; I think we should consider my suggestion, even if the diff is huge. One {const,let,var} per variable is found in style guides like https://github.com/airbnb/javascript#13.2. |
I also don't want to change so many lines just to content the linter. |
I'm -1 for the ugly fix. |
I'm for var per line if we'd have to change the indentation to two spaces. I'm against doing either though, the diff would probably be huge... Is it unavoidable now? |
Looking through the 592 indent errors reported by rc-3, it looks like some of these are unrelated to the |
@silverwind any idea why they didn't catch them before? I'd really prefer to have an exception rule to this tbh. |
Done, although that's really a purely stylistic change. |
Of course it is, but we keep getting PRs for it ;) |
The changes themselves LGTM. This is definitely churn though :-( |
LGTM. Yeah it's a bit of churn, but these are mostly on the closing bracket of functions, so shouldn't interfere with |
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Should this go in LTS? (My feeling is it should.) |
fine by me, kill those extra semi's with fire, adding lts-watch |
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: #2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: nodejs#2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: nodejs#2205 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This CL adds two rules:
no-extra-semi
semi-spacing (removed)
This one is up for discussion because the changes I had to make feel wrong to me.
For instance in
try {fs.rmdirSync(tmp(folder)); } catch (ex) {}
the space isn't really improving readability. Maybe it would better if we added a space as well at the beginning of thetry
block, but I can't find a rule for that.Because of that I would prefer to explicitly disable this rule in
.eslintrc
but it is the one that enforces spaces in code likefor(let i = 0; i < x; i++)
so we'd lose that check.