Skip to content
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

one-var not triggering a warning for mixed syntax #2570

Closed
neemzy opened this issue May 19, 2015 · 3 comments · May be fixed by iamstoick/javascript#11
Closed

one-var not triggering a warning for mixed syntax #2570

neemzy opened this issue May 19, 2015 · 3 comments · May be fixed by iamstoick/javascript#11
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@neemzy
Copy link
Contributor

neemzy commented May 19, 2015

Hi,

I just noticed the one-var rule, when activated, does not trigger a warning for cases such as :

var one = 1, two = 2;
var three;

If the rule is partially respected (first line), the violation on the second line isn't detected.
I'm using ESLint v0.21.1.

Thanks !

@ablin
Copy link

ablin commented May 19, 2015

👍

@lo1tuma
Copy link
Member

lo1tuma commented May 19, 2015

I can reproduce this with the online demo.

/*eslint one-var: [2, "always"]*/

var one = 1, two = 2;
var three;

Doesn’t give a warning, but

/*eslint one-var: [2, "always"]*/

var one = 1, two = 2;
var three;
var four;

gives one warning for var four;.

@lo1tuma lo1tuma added bug ESLint is working incorrectly rule Relates to ESLint's core rules labels May 19, 2015
@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label May 19, 2015
@lo1tuma
Copy link
Member

lo1tuma commented May 20, 2015

I think there is also a bug in an existing test-case: function foo() { var bar = true; var baz = false; var a; var b;} with options uninitialized: "always", initialized: "always" is expected to only have 2 errors, but IMHO this should have 3 errors.

nzakas added a commit that referenced this issue May 21, 2015
Fix: counting of variables statements in one-var (fixes #2570)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
4 participants