no-extra-bind fix could be unsafe #10846
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
Tell us about your environment
Came across this while testing
no-extra-bind
for Coffeescript custom parser5.5.0
8.11.4
6.2.0
What parser (default, Babel-ESLint, etc.) are you using?
Coffeescript custom parser (but the issue is the same with standard parser)
Please show your full configuration:
The relevant configuration is
no-extra-bind: error
with fixing enabledWhat did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
I noticed that
no-extra-bind
when fixing blindly removes the.bind(...)
without inspecting the argument to.bind()
. This seems like it could change meaning if the argument is not side-effect-freeFor example:
or:
What did you expect to happen?
It should presumably still report the unnecessary
.bind()
but not fix if it's unsafe to remove the.bind(...)
What actually happened? Please include the actual, raw output from ESLint.
The fix removed the
.bind(...)
I could take a crack at fixing this but it'd be helpful to know if there are already established patterns for checking if a node is "side-effect-free"?
The text was updated successfully, but these errors were encountered: