-
-
Notifications
You must be signed in to change notification settings - Fork 932
Closed
Labels
A-linterArea - LinterArea - LinterC-bugCategory - BugCategory - Buggood first issueExperience Level - Good for newcomersExperience Level - Good for newcomers
Description
As I commented here, I believe any auto-fix for no-useless-spread is potentially invalid. I provided a specific example in that comment, but in general I don't believe it's possible to statically determine whether iterating over the original iterable vs. a cloned array of the original iterable will yield different results. Here's a fairly trivial example that results in very different results:
const set = new Set([1, 2, 3]);
console.log('before:', set);
for (const element of [...set]) {
console.log('element:', element);
set.add(element * 2);
}
console.log('after:', set);I don't believe auto-fixes should be made unless the lint rule can, with very high confidence, ensure that the semantics are unchanged.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - LinterC-bugCategory - BugCategory - Buggood first issueExperience Level - Good for newcomersExperience Level - Good for newcomers
Type
Fields
Give feedbackPriority
None yet