{"_id":"eslint-unicorn","name":"eslint-unicorn","dist-tags":{"latest":"55.0.0"},"versions":{"55.0.0":{"name":"eslint-unicorn","version":"55.0.0","description":"More than 100 powerful ESLint rules","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/eslint-plugin-unicorn.git"},"funding":"https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"main":"index.js","types":"index.d.ts","sideEffects":false,"engines":{"node":">=18.18"},"scripts":{"bundle-lodash":"echo \"export {defaultsDeep, camelCase, kebabCase, snakeCase, upperFirst, lowerFirst} from 'lodash-es';\" | npx esbuild --bundle --outfile=rules/utils/lodash.js --format=cjs","create-rule":"node ./scripts/create-rule.mjs && npm run fix:eslint-docs","fix":"run-p --continue-on-error fix:*","fix:eslint-docs":"eslint-doc-generator","fix:js":"npm run lint:js -- --fix","fix:markdown":"npm run lint:markdown -- --fix","integration":"node ./test/integration/test.mjs","lint":"run-p --continue-on-error lint:*","lint:eslint-docs":"npm run fix:eslint-docs -- --check","lint:js":"xo","lint:markdown":"markdownlint \"**/*.md\"","lint:package-json":"npmPkgJsonLint .","run-rules-on-codebase":"eslint --config=./eslint.dogfooding.config.mjs","smoke":"eslint-remote-tester --config ./test/smoke/eslint-remote-tester.config.mjs","test":"npm-run-all --continue-on-error lint test:*","test:js":"c8 ava"},"keywords":["eslint","eslintplugin","eslint-plugin","unicorn","linter","lint","style","xo"],"dependencies":{"@babel/helper-validator-identifier":"^7.24.5","@eslint-community/eslint-utils":"^4.4.0","ci-info":"^4.0.0","clean-regexp":"^1.0.0","core-js-compat":"^3.37.0","esquery":"^1.5.0","globals":"^15.7.0","indent-string":"^4.0.0","is-builtin-module":"^3.2.1","jsesc":"^3.0.2","pluralize":"^8.0.0","read-pkg-up":"^7.0.1","regexp-tree":"^0.1.27","regjsparser":"^0.10.0","semver":"^7.6.1","strip-indent":"^3.0.0"},"devDependencies":{"@babel/code-frame":"^7.24.2","@babel/core":"^7.24.5","@babel/eslint-parser":"^7.24.5","@eslint/eslintrc":"^3.1.0","@lubien/fixture-beta-package":"^1.0.0-beta.1","@typescript-eslint/parser":"^8.0.0-alpha.12","ava":"^6.1.3","c8":"^9.1.0","chalk":"^5.3.0","enquirer":"^2.4.1","eslint":"^9.6.0","eslint-ava-rule-tester":"^5.0.1","eslint-doc-generator":"1.7.0","eslint-plugin-eslint-plugin":"^6.1.0","eslint-plugin-internal-rules":"file:./scripts/internal-rules/","eslint-remote-tester":"^4.0.0","eslint-remote-tester-repositories":"^2.0.0","espree":"^10.0.1","execa":"^8.0.1","listr":"^0.14.3","lodash-es":"^4.17.21","markdownlint-cli":"^0.40.0","memoize":"^10.0.0","npm-package-json-lint":"^7.1.0","npm-run-all2":"^6.1.2","outdent":"^0.8.0","pretty-ms":"^9.0.0","typescript":"^5.4.5","vue-eslint-parser":"^9.4.2","xo":"^0.58.0","yaml":"^2.4.2"},"peerDependencies":{"eslint":">=8.56.0"},"ava":{"files":["test/*.mjs","test/unit/*.mjs"]},"c8":{"reporter":["text","lcov"]},"xo":{"extends":["plugin:internal-rules/all"],"ignores":[".cache-eslint-remote-tester","eslint-remote-tester-results","rules/utils/lodash.js","test/integration/{fixtures,fixtures-local}/**"],"rules":{"unicorn/escape-case":"off","unicorn/expiring-todo-comments":"off","unicorn/no-hex-escape":"off","unicorn/no-null":"error","unicorn/prefer-array-flat":["error",{"functions":["flat","flatten"]}],"import/order":"off","func-names":"off"},"overrides":[{"files":["**/*.js"],"parserOptions":{"sourceType":"script"},"rules":{"strict":"error","unicorn/prefer-module":"off"}},{"files":["rules/*.js"],"plugins":["eslint-plugin"],"extends":["plugin:eslint-plugin/all"],"rules":{"eslint-plugin/require-meta-docs-description":["error",{"pattern":".+"}],"eslint-plugin/require-meta-docs-url":"off","eslint-plugin/require-meta-has-suggestions":"off","eslint-plugin/require-meta-schema":"off"}}]},"_id":"eslint-unicorn@55.0.0","gitHead":"77f32e5a6b2df542cf50dfbd371054f2cd8ce2d6","bugs":{"url":"https://github.com/sindresorhus/eslint-plugin-unicorn/issues"},"homepage":"https://github.com/sindresorhus/eslint-plugin-unicorn#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"integrity":"sha512-oStTXwy4T7fNyJzoHrsYeigIKktkYauVDfIjUod5YSCAroI0ZzZX0CXgVyludWKijydFkj3tKmuAxI6IO0/UTw==","shasum":"163c33ec851cd1c1d313ac6b4f387d1b53115206","tarball":"https://registry.npmjs.org/eslint-unicorn/-/eslint-unicorn-55.0.0.tgz","fileCount":226,"unpackedSize":699117,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDMZJ//wlPR8ozc38YTV71GTMPA3yvfl8yFmTPIuWcE8gIgZ6kf9d9DF9qe0LuGeEokh/+fDG5CVgQJ3GvBb9+avH0="}]},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/eslint-unicorn_55.0.0_1722893567350_0.37903542091336084"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-05T21:32:47.349Z","55.0.0":"2024-08-05T21:32:47.681Z","modified":"2024-08-05T21:32:47.956Z"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"description":"More than 100 powerful ESLint rules","homepage":"https://github.com/sindresorhus/eslint-plugin-unicorn#readme","keywords":["eslint","eslintplugin","eslint-plugin","unicorn","linter","lint","style","xo"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/eslint-plugin-unicorn.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/eslint-plugin-unicorn/issues"},"license":"MIT","readme":"# eslint-plugin-unicorn [![Coverage Status](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/eslint-plugin-unicorn/branch/main) [![npm version](https://img.shields.io/npm/v/eslint-plugin-unicorn.svg?style=flat)](https://npmjs.com/package/eslint-plugin-unicorn)\n\n<!-- markdownlint-disable-next-line no-inline-html -->\n<img src=\"https://cloud.githubusercontent.com/assets/170270/18659176/1cc373d0-7f33-11e6-890f-0ba35362ee7e.jpg\" width=\"180\" align=\"right\" alt=\"Unicorn\">\n\n> More than 100 powerful ESLint rules\n\nYou might want to check out [XO](https://github.com/xojs/xo), which includes this plugin.\n\n[**Propose or contribute a new rule ➡**](.github/contributing.md)\n\n## Install\n\n```sh\nnpm install --save-dev eslint eslint-plugin-unicorn\n```\n\n## Usage (`eslint.config.js`)\n\n**Requires ESLint `>=8.56.0`.**\n\nUse a [preset config](#preset-configs-eslintconfigjs) or configure each rule in `eslint.config.js`.\n\nIf you don't use the preset, ensure you use the same `languageOptions` config as below.\n\n### ES Module (Recommended)\n\n```js\nimport eslintPluginUnicorn from 'eslint-plugin-unicorn';\nimport globals from 'globals';\n\nexport default [\n\t{\n\t\tlanguageOptions: {\n\t\t\tglobals: globals.builtin,\n\t\t},\n\t\tplugins: {\n\t\t\tunicorn: eslintPluginUnicorn,\n\t\t},\n\t\trules: {\n\t\t\t'unicorn/better-regex': 'error',\n\t\t\t'unicorn/…': 'error',\n\t\t},\n\t},\n\t// …\n];\n```\n\n### CommonJS\n\n```js\n'use strict';\nconst eslintPluginUnicorn = require('eslint-plugin-unicorn');\nconst globals = require('globals');\n\nmodule.exports = [\n\t{\n\t\tlanguageOptions: {\n\t\t\tglobals: globals.builtin,\n\t\t},\n\t\tplugins: {\n\t\t\tunicorn: eslintPluginUnicorn,\n\t\t},\n\t\trules: {\n\t\t\t'unicorn/better-regex': 'error',\n\t\t\t'unicorn/…': 'error',\n\t\t},\n\t},\n\t// …\n];\n```\n\n## Usage (legacy: `.eslintrc.*` or `package.json`)\n\nUse a [preset config](#preset-configs-eslintrc-or-packagejson) or configure each rule in `package.json`.\n\nIf you don't use the preset, ensure you use the same `env` and `parserOptions` config as below.\n\n```json\n{\n\t\"name\": \"my-awesome-project\",\n\t\"eslintConfig\": {\n\t\t\"env\": {\n\t\t\t\"es2024\": true\n\t\t},\n\t\t\"parserOptions\": {\n\t\t\t\"ecmaVersion\": \"latest\",\n\t\t\t\"sourceType\": \"module\"\n\t\t},\n\t\t\"plugins\": [\n\t\t\t\"unicorn\"\n\t\t],\n\t\t\"rules\": {\n\t\t\t\"unicorn/better-regex\": \"error\",\n\t\t\t\"unicorn/…\": \"error\"\n\t\t}\n\t}\n}\n```\n\n## Rules\n\n<!-- Do not manually modify this list. Run: `npm run fix:eslint-docs` -->\n<!-- begin auto-generated rules list -->\n\n💼 [Configurations](https://github.com/sindresorhus/eslint-plugin-unicorn#preset-configs-eslintconfigjs) enabled in.\\\n✅ Set in the `recommended` [configuration](https://github.com/sindresorhus/eslint-plugin-unicorn#preset-configs-eslintconfigjs).\\\n🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\\\n💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).\n\n| Name                                                                                             | Description                                                                                                                                                                                                       | 💼 | 🔧 | 💡 |\n| :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- | :- | :- |\n| [better-regex](docs/rules/better-regex.md)                                                       | Improve regexes by making them shorter, consistent, and safer.                                                                                                                                                    | ✅  | 🔧 |    |\n| [catch-error-name](docs/rules/catch-error-name.md)                                               | Enforce a specific parameter name in catch clauses.                                                                                                                                                               | ✅  | 🔧 |    |\n| [consistent-destructuring](docs/rules/consistent-destructuring.md)                               | Use destructured variables over properties.                                                                                                                                                                       |    | 🔧 | 💡 |\n| [consistent-empty-array-spread](docs/rules/consistent-empty-array-spread.md)                     | Prefer consistent types when spreading a ternary in an array literal.                                                                                                                                             | ✅  | 🔧 |    |\n| [consistent-function-scoping](docs/rules/consistent-function-scoping.md)                         | Move function definitions to the highest possible scope.                                                                                                                                                          | ✅  |    |    |\n| [custom-error-definition](docs/rules/custom-error-definition.md)                                 | Enforce correct `Error` subclassing.                                                                                                                                                                              |    | 🔧 |    |\n| [empty-brace-spaces](docs/rules/empty-brace-spaces.md)                                           | Enforce no spaces between braces.                                                                                                                                                                                 | ✅  | 🔧 |    |\n| [error-message](docs/rules/error-message.md)                                                     | Enforce passing a `message` value when creating a built-in error.                                                                                                                                                 | ✅  |    |    |\n| [escape-case](docs/rules/escape-case.md)                                                         | Require escape sequences to use uppercase values.                                                                                                                                                                 | ✅  | 🔧 |    |\n| [expiring-todo-comments](docs/rules/expiring-todo-comments.md)                                   | Add expiration conditions to TODO comments.                                                                                                                                                                       | ✅  |    |    |\n| [explicit-length-check](docs/rules/explicit-length-check.md)                                     | Enforce explicitly comparing the `length` or `size` property of a value.                                                                                                                                          | ✅  | 🔧 | 💡 |\n| [filename-case](docs/rules/filename-case.md)                                                     | Enforce a case style for filenames.                                                                                                                                                                               | ✅  |    |    |\n| [import-style](docs/rules/import-style.md)                                                       | Enforce specific import styles per module.                                                                                                                                                                        | ✅  |    |    |\n| [new-for-builtins](docs/rules/new-for-builtins.md)                                               | Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.                                                                                                           | ✅  | 🔧 |    |\n| [no-abusive-eslint-disable](docs/rules/no-abusive-eslint-disable.md)                             | Enforce specifying rules to disable in `eslint-disable` comments.                                                                                                                                                 | ✅  |    |    |\n| [no-anonymous-default-export](docs/rules/no-anonymous-default-export.md)                         | Disallow anonymous functions and classes as the default export.                                                                                                                                                   | ✅  |    | 💡 |\n| [no-array-callback-reference](docs/rules/no-array-callback-reference.md)                         | Prevent passing a function reference directly to iterator methods.                                                                                                                                                | ✅  |    | 💡 |\n| [no-array-for-each](docs/rules/no-array-for-each.md)                                             | Prefer `for…of` over the `forEach` method.                                                                                                                                                                        | ✅  | 🔧 | 💡 |\n| [no-array-method-this-argument](docs/rules/no-array-method-this-argument.md)                     | Disallow using the `this` argument in array methods.                                                                                                                                                              | ✅  | 🔧 | 💡 |\n| [no-array-push-push](docs/rules/no-array-push-push.md)                                           | Enforce combining multiple `Array#push()` into one call.                                                                                                                                                          | ✅  | 🔧 | 💡 |\n| [no-array-reduce](docs/rules/no-array-reduce.md)                                                 | Disallow `Array#reduce()` and `Array#reduceRight()`.                                                                                                                                                              | ✅  |    |    |\n| [no-await-expression-member](docs/rules/no-await-expression-member.md)                           | Disallow member access from await expression.                                                                                                                                                                     | ✅  | 🔧 |    |\n| [no-await-in-promise-methods](docs/rules/no-await-in-promise-methods.md)                         | Disallow using `await` in `Promise` method parameters.                                                                                                                                                            | ✅  |    | 💡 |\n| [no-console-spaces](docs/rules/no-console-spaces.md)                                             | Do not use leading/trailing space between `console.log` parameters.                                                                                                                                               | ✅  | 🔧 |    |\n| [no-document-cookie](docs/rules/no-document-cookie.md)                                           | Do not use `document.cookie` directly.                                                                                                                                                                            | ✅  |    |    |\n| [no-empty-file](docs/rules/no-empty-file.md)                                                     | Disallow empty files.                                                                                                                                                                                             | ✅  |    |    |\n| [no-for-loop](docs/rules/no-for-loop.md)                                                         | Do not use a `for` loop that can be replaced with a `for-of` loop.                                                                                                                                                | ✅  | 🔧 | 💡 |\n| [no-hex-escape](docs/rules/no-hex-escape.md)                                                     | Enforce the use of Unicode escapes instead of hexadecimal escapes.                                                                                                                                                | ✅  | 🔧 |    |\n| [no-instanceof-array](docs/rules/no-instanceof-array.md)                                         | Require `Array.isArray()` instead of `instanceof Array`.                                                                                                                                                          | ✅  | 🔧 |    |\n| [no-invalid-fetch-options](docs/rules/no-invalid-fetch-options.md)                               | Disallow invalid options in `fetch()` and `new Request()`.                                                                                                                                                        | ✅  |    |    |\n| [no-invalid-remove-event-listener](docs/rules/no-invalid-remove-event-listener.md)               | Prevent calling `EventTarget#removeEventListener()` with the result of an expression.                                                                                                                             | ✅  |    |    |\n| [no-keyword-prefix](docs/rules/no-keyword-prefix.md)                                             | Disallow identifiers starting with `new` or `class`.                                                                                                                                                              |    |    |    |\n| [no-length-as-slice-end](docs/rules/no-length-as-slice-end.md)                                   | Disallow using `.length` as the `end` argument of `{Array,String,TypedArray}#slice()`.                                                                                                                            | ✅  | 🔧 |    |\n| [no-lonely-if](docs/rules/no-lonely-if.md)                                                       | Disallow `if` statements as the only statement in `if` blocks without `else`.                                                                                                                                     | ✅  | 🔧 |    |\n| [no-magic-array-flat-depth](docs/rules/no-magic-array-flat-depth.md)                             | Disallow a magic number as the `depth` argument in `Array#flat(…).`                                                                                                                                               | ✅  |    |    |\n| [no-negated-condition](docs/rules/no-negated-condition.md)                                       | Disallow negated conditions.                                                                                                                                                                                      | ✅  | 🔧 |    |\n| [no-negation-in-equality-check](docs/rules/no-negation-in-equality-check.md)                     | Disallow negated expression in equality check.                                                                                                                                                                    | ✅  |    | 💡 |\n| [no-nested-ternary](docs/rules/no-nested-ternary.md)                                             | Disallow nested ternary expressions.                                                                                                                                                                              | ✅  | 🔧 |    |\n| [no-new-array](docs/rules/no-new-array.md)                                                       | Disallow `new Array()`.                                                                                                                                                                                           | ✅  | 🔧 | 💡 |\n| [no-new-buffer](docs/rules/no-new-buffer.md)                                                     | Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.                                                                                                                 | ✅  | 🔧 | 💡 |\n| [no-null](docs/rules/no-null.md)                                                                 | Disallow the use of the `null` literal.                                                                                                                                                                           | ✅  | 🔧 | 💡 |\n| [no-object-as-default-parameter](docs/rules/no-object-as-default-parameter.md)                   | Disallow the use of objects as default parameters.                                                                                                                                                                | ✅  |    |    |\n| [no-process-exit](docs/rules/no-process-exit.md)                                                 | Disallow `process.exit()`.                                                                                                                                                                                        | ✅  |    |    |\n| [no-single-promise-in-promise-methods](docs/rules/no-single-promise-in-promise-methods.md)       | Disallow passing single-element arrays to `Promise` methods.                                                                                                                                                      | ✅  | 🔧 | 💡 |\n| [no-static-only-class](docs/rules/no-static-only-class.md)                                       | Disallow classes that only have static members.                                                                                                                                                                   | ✅  | 🔧 |    |\n| [no-thenable](docs/rules/no-thenable.md)                                                         | Disallow `then` property.                                                                                                                                                                                         | ✅  |    |    |\n| [no-this-assignment](docs/rules/no-this-assignment.md)                                           | Disallow assigning `this` to a variable.                                                                                                                                                                          | ✅  |    |    |\n| [no-typeof-undefined](docs/rules/no-typeof-undefined.md)                                         | Disallow comparing `undefined` using `typeof`.                                                                                                                                                                    | ✅  | 🔧 | 💡 |\n| [no-unnecessary-await](docs/rules/no-unnecessary-await.md)                                       | Disallow awaiting non-promise values.                                                                                                                                                                             | ✅  | 🔧 |    |\n| [no-unnecessary-polyfills](docs/rules/no-unnecessary-polyfills.md)                               | Enforce the use of built-in methods instead of unnecessary polyfills.                                                                                                                                             | ✅  |    |    |\n| [no-unreadable-array-destructuring](docs/rules/no-unreadable-array-destructuring.md)             | Disallow unreadable array destructuring.                                                                                                                                                                          | ✅  | 🔧 |    |\n| [no-unreadable-iife](docs/rules/no-unreadable-iife.md)                                           | Disallow unreadable IIFEs.                                                                                                                                                                                        | ✅  |    |    |\n| [no-unused-properties](docs/rules/no-unused-properties.md)                                       | Disallow unused object properties.                                                                                                                                                                                |    |    |    |\n| [no-useless-fallback-in-spread](docs/rules/no-useless-fallback-in-spread.md)                     | Disallow useless fallback when spreading in object literals.                                                                                                                                                      | ✅  | 🔧 |    |\n| [no-useless-length-check](docs/rules/no-useless-length-check.md)                                 | Disallow useless array length check.                                                                                                                                                                              | ✅  | 🔧 |    |\n| [no-useless-promise-resolve-reject](docs/rules/no-useless-promise-resolve-reject.md)             | Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks                                                                                                                    | ✅  | 🔧 |    |\n| [no-useless-spread](docs/rules/no-useless-spread.md)                                             | Disallow unnecessary spread.                                                                                                                                                                                      | ✅  | 🔧 |    |\n| [no-useless-switch-case](docs/rules/no-useless-switch-case.md)                                   | Disallow useless case in switch statements.                                                                                                                                                                       | ✅  |    | 💡 |\n| [no-useless-undefined](docs/rules/no-useless-undefined.md)                                       | Disallow useless `undefined`.                                                                                                                                                                                     | ✅  | 🔧 |    |\n| [no-zero-fractions](docs/rules/no-zero-fractions.md)                                             | Disallow number literals with zero fractions or dangling dots.                                                                                                                                                    | ✅  | 🔧 |    |\n| [number-literal-case](docs/rules/number-literal-case.md)                                         | Enforce proper case for numeric literals.                                                                                                                                                                         | ✅  | 🔧 |    |\n| [numeric-separators-style](docs/rules/numeric-separators-style.md)                               | Enforce the style of numeric separators by correctly grouping digits.                                                                                                                                             | ✅  | 🔧 |    |\n| [prefer-add-event-listener](docs/rules/prefer-add-event-listener.md)                             | Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.                                                                                                                                    | ✅  | 🔧 |    |\n| [prefer-array-find](docs/rules/prefer-array-find.md)                                             | Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.                                                                                                                            | ✅  | 🔧 | 💡 |\n| [prefer-array-flat](docs/rules/prefer-array-flat.md)                                             | Prefer `Array#flat()` over legacy techniques to flatten arrays.                                                                                                                                                   | ✅  | 🔧 |    |\n| [prefer-array-flat-map](docs/rules/prefer-array-flat-map.md)                                     | Prefer `.flatMap(…)` over `.map(…).flat()`.                                                                                                                                                                       | ✅  | 🔧 |    |\n| [prefer-array-index-of](docs/rules/prefer-array-index-of.md)                                     | Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.                                                                                            | ✅  | 🔧 | 💡 |\n| [prefer-array-some](docs/rules/prefer-array-some.md)                                             | Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.                                                                                                               | ✅  | 🔧 | 💡 |\n| [prefer-at](docs/rules/prefer-at.md)                                                             | Prefer `.at()` method for index access and `String#charAt()`.                                                                                                                                                     | ✅  | 🔧 | 💡 |\n| [prefer-blob-reading-methods](docs/rules/prefer-blob-reading-methods.md)                         | Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.                                                                                             | ✅  |    |    |\n| [prefer-code-point](docs/rules/prefer-code-point.md)                                             | Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.                                                                                           | ✅  |    | 💡 |\n| [prefer-date-now](docs/rules/prefer-date-now.md)                                                 | Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.                                                                                                                                       | ✅  | 🔧 |    |\n| [prefer-default-parameters](docs/rules/prefer-default-parameters.md)                             | Prefer default parameters over reassignment.                                                                                                                                                                      | ✅  | 🔧 | 💡 |\n| [prefer-dom-node-append](docs/rules/prefer-dom-node-append.md)                                   | Prefer `Node#append()` over `Node#appendChild()`.                                                                                                                                                                 | ✅  | 🔧 |    |\n| [prefer-dom-node-dataset](docs/rules/prefer-dom-node-dataset.md)                                 | Prefer using `.dataset` on DOM elements over calling attribute methods.                                                                                                                                           | ✅  | 🔧 |    |\n| [prefer-dom-node-remove](docs/rules/prefer-dom-node-remove.md)                                   | Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.                                                                                                                                             | ✅  | 🔧 | 💡 |\n| [prefer-dom-node-text-content](docs/rules/prefer-dom-node-text-content.md)                       | Prefer `.textContent` over `.innerText`.                                                                                                                                                                          | ✅  |    | 💡 |\n| [prefer-event-target](docs/rules/prefer-event-target.md)                                         | Prefer `EventTarget` over `EventEmitter`.                                                                                                                                                                         | ✅  |    |    |\n| [prefer-export-from](docs/rules/prefer-export-from.md)                                           | Prefer `export…from` when re-exporting.                                                                                                                                                                           | ✅  | 🔧 | 💡 |\n| [prefer-includes](docs/rules/prefer-includes.md)                                                 | Prefer `.includes()` over `.indexOf()`, `.lastIndexOf()`, and `Array#some()` when checking for existence or non-existence.                                                                                        | ✅  | 🔧 | 💡 |\n| [prefer-json-parse-buffer](docs/rules/prefer-json-parse-buffer.md)                               | Prefer reading a JSON file as a buffer.                                                                                                                                                                           |    | 🔧 |    |\n| [prefer-keyboard-event-key](docs/rules/prefer-keyboard-event-key.md)                             | Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.                                                                                                                                                          | ✅  | 🔧 |    |\n| [prefer-logical-operator-over-ternary](docs/rules/prefer-logical-operator-over-ternary.md)       | Prefer using a logical operator over a ternary.                                                                                                                                                                   | ✅  |    | 💡 |\n| [prefer-math-trunc](docs/rules/prefer-math-trunc.md)                                             | Enforce the use of `Math.trunc` instead of bitwise operators.                                                                                                                                                     | ✅  | 🔧 | 💡 |\n| [prefer-modern-dom-apis](docs/rules/prefer-modern-dom-apis.md)                                   | Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`. | ✅  | 🔧 |    |\n| [prefer-modern-math-apis](docs/rules/prefer-modern-math-apis.md)                                 | Prefer modern `Math` APIs over legacy patterns.                                                                                                                                                                   | ✅  | 🔧 |    |\n| [prefer-module](docs/rules/prefer-module.md)                                                     | Prefer JavaScript modules (ESM) over CommonJS.                                                                                                                                                                    | ✅  | 🔧 | 💡 |\n| [prefer-native-coercion-functions](docs/rules/prefer-native-coercion-functions.md)               | Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.                                                                                                                                      | ✅  | 🔧 |    |\n| [prefer-negative-index](docs/rules/prefer-negative-index.md)                                     | Prefer negative index over `.length - index` when possible.                                                                                                                                                       | ✅  | 🔧 |    |\n| [prefer-node-protocol](docs/rules/prefer-node-protocol.md)                                       | Prefer using the `node:` protocol when importing Node.js builtin modules.                                                                                                                                         | ✅  | 🔧 |    |\n| [prefer-number-properties](docs/rules/prefer-number-properties.md)                               | Prefer `Number` static properties over global ones.                                                                                                                                                               | ✅  | 🔧 | 💡 |\n| [prefer-object-from-entries](docs/rules/prefer-object-from-entries.md)                           | Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.                                                                                                                       | ✅  | 🔧 |    |\n| [prefer-optional-catch-binding](docs/rules/prefer-optional-catch-binding.md)                     | Prefer omitting the `catch` binding parameter.                                                                                                                                                                    | ✅  | 🔧 |    |\n| [prefer-prototype-methods](docs/rules/prefer-prototype-methods.md)                               | Prefer borrowing methods from the prototype instead of the instance.                                                                                                                                              | ✅  | 🔧 |    |\n| [prefer-query-selector](docs/rules/prefer-query-selector.md)                                     | Prefer `.querySelector()` over `.getElementById()`, `.querySelectorAll()` over `.getElementsByClassName()` and `.getElementsByTagName()` and `.getElementsByName()`.                                              | ✅  | 🔧 |    |\n| [prefer-reflect-apply](docs/rules/prefer-reflect-apply.md)                                       | Prefer `Reflect.apply()` over `Function#apply()`.                                                                                                                                                                 | ✅  | 🔧 |    |\n| [prefer-regexp-test](docs/rules/prefer-regexp-test.md)                                           | Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`.                                                                                                                                                 | ✅  | 🔧 | 💡 |\n| [prefer-set-has](docs/rules/prefer-set-has.md)                                                   | Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.                                                                                                                          | ✅  | 🔧 | 💡 |\n| [prefer-set-size](docs/rules/prefer-set-size.md)                                                 | Prefer using `Set#size` instead of `Array#length`.                                                                                                                                                                | ✅  | 🔧 |    |\n| [prefer-spread](docs/rules/prefer-spread.md)                                                     | Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()` and `String#split('')`.                                                                                           | ✅  | 🔧 | 💡 |\n| [prefer-string-raw](docs/rules/prefer-string-raw.md)                                             | Prefer using the `String.raw` tag to avoid escaping `\\`.                                                                                                                                                          | ✅  | 🔧 |    |\n| [prefer-string-replace-all](docs/rules/prefer-string-replace-all.md)                             | Prefer `String#replaceAll()` over regex searches with the global flag.                                                                                                                                            | ✅  | 🔧 |    |\n| [prefer-string-slice](docs/rules/prefer-string-slice.md)                                         | Prefer `String#slice()` over `String#substr()` and `String#substring()`.                                                                                                                                          | ✅  | 🔧 |    |\n| [prefer-string-starts-ends-with](docs/rules/prefer-string-starts-ends-with.md)                   | Prefer `String#startsWith()` & `String#endsWith()` over `RegExp#test()`.                                                                                                                                          | ✅  | 🔧 | 💡 |\n| [prefer-string-trim-start-end](docs/rules/prefer-string-trim-start-end.md)                       | Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.                                                                                                                 | ✅  | 🔧 |    |\n| [prefer-structured-clone](docs/rules/prefer-structured-clone.md)                                 | Prefer using `structuredClone` to create a deep clone.                                                                                                                                                            | ✅  |    | 💡 |\n| [prefer-switch](docs/rules/prefer-switch.md)                                                     | Prefer `switch` over multiple `else-if`.                                                                                                                                                                          | ✅  | 🔧 |    |\n| [prefer-ternary](docs/rules/prefer-ternary.md)                                                   | Prefer ternary expressions over simple `if-else` statements.                                                                                                                                                      | ✅  | 🔧 |    |\n| [prefer-top-level-await](docs/rules/prefer-top-level-await.md)                                   | Prefer top-level await over top-level promises and async function calls.                                                                                                                                          | ✅  |    | 💡 |\n| [prefer-type-error](docs/rules/prefer-type-error.md)                                             | Enforce throwing `TypeError` in type checking conditions.                                                                                                                                                         | ✅  | 🔧 |    |\n| [prevent-abbreviations](docs/rules/prevent-abbreviations.md)                                     | Prevent abbreviations.                                                                                                                                                                                            | ✅  | 🔧 |    |\n| [relative-url-style](docs/rules/relative-url-style.md)                                           | Enforce consistent relative URL style.                                                                                                                                                                            | ✅  | 🔧 | 💡 |\n| [require-array-join-separator](docs/rules/require-array-join-separator.md)                       | Enforce using the separator argument with `Array#join()`.                                                                                                                                                         | ✅  | 🔧 |    |\n| [require-number-to-fixed-digits-argument](docs/rules/require-number-to-fixed-digits-argument.md) | Enforce using the digits argument with `Number#toFixed()`.                                                                                                                                                        | ✅  | 🔧 |    |\n| [require-post-message-target-origin](docs/rules/require-post-message-target-origin.md)           | Enforce using the `targetOrigin` argument with `window.postMessage()`.                                                                                                                                            |    |    | 💡 |\n| [string-content](docs/rules/string-content.md)                                                   | Enforce better string content.                                                                                                                                                                                    |    | 🔧 | 💡 |\n| [switch-case-braces](docs/rules/switch-case-braces.md)                                           | Enforce consistent brace style for `case` clauses.                                                                                                                                                                | ✅  | 🔧 |    |\n| [template-indent](docs/rules/template-indent.md)                                                 | Fix whitespace-insensitive template indentation.                                                                                                                                                                  | ✅  | 🔧 |    |\n| [text-encoding-identifier-case](docs/rules/text-encoding-identifier-case.md)                     | Enforce consistent case for text encoding identifiers.                                                                                                                                                            | ✅  | 🔧 | 💡 |\n| [throw-new-error](docs/rules/throw-new-error.md)                                                 | Require `new` when creating an error.                                                                                                                                                                             | ✅  | 🔧 |    |\n\n<!-- end auto-generated rules list -->\n\n### Deprecated Rules\n\nSee [docs/deprecated-rules.md](docs/deprecated-rules.md)\n\n## Preset configs (`eslint.config.js`)\n\nSee the [ESLint docs](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new) for more information about extending config files.\n\n**Note**: Preset configs will also enable the correct [language options](https://eslint.org/docs/latest/use/configure/configuration-files-new#configuring-language-options).\n\n### Recommended config\n\nThis plugin exports a [`recommended` config](configs/recommended.js) that enforces good practices.\n\n#### ES Module (Recommended)\n\n```js\nimport eslintPluginUnicorn from 'eslint-plugin-unicorn';\n\nexport default [\n\t\t// …\n\t\teslintPluginUnicorn.configs['flat/recommended'],\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/better-regex': 'warn',\n\t\t\t},\n\t\t},\n];\n```\n\n#### CommonJS\n\n```js\n'use strict';\nconst eslintPluginUnicorn = require('eslint-plugin-unicorn');\n\nmodule.exports = [\n\t\t// …\n\t\teslintPluginUnicorn.configs['flat/recommended'],\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/better-regex': 'warn',\n\t\t\t},\n\t\t},\n];\n```\n\n### All config\n\nThis plugin exports an [`all` config](configs/all.js) that makes use of all rules (except for deprecated ones).\n\n#### ES Module (Recommended)\n\n```js\nimport eslintPluginUnicorn from 'eslint-plugin-unicorn';\n\nexport default [\n\t\t// …\n\t\teslintPluginUnicorn.configs['flat/all'],\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/better-regex': 'warn',\n\t\t\t},\n\t\t},\n];\n```\n\n#### CommonJS\n\n```js\n'use strict';\nconst eslintPluginUnicorn = require('eslint-plugin-unicorn');\n\nmodule.exports = [\n\t\t// …\n\t\teslintPluginUnicorn.configs['flat/all'],\n\t\t{\n\t\t\trules: {\n\t\t\t\t'unicorn/better-regex': 'warn',\n\t\t\t},\n\t\t},\n];\n```\n\n## Preset configs (`.eslintrc.*` or `package.json`)\n\nSee the [ESLint docs](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files) for more information about extending config files.\n\n**Note**: Preset configs will also enable the correct [parser options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) and [environment](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments).\n\n### Recommended config\n\nThis plugin exports a [`recommended` config](configs/recommended.js) that enforces good practices.\n\n```json\n{\n\t\"name\": \"my-awesome-project\",\n\t\"eslintConfig\": {\n\t\t\"extends\": \"plugin:unicorn/recommended\",\n\t\t\"rules\": {\n\t\t\t\"unicorn/better-regex\": \"warn\"\n\t\t}\n\t}\n}\n```\n\n### All config\n\nThis plugin exports an [`all` config](configs/all.js) that makes use of all rules (except for deprecated ones).\n\n```json\n{\n\t\"name\": \"my-awesome-project\",\n\t\"eslintConfig\": {\n\t\t\"extends\": \"plugin:unicorn/all\"\n\t}\n}\n```\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Fisker Cheung](https://github.com/fisker)\n- [Bryan Mishkin](https://github.com/bmish)\n- [futpib](https://github.com/futpib)\n\n### Former\n\n- [Jeroen Engels](https://github.com/jfmengels)\n- [Sam Verschueren](https://github.com/SamVerschueren)\n- [Adam Babcock](https://github.com/MrHen)\n","readmeFilename":"readme.md"}