[no-void]: allow void arrow functions
See original GitHub issueWhat rule do you want to change?
no-void
Does this change cause the rule to produce more or fewer warnings? Fewer
How will the change be implemented? (New option, new default behavior, etc.)? Option - could also be implemented as standard behaviour depending on interpretation of the rules description.
Please provide some example code that this change will affect:
const log = x => void console.log(x);
What does the rule currently do for this code? Errors
What will the rule do after it’s changed? Not error
Are you willing to submit a pull request to implement this change? Yes
There are some legitimate uses for the void operator, one of which is even mentioned in the opening sentence of the no-void
docs:
It can be used to ignore any side effects expression may produce
The description of the no-void
rule to me seems to indicate that the rule is actually ideally about preventing the use of void
to get a “pure” undefined back in the pre-ES5 days when undefined was mutable:
The common case of using void operator is to get a “pure” undefined value as prior to ES5 the undefined variable was mutable:
So it might be arguable that this is technically a bug? But I don’t have a major preference on if it’s an option or not 😃
Based off #12688, which was closed for not following the template.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (6 by maintainers)
Top GitHub Comments
undefined
is still mutable, post-ES5, just not in the global scope.@kaicataldo sure thing 🙂