eslint-plugin-unicorn
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@babel/helper-validator-identifier | 7.24.5 | 48 kB | MIT | prod | |
@eslint-community/eslint-utils | 4.4.0 | 62.2 kB | MIT | prod | |
ci-info | 3.9.0 | 7.21 kB | MIT | prod | |
clean-regexp | 1.0.0 | 2.43 kB | MIT | prod | |
eslint | 9.1.1 | 2.89 MB | MIT | prod peer | |
esquery | 1.5.0 | 155.76 kB | BSD-3-Clause | prod | |
indent-string | 4.0.0 | 2.02 kB | MIT | prod | |
is-builtin-module | 3.2.1 | 1.92 kB | MIT | prod | |
jsesc | 3.0.2 | 9.72 kB | MIT | prod | |
lodash | 4.17.21 | 311.49 kB | MIT | prod | |
pluralize | 8.0.0 | 5.89 kB | MIT | prod | |
read-pkg-up | 7.0.1 | 2.67 kB | MIT | prod | 1 2 |
regexp-tree | 0.1.27 | 66.81 kB | MIT | prod | |
regjsparser | 0.10.0 | 18.42 kB | BSD-2-Clause | prod | |
semver | 7.6.0 | 26.57 kB | ISC | prod | |
strip-indent | 3.0.0 | 1.68 kB | MIT | prod |
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.
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).
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.