Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sindresorhus/eslint-plugin-unicorn/llms.txt

Use this file to discover all available pages before exploring further.

Some unicorn rules have been superseded by broader replacements, and others have been removed entirely. This page lists both categories so you can update your config accordingly.
  • Deprecated rules still exist in the plugin but emit a deprecation warning when used. You should migrate to the replacement rule.
  • Deleted rules have been removed from the plugin. Referencing them in your config will cause ESLint to error.

Deprecated rules

The following rules are deprecated. Each one has a direct replacement that covers all the same cases and more.
Old ruleReplacementNotes
unicorn/no-instanceof-arrayunicorn/no-instanceof-builtinsCovers more built-in types beyond Array
unicorn/no-length-as-slice-endunicorn/no-unnecessary-slice-endCovers more unnecessary slice-end patterns
unicorn/no-array-push-pushunicorn/prefer-single-callCovers more methods beyond Array.prototype.push
When you see a deprecation warning for one of these rules, replace the old rule name with the replacement in your eslint.config.js. The replacement rule is a drop-in that covers everything the old rule did, so you can switch without disabling any behavior.
eslint.config.js
export default [
  {
    rules: {
      // Before
      'unicorn/no-instanceof-array': 'error',

      // After
      'unicorn/no-instanceof-builtins': 'error',
    },
  },
];
Use eslint-plugin-unicorn.configs.recommended instead of configuring individual rules. The preset always references current rule names, so you automatically pick up replacements without needing to track deprecations yourself.
eslint.config.js
import eslintPluginUnicorn from 'eslint-plugin-unicorn';

export default [
  eslintPluginUnicorn.configs.recommended,
];

Deleted rules

The following rules no longer exist in the plugin. Remove any references to them from your config.
Deleted ruleReason
unicorn/import-indexOutdated — ES modules do not support importing a directory
unicorn/no-array-instanceofReplaced by unicorn/no-instanceof-builtins
unicorn/no-fn-reference-in-iteratorRenamed to unicorn/no-array-callback-reference
unicorn/no-reduceRenamed to unicorn/no-array-reduce
unicorn/no-unsafe-regexRemoved due to bugs
unicorn/prefer-datasetRenamed to unicorn/prefer-dom-node-dataset
unicorn/prefer-event-keyRenamed to unicorn/prefer-keyboard-event-key
unicorn/prefer-exponentiation-operatorSuperseded by the built-in ESLint prefer-exponentiation-operator rule
unicorn/prefer-flat-mapRenamed to unicorn/prefer-array-flat-map
unicorn/prefer-node-appendRenamed to unicorn/prefer-dom-node-append
unicorn/prefer-node-removeRenamed to unicorn/prefer-dom-node-remove
unicorn/prefer-object-has-ownSuperseded by the built-in ESLint prefer-object-has-own rule
unicorn/prefer-replace-allRenamed to unicorn/prefer-string-replace-all
unicorn/prefer-starts-ends-withRenamed to unicorn/prefer-string-starts-ends-with
unicorn/prefer-text-contentRenamed to unicorn/prefer-dom-node-text-content
unicorn/prefer-trim-start-endRenamed to unicorn/prefer-string-trim-start-end
unicorn/regex-shorthandRenamed to unicorn/better-regex

Build docs developers (and LLMs) love