Add a couple of new eslint-plugin-unicorn rules

The recent `eslint-plugin-unicorn` update added, and replaced, a few rules that seem useful for us; please refer to https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v59.0.0

Note that none of the following rules required any code-changes:
 - Replace `no-array-push-push` with `prefer-single-call`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-single-call.md

 - Add `no-unnecessary-slice-end`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md

 - Add `no-unnecessary-array-flat-depth`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md

 - Add `no-unnecessary-array-splice-count`, see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md
This commit is contained in:
Jonas Jenwald 2025-05-11 16:23:50 +02:00
parent b05351ceae
commit b81b9ce00d

View File

@ -126,7 +126,6 @@ export default [
"perfectionist/sort-exports": "error",
"perfectionist/sort-named-exports": "error",
"unicorn/no-abusive-eslint-disable": "error",
"unicorn/no-array-push-push": "error",
"unicorn/no-array-reduce": ["error", { allowSimpleOperations: true }],
"unicorn/no-console-spaces": "error",
"unicorn/no-instanceof-builtins": "error",
@ -134,6 +133,9 @@ export default [
"unicorn/no-new-buffer": "error",
"unicorn/no-single-promise-in-promise-methods": "error",
"unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }],
"unicorn/no-unnecessary-array-flat-depth": "error",
"unicorn/no-unnecessary-array-splice-count": "error",
"unicorn/no-unnecessary-slice-end": "error",
"unicorn/no-useless-promise-resolve-reject": "error",
"unicorn/no-useless-spread": "error",
"unicorn/prefer-array-find": "error",
@ -153,6 +155,7 @@ export default [
"unicorn/prefer-negative-index": "error",
"unicorn/prefer-optional-catch-binding": "error",
"unicorn/prefer-regexp-test": "error",
"unicorn/prefer-single-call": "error",
"unicorn/prefer-string-replace-all": "error",
"unicorn/prefer-string-starts-ends-with": "error",
"unicorn/prefer-ternary": ["error", "only-single-line"],