no-invalid-this in addEventListener anonymous function #17750
-
Should there be an error? /* eslint no-invalid-this: "error" */
document.querySelector('select').addEventListener('change', function () {
console.log(this.value);
}); |
Beta Was this translation helpful? Give feedback.
Answered by
mdjermanovic
Dec 12, 2023
Replies: 1 comment
-
Sorry for the lack of response. This rule can't be aware of all APIs, so in these cases you'll need to use eslint-disable comments. We also have a few in the eslint codebase, for example: Lines 87 to 95 in 9007719 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Rec0iL99
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the lack of response.
This rule can't be aware of all APIs, so in these cases you'll need to use eslint-disable comments.
We also have a few in the eslint codebase, for example:
eslint/tests/lib/cli.js
Lines 87 to 95 in 9007719