Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

eslint-plugin-unicorn 51.0.1

More than 100 powerful ESLint rules
Package summary
Share
0
issues
0
licenses
Package created
20 Sep 2016
Version published
6 Feb 2024
Maintainers
2
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does eslint-plugin-unicorn do?

The eslint-plugin-unicorn is a powerful tool for JavaScript developers which houses more than 100 powerful, versatile and easy-to-use ESLint rules. Optimized for code quality and internal consistency, these rules extend the core ESLint set with a range of extras that enforce JavaScript best practices and aid in code optimization. Simply put, the eslint-plugin-unicorn is an essential tool for JavaScript developers who aim to write cleaner code, maintain high performance and ensure a steadfast fidelity to best practices.

How do you use eslint-plugin-unicorn?

Using eslint-plugin-unicorn is straightforward and simple. First, you need to install the package using npm:

npm install --save-dev eslint eslint-plugin-unicorn

Then, you can either use a preset configuration or configure each rule manually within your project's package.json file. If you're managing the rules without a preset, make sure to include the same env and parserOptions configuration as shown in the example below:

{
  "name": "my-awesome-project",
  "eslintConfig": {
    "env": {
      "es2024": true
    },
    "parserOptions": {
      "ecmaVersion": "latest",
      "sourceType": "module"
    },
    "plugins": [
      "unicorn"
    ],
    "rules": {
      "unicorn/better-regex": "error",
      "unicorn/…": "error"
    }
  }
}

In this configuration example, the project uses the rules "unicorn/better-regex" and "unicorn/…" with an error level of enforcement (meaning violations will cause the linter to throw an error).

Where are the eslint-plugin-unicorn docs?

The documentation for eslint-plugin-unicorn can be found directly in the project's GitHub repository at https://github.com/sindresorhus/eslint-plugin-unicorn. This documentation provides an exhaustive list of the rules provided by eslint-plugin-unicorn, along with details about what each rule does, how to configure it, and some examples of what constitutes a violation. Each rule has its own document with specific examples, justifications and suggestions related to its use.