sindresorhus/eslint-plugin-unicorn

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

クローズ

#2,253 opened on 2024/01/12

 (1 件のコメント) (3 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
bughelp wanted

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

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

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