sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`unicorn/no-invalid-remove-event-listener` does not report when optional chaining

mcenkar opened this issue · comments

Similar to #2252 but on unicorn/no-invalid-remove-event-listener

Rule works correctly without optional chaining:

image

However with optional chaining stops reporting error:

image
this.input?.removeEventListener(event, this.onInputEvent.bind(this), true)

Can be easily tested by adding ? after el: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/f0ff04d/test/no-invalid-remove-event-listener.mjs#L49