Various awesome ESLint rules (by sindresorhus)

Eslint-plugin-unicorn Alternatives

Similar projects and alternatives to eslint-plugin-unicorn
NOTE: The number of mentions on this list indicates mentions on common posts. Hence, a higher number means a better alternative or higher similarity.


Posts where eslint-plugin-unicorn has been mentioned. We have used some of these posts to build our list of alternatives and similar projects.
  • Why I don't like reduce | 2021-01-12
    The popular eslint-plugin-unicorn recently added a no-reduce rule, and it is set to error per default. The argument is that Array.reduce will likely result in code that is hard to reason about, and can be replaced with other methods in most cases (Read this twitter thread for a lengthy discussion if you like).
  • To improve readability for numbers, you can use underscore as a separator!
    We actually enforce this code style for any numbers greater than 5 digits at my workplace, using eslint-plugin-unicorn and its numeric-separators-style rule.
  • 60+ useful ESLint rules | 2021-01-02
    explicit-length-check - Enforce explicitly comparing the length property of a value.
    I think the example in the rule is pretty clear. If you have any specific feedback, we're happy to listen.
    It's definitely not for everyone, especially if you can't control how your variables are written, but that's part of the beauty of ESLint. This rule has the potential to add value to someone's codebase, so you can adopt it, disable it, or customize it with its many options.
    no-for-loop - Do not use a for loop that can be replaced with a for-of.
    prefer-add-event-listener - Prefer .addEventListener() and .removeEventListener() over on-functions.
    prefer-query-selector - Prefer .querySelector() over .getElementById(), .querySelectorAll() over .getElementsByClassName() and .getElementsByTagName().
    prevent-abbreviations - Prevent abbreviations.
    string-content seems like a neat one if you want to enforce anything in your strings - it's very extensible. The rule provides some great pattern ideas.
    throw-new-error / prefer-type-error - Require new when throwing an error. Enforce throwing TypeError in type-checking conditions.
    We intend to add an option to ignore functions in the same scope:
  • ESLint Rules | 2020-12-28


Basic eslint-plugin-unicorn repo stats
9 days ago

sindresorhus/eslint-plugin-unicorn is an open source project licensed under MIT License which is an OSI approved license.