-
-
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 discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What rule do you want to change?
array-callback-return
What change to do you want to make?
Implement suggestions
How do you think the change should be implemented?
A new option
Example code
// example of a non-void side-effect function
[1,2,3].forEach(n => cls.computeCache(n))
// will suggest the following
// Insert void
[1,2,3].forEach(n => void cls.computeCache(n))
// Wrap in {}
[1,2,3].forEach(n => {cls.computeCache(n)})
What does the rule currently do for this code?
Rightfully marks it as wrong, as return value of forEach
's callback is ignored
However, even adding a void in front does not fix the issue, and there are no IDE suggestions
What will the rule do after it's changed?
add a new option allowVoid
. It will share the same logic that I have implemented for detecting void
and suggesting fixes in #17282
If #17282 passes, then it is logical that this rule has consistent options and behavior.
Participation
- I am willing to submit a pull request to implement this change.
Additional comments
I think I saw an issue related to forEach
and void
, but I can't seem to find it for now
Metadata
Metadata
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 discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete