sindresorhus/eslint-plugin-unicorn

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

Open

#2,253 opened on 2024年1月12日

GitHub で見る
 (1 comment) (3 reactions) (0 assignees)JavaScript (5,022 stars) (468 forks)user submission
bughelp wanted

説明

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

Rule works correctly without optional chaining:

However with optional chaining stops reporting error:

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

コントリビューターガイド

`unicorn/no-invalid-remove-event-listener` does not report when optional chaining · sindresorhus/eslint-plugin-unicorn#2253 | Good First Issue