sindresorhus/eslint-plugin-unicorn

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

Fechada

#2.253 aberto em 12 de jan. de 2024

 (1 comentário) (3 reações) (0 responsável)JavaScript (468 forks)user submission
bughelp wanted

Métricas do repositório

Stars
 (5.022 estrelas)
Métricas de merge de PR
 (Mesclagem média 1d 16h) (399 fundiu PRs em 30d)

Description

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

Guia do colaborador