Unicorn
245 rules eslint-plugin-unicorn@78.0.0
Complete effective rule inventory.
Rules
No enabled Unicorn rules match this search.
-
unicorn/no-useless-elseDisallow
elseafter a statement that exits.: error in All Unicorn contexts -
unicorn/no-useless-error-capture-stack-traceDisallow unnecessary
Error.captureStackTrace(…).: error in All Unicorn contexts -
unicorn/no-useless-fallback-in-spreadDisallow useless fallback when spreading in object literals.
: error in All Unicorn contexts -
unicorn/no-useless-iterator-to-arrayDisallow unnecessary
.toArray()on iterators.: error in All Unicorn contexts -
unicorn/no-useless-length-checkDisallow useless array length check.
: error in All Unicorn contexts -
unicorn/no-useless-logical-operandDisallow unnecessary operands in logical expressions involving boolean literals.
: error in All Unicorn contexts -
unicorn/no-useless-overrideDisallow useless overrides of class methods.
: error in All Unicorn contexts -
unicorn/no-useless-promise-resolve-rejectDisallow returning/yielding
Promise.resolve/reject()in async functions or promise callbacks: error in All Unicorn contexts -
unicorn/no-useless-re-exportDisallow redundant re-exports.
: error in All Unicorn contexts -
unicorn/no-useless-recursionDisallow simple recursive function calls that can be replaced with a loop.
: error in All Unicorn contexts -
unicorn/no-useless-set-constructionDisallow unnecessary
Setconstruction aroundSetmethods.: error in All Unicorn contexts -
unicorn/no-useless-spreadDisallow unnecessary spread.
: error in All Unicorn contexts -
unicorn/no-xor-as-exponentiationDisallow the bitwise XOR operator where exponentiation was likely intended.
: error in All Unicorn contexts -
unicorn/prefer-abort-signal-anyPrefer
AbortSignal.any()over manually forwarding abort events between signals.: error in All Unicorn contexts -
unicorn/prefer-abort-signal-timeoutPrefer
AbortSignal.timeout()over manually aborting anAbortControllerwithsetTimeout().: error in All Unicorn contexts -
unicorn/prefer-add-event-listenerPrefer
.addEventListener()and.removeEventListener()overon-functions.: error in All Unicorn contexts -
unicorn/prefer-add-event-listener-optionsPrefer an options object over a boolean in
.addEventListener().: error in All Unicorn contexts -
unicorn/prefer-aggregate-errorPrefer
AggregateErrorwhen throwing collected errors.: error in All Unicorn contexts -
unicorn/prefer-array-flatPrefer
Array#flat()over legacy techniques to flatten arrays.: error in All Unicorn contexts -
unicorn/prefer-array-flat-mapPrefer
.flatMap(…)over.map(…).flat()and.filter(…).flatMap(…).: error in All Unicorn contexts -
unicorn/prefer-array-from-asyncPrefer
Array.fromAsync()over array accumulation loops.: error in All Unicorn contexts -
unicorn/prefer-array-from-mapPrefer using the
Array.from()mapping function argument.: error in All Unicorn contexts -
unicorn/prefer-array-from-rangePrefer
Array.from({length}, …)when creating range arrays.: error in All Unicorn contexts -
unicorn/prefer-array-index-ofPrefer
Array#{indexOf,lastIndexOf}()overArray#{findIndex,findLastIndex}()when looking for the index of an item.: error in All Unicorn contexts -
unicorn/prefer-array-iterable-methodsPrefer iterating an array directly or with
Array#keys()overArray#entries()when the index or value is unused.: error in All Unicorn contexts -
unicorn/prefer-array-last-methodsPrefer last-oriented array methods over
Array#reverse()orArray#toReversed()followed by a method.: error in All Unicorn contexts -
unicorn/prefer-array-slicePrefer
Array#slice()overArray#splice()when reading from the returned array.: error in All Unicorn contexts -
unicorn/prefer-array-somePrefer
.some(…)over.filter(…).lengthcheck and.{find,findLast,findIndex,findLastIndex}(…).: error in All Unicorn contexts -
unicorn/prefer-atPrefer
.at()method for index access andString#charAt().: error in All Unicorn contexts -
unicorn/prefer-bigint-literalsPrefer
BigIntliterals over the constructor.: error in All Unicorn contexts -
unicorn/prefer-blob-reading-methodsPrefer
Blob#arrayBuffer()overFileReader#readAsArrayBuffer(…)andBlob#text()overFileReader#readAsText(…).: error in All Unicorn contexts -
unicorn/prefer-class-fieldsPrefer class field declarations over
thisassignments in constructors.: error in All Unicorn contexts