Registry / testing / eslint-unicorn

eslint-unicorn

JSON →
library55.0.0jsnpmunverified

ESLint plugin providing more than 100 powerful rules for enforcing consistent, error-free code style and catching common mistakes. Current stable version is 55.0.0, with frequent releases (often multiple per month). Key differentiators include a broad focus beyond stylistic concerns (e.g., security, performance, best practices), automatic fixing for many rules, and strong integration with XO. It requires ESLint >=8.56.0 and Node >=18.18, and ships TypeScript definitions.

npm install eslint-unicorn
INSTALL
IMPORT
SIG · ESLINT-UNICORN
E
eslint-unicorn
testingjavascriptv55.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

eslintPluginUnicorn
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
const eslintPluginUnicorn = require('eslint-plugin-unicorn').default;
Default export is the plugin object. In CommonJS, use `require('eslint-plugin-unicorn')` directly without .default.
configs.recommended
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; eslintPluginUnicorn.configs.recommended
const { configs } = require('eslint-plugin-unicorn');
Access recommended config via the default export. In CJS, use `require('eslint-plugin-unicorn').configs.recommended`.
rules
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; eslintPluginUnicorn.rules['unicorn/better-regex']
const rules = require('eslint-plugin-unicorn/rules');
Rules are accessed via the plugin object's 'rules' property. There is no separate 'rules' export.

Shows how to set up eslint-plugin-unicorn with flat config (ESLint >=8.56.0) using the recommended preset and additional rules.

import eslintPluginUnicorn from 'eslint-plugin-unicorn'; import globals from 'globals'; export default [ eslintPluginUnicorn.configs.recommended, { languageOptions: { globals: globals.builtin, }, plugins: { unicorn: eslintPluginUnicorn, }, rules: { 'unicorn/better-regex': 'error', 'unicorn/catch-error-name': 'error', }, }, ];
Debug
Known issues
breakingMinimum Node.js version is 18.18 starting from v60.0.0
fix
Update Node.js to >=18.18 or pin eslint-plugin-unicorn to <60.0.0.
affects: >=60.0.0
deprecatedRule 'no-array-push-push' renamed to 'prefer-single-call' in v59.0.0
fix
Replace 'unicorn/no-array-push-push' with 'unicorn/prefer-single-call'.
affects: >=59.0.0
deprecatedRule 'no-length-as-slice-end' renamed to 'no-unnecessary-slice-end' in v59.0.0
fix
Replace 'unicorn/no-length-as-slice-end' with 'unicorn/no-unnecessary-slice-end'.
affects: >=59.0.0
breakingESLint <8.56.0 is no longer supported (flat config required starting v55?)
fix
Upgrade ESLint to >=8.56.0 and migrate to flat config (eslint.config.js).
affects: >=55.0.0
gotchaFlat config (eslint.config.js) requires explicit import of plugin; global plugins no longer work
fix
Import the plugin in eslint.config.js as shown in the quickstart.
affects: >=55.0.0
Errors
Common errors & fixes
Oops! Something went wrong! :( ESLint: 8.x.x. eslint-plugin-unicorn: 55.x.x. No configuration matching.
Using older ESLint version or missing flat config migration
fix
Update ESLint to >=8.56.0 and use eslint.config.js.
Error: Cannot find module 'eslint-plugin-unicorn'
Package not installed or missing in node_modules
fix
Run 'npm install --save-dev eslint eslint-plugin-unicorn'.
TypeError: eslintPluginUnicorn is not a function
Incorrectly importing default export in CommonJS
fix
Use 'const eslintPluginUnicorn = require('eslint-plugin-unicorn');' (no .default).
Upgrade
Version history
55.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin to run
globalsoptionalcommonly used alongside to provide builtin globals in flat config
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-unicorn — npm install eslint-unicorn · libregistry