💼 This rule is enabled in the following configs: ✅ recommended, ☑️ unopinionated.
This rule helps to use existing methods instead of using extra polyfills.
package.json
// package.json
{
"engines": {
"node": ">=8"
}
}
// ❌
import assign from 'object-assign';// package.json
{
"engines": {
"node": "4"
}
}
// ✅
import assign from 'object-assign'; // Passes as Object.assign is not supportedType: object
Type: string | string[] | object
Specify the target versions, which could be a Browserslist query or a targets object. See the core-js-compat targets option for more info.
If the option is not specified, the target versions are defined using the browserslist field in package.json, or as a last resort, the engines field in package.json.
"unicorn/no-unnecessary-polyfills": [
"error",
{
"targets": "node >=12"
}
]"unicorn/no-unnecessary-polyfills": [
"error",
{
"targets": [
"node 14.1.0",
"chrome 95"
]
}
]"unicorn/no-unnecessary-polyfills": [
"error",
{
"targets": {
"node": "current",
"firefox": "15"
}
}
]