# no-unnecessary-polyfills

Rule `unicorn/no-unnecessary-polyfills`. Enforce the use of built-in methods instead of unnecessary polyfills.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #950 by reach, #1205 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-unnecessary-polyfills` | no | no | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-unnecessary-polyfills.md) |

## Code examples

### Incorrect: the rule reports this

```js
import assign from 'object-assign';
const object = assign(target, source);
```

### Correct: the rule accepts this

```js
const object = Object.assign(target, source);
```

```js
import assign from 'object-assign';
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-unnecessary-polyfills": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-unnecessary-global-this](https://lintradar.dev/rules/unicorn/no-unnecessary-global-this.md): Disallow unnecessary `globalThis` references.
- [unicorn/no-unreadable-object-destructuring](https://lintradar.dev/rules/unicorn/no-unreadable-object-destructuring.md): Disallow unreadable object destructuring.
- [unicorn/no-unnecessary-fetch-options](https://lintradar.dev/rules/unicorn/no-unnecessary-fetch-options.md): Disallow unnecessary options in `fetch()` and `new Request()`.
- [unicorn/no-unsafe-buffer-conversion](https://lintradar.dev/rules/unicorn/no-unsafe-buffer-conversion.md): Prevent unsafe use of ArrayBuffer view `.buffer`.
- [unicorn/no-transition-all](https://lintradar.dev/rules/unicorn/no-transition-all.md): Disallow `all` as a transition property.
- [unicorn/no-unsafe-promise-all-settled-values](https://lintradar.dev/rules/unicorn/no-unsafe-promise-all-settled-values.md): Disallow reading `.value` from `Promise.allSettled()` results without a fulfilled status guard.

---

Web page: https://lintradar.dev/rules/unicorn/no-unnecessary-polyfills. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
