-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionautofixThis change is related to ESLint's autofixing capabilitiesThis change is related to ESLint's autofixing capabilitiesbugESLint is working incorrectlyESLint is working incorrectlyrepro:yesIssues with a reproducible exampleIssues with a reproducible exampleruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
How to reproduce?
config:
'no-var': ['error']
code:
var fx = function (i = 0) {
if (i < 5) {
return fx(i + 1);
}
console.log(i);
};
fx();
What did you expect to happen?
var fx
autofixed to let fx
I tried the code in a sandpit and it behaves the same.
What actually happened?
not autofixed, Unexpected var, use let or const instead no-var
error is generated
(autofix of var
-> let
works in other cases, the problem is present only when the variable is referred in anonymous function in the same declaration)
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionautofixThis change is related to ESLint's autofixing capabilitiesThis change is related to ESLint's autofixing capabilitiesbugESLint is working incorrectlyESLint is working incorrectlyrepro:yesIssues with a reproducible exampleIssues with a reproducible exampleruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete