Repolode
sindresorhus

sindresorhus/eslint-plugin-unicorn

A plugin that adds more than 300 extra ESLint rules for JavaScript and TypeScript, plus some rules for CSS, HTML, JSON, Markdown, and YAML.

Stars
5,278
Forks
500
Open issues
7
Last commit
10 hours ago

What is it?

eslint-plugin-unicorn is a plugin for ESLint that adds a large set of extra lint rules. Most rules target JavaScript and TypeScript code, covering modern built-in APIs, error handling, DOM usage, and general code style. It can be installed alongside ESLint and enabled through a flat config file.

The plugin offers preset configurations such as recommended and unopinionated, so teams can start with a ready-made rule set or pick individual rules. Many rules support automatic fixing with the ESLint --fix option, and some provide editor suggestions for manual fixes. Certain rules require type information from TypeScript.

When used with the matching ESLint language plugins, some rules also lint CSS, HTML, JSON, Markdown, SOML, TOML, and YAML files. The project requires ESLint 10.4 or later, flat config, and ESM.

Key features

  • 01Over 300 rules covering JavaScript and TypeScript code patterns.
  • 02Preset configurations including recommended and unopinionated.
  • 03Many rules are automatically fixable with --fix.
  • 04Some rules provide manual fix suggestions in editors.
  • 05Optional non-JavaScript linting for CSS, HTML, JSON, Markdown, and YAML via matching ESLint plugins.

Use cases

  • Enforcing modern JavaScript idioms such as preferring toSorted() over sort().
  • Catching common mistakes in error handling and built-in API usage.
  • Standardizing code style across a team's JavaScript or TypeScript project.
  • Adding stricter linting to projects that already use ESLint flat config.

Topics

FAQ

What is eslint-plugin-unicorn?
A plugin that adds more than 300 extra ESLint rules for JavaScript and TypeScript, plus some rules for CSS, HTML, JSON, Markdown, and YAML. eslint-plugin-unicorn is a plugin for ESLint that adds a large set of extra lint rules. Most rules target JavaScript and TypeScript code, covering modern built-in APIs, error handling, DOM usage, and general code style. It can be installed alongside ESLint and enabled through a flat config file.
Is eslint-plugin-unicorn free to use? What license does it have?
eslint-plugin-unicorn is open source under the MIT license. Check the license terms before using it in commercial products.
Is eslint-plugin-unicorn still maintained?
Actively maintained. The last commit to eslint-plugin-unicorn was on Oct 21, 2026.
What can I use eslint-plugin-unicorn for?
Enforcing modern JavaScript idioms such as preferring toSorted() over sort(). Catching common mistakes in error handling and built-in API usage. Standardizing code style across a team's JavaScript or TypeScript project. Adding stricter linting to projects that already use ESLint flat config.
Where can I get eslint-plugin-unicorn?
The source code and installation instructions are on GitHub: https://github.com/sindresorhus/eslint-plugin-unicorn

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects