sindresorhus/eslint-plugin-unicorn

`no-unnecessary-polyfills`: respect `.browserslistrc`

Fechada

#2.389 aberto em 24 de jun. de 2024

 (0 comentário) (2 reações) (0 responsável)JavaScript (468 forks)user submission
enhancementevaluatinghelp 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

Description

Currently it will respect a browserlist field in package.json but it would be great if it could also respect the .browserslistrc file.

This will be a little more complicated though as that file can define multiple targets, so an option as to which target to respect would also need to be added, defaulting to production.

Fail

# .browserslistrc

[production]
since 2024

[development]
last 1 version
if (!("groupBy" in Object)) {
  import("object.groupby").then(({ shim }) => shim())
}

Pass

# .browserslistrc

[production]
since 2020

[development]
last 1 version
if (!("groupBy" in Object)) {
  import("object.groupby").then(({ shim }) => shim())
}

Additional Info

No response

Guia do colaborador