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

newline-after-var declare in for loop #2317

Closed
corbinu opened this issue Apr 15, 2015 · 3 comments
Closed

newline-after-var declare in for loop #2317

corbinu opened this issue Apr 15, 2015 · 3 comments
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

@corbinu
Copy link
Contributor

corbinu commented Apr 15, 2015

I like the new line after var feature how ever I was wondering if it would be possible to add an option to allow it to ignore values declared in a for loop. Currently when newline-after-var is enabled this is considered an error

for (let i = 0; i<10; i++) {
    console.log(i);
}

Obviously this is possible but it defeats the purpose of the "i" only being defined in the scope of the for using let

let i;

for (i = 0; i<10; i++) {
    console.log(i);
}
@gyandeeps
Copy link
Member

I think this option should be supported by default.

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

nzakas commented Apr 15, 2015

Can you provide the ESLint output for your example code? And what version of ESLint are you using?

@corbinu
Copy link
Contributor Author

corbinu commented Apr 15, 2015

it is 0.19 the latest and the output is
warning Expected blank line after variable declarations newline-after-var

@nzakas nzakas closed this as completed in e0efca7 Apr 16, 2015
nzakas added a commit that referenced this issue Apr 16, 2015
Fix: newline-after-var to ignore declare in for specifiers (fixes #2317)
@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
Development

No branches or pull requests

3 participants