More than 100 powerful ESLint rules
MIT License
Bot releases are visible (Hide)
no-static-only-class
(#1120) f3b2441prefer-array-flat
(#1126) 2397d94no-array-for-each
: Use let
if parameters are reassigned (#1139) a13ad3cno-array-push-push
and prefer-ternary
: Improve same reference detection (#1123) c2c28a6prefer-spread
: Add Array#slice()
check (#1117) 8bdb52dhttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v28.0.2...v29.0.0
prevent-abbreviations
: Do not rename exported types when using @babel/eslint-parser (#1104) 9a91a3dprevent-abbreviations
: Do not rename exported TypeScript types (#1103) 5c08932https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v28.0.1...v28.0.2
eslint-visitor-keys
dependency (#1100) 5c1ff2ehttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v28.0.0...v28.0.1
no-lonely-if
: Keep all comments (#1047) da94ca9prefer-includes
: Add Array#some()
check (#1097) ee3a2e5prefer-includes
: Improve report location (#1061) 83575a8prefer-spread
: Improve auto-fix (#1080) e54dc66prefer-spread
: Add more suggestions for .concat
fix (#1054) 673c440no-unreadable-array-destructuring
: Fix crash on destructuring in for…of
loop (#1076) 11ce1bcno-array-for-each
: Ignore React.Children.forEach
(#1088) 5a931ddprefer-string-slice
: Keep optional chaining in autofix (#1085) acaf197prefer-spread
: Ignore Buffer.concat()
(#1069) da685f7catch-error-name
and prefer-set-has
(#1077) 79a64b1prefer-default-parameters
: Fix non-iterable visitorKeys
(#1013) d707e83consistent-destructuring
: Add ExperimentalRestProperty
check (#1060) aca2ec5https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v27.0.0...v28.0.0
no-array-for-each
(#1017) 719cd00no-array-push-push
(#1015) 21537d7no-this-assignment
(#1018) 62a2f92prefer-ternary
: Add only-single-line
option (#1025) 306c9e7numeric-separators-style
: Add onlyIfContainsSeparator
option (#916) 8d32574prefer-spread
: Prefer ...
over Array#concat()
(#1029) cda72bdprefer-spread
: Fix more .concat
cases (#1042) c3c7ba3no-array-callback-reference
: Improve suggestions for Array#forEach()
(#1049) 77bcdc6no-new-buffer
: Use suggestion for unknown arguments (#1037) 88a724cno-unreadable-array-destructuring
: Add auto-fix (#1010) 27bc3c3new-for-builtins
: Better auto-fix (#1022) 5ba0f83no-instanceof-array
: Better auto-fix (#1020) 0520f31prefer-query-selector
: Fix crash on unexpected selector (#1034) 88018cahttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v26.0.1...v27.0.0
prefer-math-trunc
: Use suggestion instead of auto-fix for x | 0
(#1014) 74b1b2dhttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v26.0.0...v26.0.1
no-new-array
(#992) 48390c1prefer-array-index-of
(#920) 517a782prefer-regexp-test
(#970) 7b74b40consistent-destructuring
(#325) 32bd31cimport-index
rule from recommended preset (#977) ff1cd2eprefer-string-starts-ends-with
: Remove check on String#match()
(#1002) c9fa8b1no-array-callback-reference
: Ignore AwaitExpression
except reduce
and reduceRight
(#814) 4c2b00bprefer-string-starts-ends-with
: Fix missing parentheses for some cases (#976) e2f94fe??
operator LogicExpression as a boolean
value node (#986) dc7f79bhttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v25.0.0...v26.0.0
prefer-array-some
(#887) b6a5a50prefer-default-parameters
(#632) 8015768We improved the naming and name consistency of some rules. Sorry about the churn.
If you use the recommended preset and you're not overriding any rules, you don't need to do anything.
no-fn-reference-in-iterator
→ no-array-callback-reference
no-array-instanceof
→ no-instanceof-array
no-reduce
→ no-array-reduce
prefer-dataset
→ prefer-dom-node-dataset
prefer-flat-map
→ prefer-array-flat-map
prefer-replace-all
→ prefer-string-replace-all
prefer-starts-ends-with
→ prefer-string-starts-ends-with
prefer-text-content
→ prefer-dom-node-text-content
prefer-trim-start-end
→ prefer-string-trim-start-end
prefer-event-key
→ prefer-keyboard-event-key
prefer-node-append
→ prefer-dom-node-append
prefer-node-remove
→ prefer-dom-node-remove
20c6341
explicit-length-check
: Make rule work in many more cases (#943) f3bc798explicit-length-check
: Check unsafe LogicalExpression
s (#952) a1b60adexplicit-length-check
: Check Boolean(foo.length)
(#951) f4577f7explicit-length-check
: Check more cases (#941) 83a6453new-for-builtins
: Ignore Object(x) === x
and Object(x) !== x
(#944) 5c7ea92explicit-length-check
: Rewrite rule (#938) 94ae87ahttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v24.0.0...v25.0.0
no-lonely-if
(#936) 485dbf9empty-brace-spaces
(#933) c137daaprefer-date-now
(#935) d0c4826prevent-abbreviations
: Add ignore
option (#891) 898fcb4no-useless-undefined
: Add checkArguments
option (#877) a1617b9consistent-function-scoping
: Allow ignoring arrow functions (#932) 17bf27cerror-message
rule (#922) 877bef9prefer-query-selector
rule (#908) 635601dprevent-abbreviations
: Add var
/vars
replacements (#894) 07dadf5prevent-abbreviations
: Add ver
→ version
replacement (#870) e755cddprefer-number-properties
: Support computed
key of ClassProperty
MethodDefinition
Property
(#886) 769ac35prefer-optional-catch-binding
: Improve output (#884) 375d11ano-null
: Exclude useRef(null)
and React.useRef(null)
(#890) 7a4dbf4prefer-number-properties
: Add Infinity
support (#874) 643169bno-console-spaces
: Improve report location (#866) 190cbacno-useless-undefined
: Ignore toHaveBeenCalledWith
method (#876) d10a641prefer-replace-all
: Handle u
flag (#879) d98d867no-for-loop
: Improve output when using the TypeScript parser (#883) 52edd3bno-for-loop
: Respect declaration kind (#878) df3f7bdno-for-loop
: Only report on the for loop head part (#885) e9c6963false
import styles seen in reported problem messages (#910) d669707import-style
: Fix crash on babel-eslint
parser (#927) 9f5f721prevent-abbreviations
: Fix crash with TypeScript parser (#913) 9d5eca6prefer-query-selector
: Fix crash on calling without argument (#906) 36908daimport-style
: Fix crash on destructing require (#904) 8335d41new-for-builtins
: Remove auto-fix for new String
, new Boolean()
, and new Number()
(#907) dfc1ce0https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v23.0.0...v24.0.0
prefer-math-trunc
rule (#851) 5ee2432numeric-separators-style
rule (#833) 6c9b531prefer-ternary
rule (#514) d59cf95explicit-length-check
: Use 'non-zero': 'greater-than'
by default (#850) 7c5df5fprevent-abbreviations
: Add fn
/func
-> function
, i
/idx
/j
-> index
replacements (#836) e502f42consistent-function-scoping
: Check anonymous functions (#835) 29ecbf6no-console-spaces
: Make space position more specific (#838) e17a63fno-nested-ternary
: Improve report location & message (#844) ca1afa6prefer-flat-map
: Exclude .flat()
where depth is not 1
(#859) 61d9851https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v22.0.0...v23.0.0
import-style
rule (#789) 0c7a199Children
in no-fn-reference-in-iterator
(#809) 036e440filename-case
: Ignore more index files (#826) 64d03a5ecmaVersion
to 2021
(#820) a78cea3prefer-trim-start-end
: Fix error message, improve report location (#823) b35c261number-literal-case
: Fix false positive on @typescript-eslint/parser
(#815) 33a1268no-unused-properties
: Fix error thrown when using rest in object destructuring (#811) 1475f39https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v21.0.0...v22.0.0
prefer-array-find
rule (#735) 12b46dano-object-as-default-parameter
rule (#633) 9989d2dev
to event
default replacement to prevent-abbreviations
rule (#793) a0b4abano-fn-reference-in-iterator
and no-reduce
rule (#756) 5159c24unicorn/prefer-flat-map
not enabled by default in the recommended config 655220aconsistent-function-scoping
report location (#778) df218a2consistent-function-scoping
message (#773) 4ed2adfconsistent-function-scoping
: Fix wrong detect of IIFE (#772) f7127daprefer-starts-ends-with
: Fix pipe in regex (#783) 1dca2f3prevent-abbreviations
: Fix optional parameter (#764) 7781c3fno-useless-undefined
: Ignore undefined
use in compare functions (#758) 6d36407https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v20.1.0...v21.0.0
no-for-loop
rule (#745) 2002093no-for-loop
rule (#749) 48bd5c8https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v20.0.0...v20.1.0
prefer-optional-catch-binding
rule (#671) efdb03ano-useless-undefined
rule (#718) 30dbe6dno-reduce
rule (#704) 06ed7eethrow-new-error
: Check MemberExpression
customError (#716) a28aad5prefer-starts-ends-with
: Add auto-fix (#711) da978e3consistent-function-scoping
: Ignore IIFE (#707) 1f4413dprefer-set-has
: Ignore arrays only checking existence once (#706) 54c6f54prefer-starts-ends-with
: Fix bug with m
flag (#721) 83bbabcprefer-string-slice
: Handle negative length in .substr()
(#709) 7439465https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v19.0.1...v20.0.0
no-fn-reference-in-iterator
: Ignore this.
and Vue.filter
(#699) b02a9c6no-fn-reference-in-iterator
: Ignore cases obviously not a function reference (#697) dae5107https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v19.0.0...v19.0.1
no-null
rule (#636) c773c16string-content
: Make it have no default patterns (#637) 08fad55catch-error-name
: Replace caughtErrorsIgnorePattern
option with an ignore
option (#661) 5a27f04custom-error-definition
: Support class properties (#673) 9cc8d60catch-error-name
: Support Promise#then
(#660) edcf73cprefer-set-has
: Supports more types of array (#641) 29f3c9cescape-case
: Fix missing characters (#678) d986427no-nested-ternary
: Fix incorrect result with TypeScript parser (#664) cb08ed0custom-error-definition
: Fix duplicated reports on this.message
assign (#669) aa00647custom-error-definition
: Fix crash on @typescript-eslint/parser
(#659) e8cb921catch-error-name
: Improve error message (#665) 8ac9a90catch-error-name
: Fix error renaming (#654) cc2d1b1catch-error-name
: Only allow _
when it's not used (#650) 0c31a0bcatch-error-name
: Ignore destructuring (#649) b2838fdhttps://github.com/sindresorhus/eslint-plugin-unicorn/compare/v18.0.1...v19.0.0
prefer-number-properties
: Fix suggestion description (#635) d410ca3https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v18.0.0...v18.0.1
prefer-number-properties
rule (#622) 8d8ce43prefer-set-has
rule (#604) 9fa8de1ignore
option to expiring-todo-comment
rule (#555) 08fabf6no-console-spaces
: Fix crash on string contains \n
(#629) 9cd01cdexplicit-length-check
: Ignore computed length
of MemberExpression
(#620) 418e072prefer-spread
: Insert semicolon in more cases (#615) de48b3dcatch-error-name
: Keep typeAnnotation
when replacing identifier
(#613) 446ff37prevent-abbreviations
: Fix crash on TypeParameter
with default value (#606) 2ef7a21prevent-abbreviations
: Add global variables check (#603) b5c0a12regexp-tree
to fix whitespace rewrite (#605) 2b78a17https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v17.2.0...v18.0.0
consistent-function-scoping
: Check use of this
and arguments
(#590) 8b417e6prevent-abbreviations
: Fix inappropriate suggestion (#592) 2e20294consistent-function-scoping
: Ignore within React hooks (#588) 7126d6dstring-content
: Ignore some TaggedTemplateExpression
(#585) 92f3f3dconsistent-function-scoping
: Display function name in error message (#589) e7e49ecconsistent-function-scoping
: Fix uninitialized variable check (#587) 4c48c02https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v17.1.0...v17.2.0