Unicorn
223 rules eslint-plugin-unicorn@76.0.0
Complete effective rule inventory.
Rules
No enabled Unicorn rules match this search.
-
unicorn/prefer-iterator-to-array-at-endPrefer moving
.toArray()to the end of iterator helper chains.: error in All Unicorn contexts -
unicorn/prefer-keyboard-event-keyPrefer
KeyboardEvent#keyover deprecated keyboard event properties.: error in All Unicorn contexts -
unicorn/prefer-logical-operator-over-ternaryPrefer using a logical operator over a ternary.
: error in All Unicorn contexts -
unicorn/prefer-map-from-entriesPrefer
new Map()overObject.fromEntries()when using the result as a map.: error in All Unicorn contexts -
unicorn/prefer-math-absPrefer
Math.abs()over manual absolute value expressions and symmetric range checks.: error in All Unicorn contexts -
unicorn/prefer-math-constantsPrefer
Mathconstants over their approximate numeric values.: error in All Unicorn contexts -
unicorn/prefer-math-min-maxPrefer
Math.min()andMath.max()over ternaries for simple comparisons.: error in All Unicorn contexts -
unicorn/prefer-math-truncPrefer
Math.trunc()for truncating numbers.: error in All Unicorn contexts -
unicorn/prefer-modern-math-apisPrefer modern
MathAPIs over legacy patterns.: error in All Unicorn contexts -
unicorn/prefer-modulePrefer JavaScript modules (ESM) over CommonJS.
: error in All Unicorn contexts -
unicorn/prefer-native-coercion-functionsPrefer using
String,Number,BigInt,Boolean, andSymboldirectly.: error in All Unicorn contexts -
unicorn/prefer-negative-indexPrefer negative index over
.length - indexwhen possible.: error in All Unicorn contexts -
unicorn/prefer-node-protocolPrefer using the
node:protocol when importing Node.js builtin modules.: error in All Unicorn contexts -
unicorn/prefer-number-is-safe-integerPrefer
Number.isSafeInteger()over integer checks.: error in All Unicorn contexts -
unicorn/prefer-number-propertiesPrefer
Numberstatic methods over global functions and optionally static properties over global constants.: error in All Unicorn contexts -
unicorn/prefer-object-define-propertiesPrefer
Object.defineProperties()over multipleObject.defineProperty()calls.: error in All Unicorn contexts -
unicorn/prefer-object-destructuring-defaultsPrefer object destructuring defaults over default object literals with spread.
: error in All Unicorn contexts -
unicorn/prefer-object-from-entriesPrefer using
Object.fromEntries(…)to transform a list of key-value pairs into an object.: error in All Unicorn contexts -
unicorn/prefer-object-iterable-methodsPrefer the most specific
Objectiterable method.: error in All Unicorn contexts -
unicorn/prefer-optional-catch-bindingPrefer omitting the
catchbinding parameter.: error in All Unicorn contexts -
unicorn/prefer-promise-with-resolversPrefer
Promise.withResolvers()when extracting resolver functions fromnew Promise().: error in All Unicorn contexts -
unicorn/prefer-queue-microtaskPrefer
queueMicrotask()overprocess.nextTick(),setImmediate(), andsetTimeout(…, 0).: error in All Unicorn contexts -
unicorn/prefer-regexp-testPrefer
RegExp#test()overString#match(),String#search(), andRegExp#exec().: error in All Unicorn contexts -
unicorn/prefer-response-static-jsonPrefer
Response.json()overnew Response(JSON.stringify()).: error in All Unicorn contexts -
unicorn/prefer-set-hasPrefer
Set#has()overArray#includes()when checking for existence or non-existence.: error in All Unicorn contexts -
unicorn/prefer-set-methodsPrefer
Setmethods for Set operations.: error in All Unicorn contexts -
unicorn/prefer-set-sizePrefer using
Set#sizeinstead ofArray#length.: error in All Unicorn contexts -
unicorn/prefer-simple-sort-comparatorPrefer a simple comparison function for
Array#sort().: error in All Unicorn contexts -
unicorn/prefer-simplified-conditionsPrefer simplified conditions.
: error in All Unicorn contexts -
unicorn/prefer-single-array-predicatePrefer a single
Array#some()orArray#every()with a combined predicate.: error in All Unicorn contexts -
unicorn/prefer-single-object-destructuringPrefer a single object destructuring declaration per local const source.
: warning in All Unicorn contexts -
unicorn/prefer-single-replaceEnforce combining multiple single-character replacements into a single
String#replaceAll()with a regular expression.: error in All Unicorn contexts -
unicorn/prefer-split-limitPrefer
String#split()with a limit.: error in All Unicorn contexts -
unicorn/prefer-spreadPrefer the spread operator over
Array.from(…),Array#concat(…),Array#{slice,toSpliced}(), and trivialfor…ofcopies.: error in All Unicorn contexts -
unicorn/prefer-string-match-allPrefer
String#matchAll()overRegExp#exec()loops.: error in All Unicorn contexts -
unicorn/prefer-string-pad-start-endPrefer
String#padStart()andString#padEnd()over manual string padding.: error in All Unicorn contexts -
unicorn/prefer-string-rawPrefer using the
String.rawtag to avoid escaping\.: error in All Unicorn contexts -
unicorn/prefer-string-repeatPrefer
String#repeat()for repeated whitespace.: error in All Unicorn contexts -
unicorn/prefer-string-replace-allPrefer
String#replaceAll()over regex searches with the global flag andString#split().join().: error in All Unicorn contexts -
unicorn/prefer-string-slicePrefer
String#slice()overString#substr()andString#substring().: error in All Unicorn contexts