ITADN
sindresorhus/eslint-plugin-unicorn

版本发布 8

v62.0.0
? · 2025-10-26

### New rules - [`no-immediate-mutation`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/30f08471987e620755963ef2809ecc3dbcdb21d5/docs/rules/no-immediate-mutation.md) (#2787) e1c7d2ed - [`no-useless-collection-argument`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/30f08471987e620755963ef2809ecc3dbcdb21d5/docs/rules/no-useless-collection-argument.md) (#2777) 2d07c9a9 - [`prefer-response-static-json`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/30f08471987e620755963ef2809ecc3dbcdb21d5/docs/rules/prefer-response-static-json.md) (#2778) ffe5943b ### Improvements - `text-encoding-identifier-case`: Add [`withDash`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/30f08471987e620755963ef2809ecc3dbcdb21d5/docs/rules/text-encoding-identifier-case.md#withdash) option (#2780) 90253860 - `no-useless-undefined`: Check one `undefined` at a time (#2792) 27f75099 - `prefer-single-call`: Check optional chaining (#2788) 8a132ace - `text-encoding-identifier-case`: Enforce `'utf-8'` in `form[acceptCharset]` and `TextDecoder` (#2785) 46b39741 - `prefer-node-protocol`: Handle TypeScript import types (#2774) 13a37a0d - `no-array-for-each`: Ignore `forEach` for Effect library (#2783) 2ef6f831 - `prefer-string-raw`: Ignore more places that requires a string (#2776) 43bc4299 - `prefer-string-raw`: Add support for template literals (#2691) 52723a24 - `prefer-global-this`: Add `navigation` to `windowSpecificAPIs` (#2770) 0c939985 - `prefer-code-point`: Report cases where `String.fromCharCode` is not called directly (#2766) 1d682a18 - `no-useless-spread`: Safely remove empty array and object (#2764) 7aeabab3 ### Fixes - `consistent-function-scoping`: Fix inconsistent behavior (#2748) a5464440 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v61.0.2...v62.0.0

v61.0.2
? · 2025-09-08

- `throw-new-error`: Fix false positive for Effect library (#2740) 0ddf5ead - `no-useless-undefined`: Ignore `Set#delete(undefined)` (#2739) 99acd272 - `prefer-includes` and `prefer-array-index-of`: Prevent crash on Vue files (#2645) a1da5182 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v61.0.1...v61.0.2

v61.0.1
? · 2025-09-06

- `prefer-classlist-toggle`: Omit `Element#classList.contains()` call when fixing (#2732) 066f96b9 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v61.0.0...v61.0.1

v60.0.0
? · 2025-07-21

### Breaking - Require Node.js 20.10 (#2698) 2dc27d90 ### New rules - [`prefer-class-fields`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md) (#2512) 4c82dc12 - [`no-array-reverse`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md) (#2677) b051302f - [`require-module-specifiers`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-specifiers.md) (#2686) 2a8e152e - [`no-useless-error-capture-stack-trace`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-error-capture-stack-trace.md) (#2676) fc900b61 ### Improvements - `prefer-string-replace-all`: Preserve escape (#2667) 2310b507 - Support `SuppressedError` (#2669) f51aeb9a ### Fixes - `no-array-callback-reference`: Fix optional chaining expressions being ignored (#2694) ad27922e - `no-unnecessary-await`: Fix handling of experimental pipeline operator (#2658) 2b8ebe57 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v59.0.1...v60.0.0

v59.0.1
? · 2025-05-06

- `prefer-single-call`: Fix crash on `CallExpression` followed by `FunctionDeclaration` (#2639) 3114dd9 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v59.0.0...v59.0.1

v59.0.0
? · 2025-04-27

### Breaking - Rename `no-array-push-push` rule to `prefer-single-call` (#2617) e117783 - Rename `no-length-as-slice-end` rule to `no-unnecessary-slice-end` (#2614) 1922df1 ### New rules - Add [`prefer-import-meta-properties`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-import-meta-properties.md) (#2607) 1f6e172 - Add [`no-unnecessary-array-flat-depth`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md) (#2618) c63e698 - Add [`no-unnecessary-array-splice-count`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md) (#2614) 1922df1 ### Improvements - Support `Float16Array` (#2622) 9e50568 - `prefer-node-protocol`: Support `process.getBuiltinModule()` (#2611) 056364d - `no-unnecessary-slice-end`: Support checking `Infinity` (#2614) 1922df1 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v58.0.0...v59.0.0

v58.0.0
? · 2025-03-24

### Potentially breaking - Update `engines.node` in package.json to match real compatibility (#2581) e48a620 ### Improvements - `escape-case`: Add [case option](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md#options) (#2559) 0f6048c - `number-literal-case`: Add [`hexadecimalValue` option](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md#hexadecimalvalue) (#2559) 0f6048c - `prevent-abbreviations`: Preserve `iOS` (#2560) e8798da ### Fixes - `no-unnecessary-polyfills`: Fix browserslist field name (#2603) 1a4c76f - `no-unnecessary-polyfills`: Fix crash on checking `es6-error` module (#2582) 66de41a - `no-accessor-recursion`: Fix exception when used in CommonJS (#2574) ca1e432 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v57.0.0...v58.0.0

v57.0.0
? · 2025-02-17

### Breaking - This package is now pure ESM. **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** - [Flat config](https://eslint.org/blog/2022/08/new-config-system-part-2/) is now required c44ea26 - [Migration guide](https://eslint.org/docs/latest/use/configure/migration-guide) - ESLint 9.20.0 or later is required c44ea26 ### New rules - [`consistent-date-clone`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-date-clone.md) (#2544) 8cebcf4 - [`no-named-default`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-named-default.md) (#2538) ed8da1b - [`consistent-assert`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-assert.md) (#2535) f3fc973 - [`no-instanceof-builtins`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-builtins.md) 8197574 41548c4 - [`no-accessor-recursion`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-accessor-recursion.md) (#2525) 92b5671 ### Improvements - Deprecate `no-instanceof-array` (#2534) c9c056c - Replaced by [`no-instanceof-builtin-object`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-builtins.md) which covers more cases. - `prefer-includes`: Support Vue template (#2526) 4e539b4 - `prevent-abbreviations`: Add `util` and `utils` to abbreviations (#2507) 5ba9f0a - `prefer-math-min-max`: Ignore BigInt (#2467) 8b7c5fc - `prefer-global-this`: Also exclude `outerWidth` and `outerHeight` (#2549) 8f00f76 - `prefer-at`: Remove unsafe autofix for `.slice` with 1 argument (#2476) 2985ecc - `prefer-math-min-max`: Reduce false positives in TypeScript (#2527) 1cbc561 - `prefer-string-raw`: Ignore `ImportAttribute` (#2551) d963ccd ### Fixes - `new-for-builtins`: Correct fix for `Date()` (#2543) e5e17f8 - `prefer-global-this`: Fix auto-fix for `typeof window` (#2501) b95dc12 --- https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v56.0.1...v57.0.0