Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMultiple variable declaration in the same line #98
Comments
This comment has been minimized.
This comment has been minimized.
|
Hmm, yeah not getting any warnings on this either. flet@lappy:~/code$ cat blah.js
var x, y, z
var q = 1, r = 2, s = 3
var a = 1, b, c
var m = 0
var n
a = 2
b = 3
c = 4
a + 1
b + 1
// semicolon to prove things are working!
c + 1;
x + y + z + q + r + s + a + b + c + m + n
flet@lappy:~/code$ standard blah.js
Error: Use JavaScript Standard Style (https://github.com/feross/standard)
blah.js:15:6: Extra semicolon.
flet@lappy:~/code$ standard --version
3.3.0
|
This comment has been minimized.
This comment has been minimized.
|
ah, looks like the shiny new |
This comment has been minimized.
This comment has been minimized.
|
looks like turning this on breaks a lot of repos in test.js that are doing: var i, j, l, tmp, placeHolders, arr |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
D'oh! Multiple variable declarations in a single line should only be allowed when they're all undefined, like: var a, b, cI was so excited to release 3.3.0 to eliminate jscs and add the programmatic API that I forgot to enable |
This comment has been minimized.
This comment has been minimized.
|
I put up $20 on issue eslint/eslint#2206 in hopes it will get resolved soon. If anyone else wants to chip in, please do |
This comment has been minimized.
This comment has been minimized.
|
Nice |
This comment has been minimized.
This comment has been minimized.
|
No, let's leave it open so we don't forget. |
This comment has been minimized.
This comment has been minimized.
beaugunderson
commented
May 2, 2015
|
implemented in eslint/eslint@916277b but not in a release yet, will be in >0.20.0 |
This comment has been minimized.
This comment has been minimized.
|
Nice! |
This comment has been minimized.
This comment has been minimized.
|
We're still blocked on eslint/eslint#2336. That needs to be fixed before we can start using the latest eslint. |
This comment has been minimized.
This comment has been minimized.
|
Not confident it 2336 will be fixed soon... could turn down the padded blocks rule temporarily I suppose... |
This comment has been minimized.
This comment has been minimized.
|
@feross any thoughts on relaxing the padded blocks rule in order to get to the latest eslint version? |
This comment has been minimized.
This comment has been minimized.
|
@Flet Yeah, let's just do that. The padded block rule isn't important for correctness or catching errors. |
This comment has been minimized.
This comment has been minimized.
|
I just tried adding the rule
With this error: I'm inclined to hold off on this rule until we can ignore for loops somehow. |
This comment has been minimized.
This comment has been minimized.
|
Issue opened here: eslint/eslint#2505 |
feross
added
bug
blocked
labels
May 13, 2015
feross
closed this
in
standard/eslint-config-standard@c55d98d
Jun 11, 2015
feross
added a commit
that referenced
this issue
Jun 11, 2015
This comment has been minimized.
This comment has been minimized.
|
ESLint finally fixed the bug where multiple vars were being checked in for statements! Released 4.2.0 with the new rule: "Split initialized 'var' declarations into multiple statements". Arguably this could have been a semver major change, but not a single clone test failed (and we have nearly 80 repos in there!), so the risk is low. |
ricardofbarros commentedApr 1, 2015
Is this allowed?
Standard isn't complaining about multiple variable declaration in the same line and in your examples you have variable declaration in each line.