sindresorhus/eslint-plugin-unicorn

More powerful `new-for-builtins`

Fechada

#1.835 aberto em 27 de mai. de 2022

 (5 comentários) (2 reações) (0 responsável)JavaScript (468 forks)user submission
enhancementhelp wanted

Métricas do repositório

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

Description

Currently, new-for-builtins enforce builtins used either call or new.

My idea is to extend this rule to check all builtins.

  • Objects like JSON/Math/Reflect/Temporal should be neither call nor new
  • Objects from global objects like Intl.DateTimeFormat/Temporal.Now... should also be checked
  • Only fix cases new and call result the same Function('')/new Function(''), Error('')/new Error(''), use suggestion for other cases like new Symbol()(runtime error)

Guia do colaborador