💼 This rule is enabled in the ✅ recommended
config.
✅ This rule is part of the recommended config.
This rules helps to use existing methods instead of using extra polyfills.
package.json
{
"engines": {
"node": ">=8"
}
}
const assign = require('object-assign');
package.json
{
"engines": {
"node": "4"
}
}
const assign = require('object-assign'); // Passes as Object.assign is not supported
Type: object
Type: string | string[] | object
Specify the target versions, which could be a Browserlist 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 browserlist
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"
}
}
]