sindresorhus/eslint-plugin-unicorn

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

Open

#2,389 建立於 2024年6月24日

在 GitHub 查看
 (0 留言) (2 反應) (0 負責人)JavaScript (5,022 star) (468 fork)user submission
enhancementevaluatinghelp wanted

描述

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

貢獻者指南

`no-unnecessary-polyfills`: respect `.browserslistrc` · sindresorhus/eslint-plugin-unicorn#2389 | Good First Issue