question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSCS modifications to one-var

See original GitHub issue

Starting to migrate from JSCS/JSHint and I was looking for the equivalent of requireMultipleVarDecl

Unfortunately one-var doesn’t cover this, as it prevents multiple variable declarations in a single scope. I’m looking for allowing multiple variables throughout the scope, but preventing consecutive var declarations.

Invalid:

var a = 0
var b = 1
var c = 2

console.log('hello')

var d
var e

Valid:

var a = 0
  , b = 1
  , c = 2

console.log('hello')

var d, e

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:33 (28 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, May 9, 2016

Now, I have a question.

var a = 0
  , b = 1
  , c = 2

console.log('hello')

var d, e  // Why 'one-var' rule is warning this declaration?

I feel it’s the responsibility of vars-on-top rule.

image

1reaction
nzakascommented, May 16, 2016

Maybe consecutive instead of neighbor?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - JSCS
There are a lot of internal changes but we like to keep this changelog short ... rule: fix more weird onevar constructs and...
Read more >
How to add JSCS to your pre-commit hook - NextRoll
Here's how we added JSCS, a JavaScript style checker, to our git ... if you're OK with declaring multiple variables with one var...
Read more >
Switched from JSCS to ESLint - horizon - OpenDev
This patch switches horizon from using JSCS to using ESlint. It adds the john papa style guides as an eslint plugin, and deactivates...
Read more >
jscs - npm
jscs is a code style linter for programmatically enforcing your style guide. You can configure jscs for your project in detail using over...
Read more >
require or disallow newlines around variable declarations ...
require or disallow newlines around variable declarations (one-var-declaration-per-line). Some developers declare multiple var statements on the same line:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found