sindresorhus/eslint-plugin-unicorn

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

已关闭

#2,389 创建于 2024年6月24日

 (0 条评论) (2 个反应) (0 位负责人)JavaScript (468 个派生)user submission
enhancementevaluatinghelp wanted

仓库指标

星标
 (5,022 个星标)
PR 合并指标
 (平均合并 1天 16小时) (30 天内合并 399 个 PR)

描述

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

贡献者指南