An ESLint plugin with over 100 powerful rules to enforce modern JavaScript best practices and catch errors.
eslint-plugin-unicorn is an ESLint plugin that provides over 100 powerful rules to enforce modern JavaScript best practices and catch potential errors. It helps developers write cleaner, safer, and more consistent code by promoting the use of contemporary language features and avoiding anti-patterns. The plugin covers a wide range of areas including ES6+ syntax, Node.js APIs, DOM manipulation, and performance optimizations.
JavaScript developers and teams using ESLint who want to enforce high code quality standards, adopt modern JavaScript features, and prevent common bugs. It's particularly useful for projects targeting recent Node.js versions or browsers with good ES2020+ support.
Developers choose eslint-plugin-unicorn for its extensive collection of well-crafted rules that go beyond standard ESLint configurations. Its unique value lies in catching subtle errors, promoting modern JavaScript patterns, and providing many auto-fixable rules that save time during code reviews and refactoring.
More than 100 powerful ESLint rules
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Promotes use of contemporary APIs such as .at() and structuredClone through rules like 'prefer-at' and 'prefer-structured-clone', keeping code up-to-date with ES2020+ features.
Catches subtle bugs like invalid fetch options and unsafe regexes with rules such as 'no-invalid-fetch-options' and 'better-regex', reducing runtime errors.
Many rules support automatic fixing via ESLint's --fix flag, as indicated by the 🔧 icon in the rule list, streamlining code cleanup and refactoring.
Encourages efficient patterns, for example preferring Set#has() over Array#includes() with the 'prefer-set-has' rule, improving code performance.
Requires ESLint >=9.20.0, flat config, and ESM, which can be a significant hurdle for projects on older toolchains or CommonJS, as stated in the installation notes.
Rules like 'no-null' and 'no-array-reduce' enforce specific coding styles that may conflict with team preferences or existing codebase conventions, limiting flexibility.
The plugin has a history of deleted and deprecated rules, as documented in a separate file, meaning updates might necessitate code adjustments to maintain compliance.