eslint-plugin-unicorn icon indicating copy to clipboard operation
eslint-plugin-unicorn copied to clipboard

More than 100 powerful ESLint rules

Results 255 eslint-plugin-unicorn issues
Sort by recently updated
recently updated
newest added

Occasionally it's easier to deal with IDs: ```jsx const field = labelElement.htmlFor; ``` ```jsx return ; ``` ```jsx const element = document.getElementById(field) ``` It's kind of an exception, but this...

enhancement
help wanted

### Description Prevent returning or assigning mutating array methods, to improve readability and also protect against accidentally mutating an array in-place when you shouldn't. `Array#sort()`, `Array#fill()`, `Array#reverse()`. ### Fail ```js...

help wanted
new rule

### Description if the new string starts with the previous string, prefer operator assignment as less code is written ### Fail ```js foo = foo + 'baz qux' ``` ```js...

help wanted
new rule

Currently, [`new-for-builtins`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/new-for-builtins.md) enforce builtins used either `call` or `new`. My idea is to extend this rule to check all builtins. - Objects like `JSON`/`Math`/`Reflect`/`Temporal` should be neither `call` nor `new`...

enhancement
help wanted

### Description Sometimes, we incorrectly try to add a class that begins with a dot, but linters and indeed browsers do not indicate that this is an error. The error...

help wanted
new rule

I want to allow this abbr `elementRef: ElementRef` as it a well known term in Angular ``` replacements:[ // those don't work elementRef: false, ElementRef: false, Ref: false, // only...

bug
help wanted

For `eslint-plugin-jsdoc`, we have added a convenient testing feature that allows us to run tests like `npm run test-index --rule=xyz --invalid=3-5` or `npm run test-index --rule=xyz --valid=-1` (with slice-like ranges/indexes/negative...

help wanted

## Fail ```js // Should use `Object.values` for (const key of Object.keys(foo)) { bar(foo[key]); } ``` ```js // Should use `Object.entries` for (const key of Object.keys(foo)) { bar(foo[key], key); }...

help wanted
new rule

We are going to add `prefer-object-from-entries` rule in #1308. As proposed in [the original proposal](https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1260), the following case should be reported too ```js const foo = {}; for (const [key,...

#1812 makes me realize that the following edge cases will cause runtime error by autofix. ```js // The second parameter default value can be a reference from first parameter array.forEach((element,...

bug
help wanted