eslint-plugin-unicorn provides hundreds of opinionated ESLint rules for JavaScript and TypeScript, with optional sets for CSS, HTML, JSON, Markdown, and YAML via flat config.
Overview
eslint-plugin-unicorn bundles more than three hundred lint rules emphasizing consistent naming, safer builtins usage, modern array methods, DOM best practices, and comment hygiene. Most rules target JS and TS, while recommended-* presets extend to CSS, HTML, JSON, Markdown, SOML, TOML, and YAML when paired with matching ESLint language plugins.
It requires ESLint 10.4 or newer, flat configuration, and ESM. Presets range from recommended opinionated sets to narrower unopinionated bundles; many rules are autofixable or suggest editor fixes, and some need type information.
The maintainer notes pull requests are closed to reduce low-quality contributions; users can propose rules via the issue template. XO consumes the same rule collection for its default lint profile.
Projects add unicorn to flat configs when they want stricter, consistency-focused enforcement beyond core ESLint or framework-specific plugins.
Key features
- 300 plus lint rules
- Flat config presets
- CSS and HTML rule subsets
- Autofixable stylistic checks
- Type-aware rule options
- DOM and fetch safety rules
- Filename and naming policies
Use cases
- Harden Node and browser code style
- Lint JSON and YAML config files
- Enforce modern array immutability helpers
- Align with Sindre Sorhus conventions