Unicorn
223 rules eslint-plugin-unicorn@76.0.0
Complete effective rule inventory.
Rules
No enabled Unicorn rules match this search.
-
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 -
unicorn/prefer-code-pointPrefer
String#codePointAt(…)overString#charCodeAt(…)andString.fromCodePoint(…)overString.fromCharCode(…).: error in All Unicorn contexts -
unicorn/prefer-combined-guardsPrefer combining consecutive guards with identical exit statements.
: warning in All Unicorn contexts -
unicorn/prefer-date-nowPrefer
Date.now()to get the number of milliseconds since the Unix Epoch.: error in All Unicorn contexts -
unicorn/prefer-default-parametersPrefer default parameters over reassignment.
: error in All Unicorn contexts -
unicorn/prefer-direct-iterationPrefer direct iteration over default iterator method calls.
: error in All Unicorn contexts -
unicorn/prefer-event-targetPrefer
EventTargetoverEventEmitter.: error in All Unicorn contexts -
unicorn/prefer-export-fromPrefer
export…fromwhen re-exporting.: error in All Unicorn contexts -
unicorn/prefer-flat-math-min-maxPrefer flat
Math.min()andMath.max()calls over nested calls.: error in All Unicorn contexts -
unicorn/prefer-global-number-constantsPrefer global numeric constants over
Numberstatic properties.: error in All Unicorn contexts -
unicorn/prefer-group-byPrefer
Object.groupBy()orMap.groupBy()over manual grouping.: error in All Unicorn contexts -
unicorn/prefer-has-checkPrefer
.has()when checking existence.: error in All Unicorn contexts -
unicorn/prefer-httpsPrefer HTTPS over HTTP.
: error in All Unicorn contexts -
unicorn/prefer-identifier-import-export-specifiersPrefer identifiers over string literals in import and export specifiers.
: error in All Unicorn contexts -
unicorn/prefer-import-meta-propertiesPrefer
import.meta.{dirname,filename}over legacy techniques for getting file paths.: error in All Unicorn contexts -
unicorn/prefer-iterable-in-constructorPrefer passing iterables directly to constructors instead of filling empty collections.
: error in All Unicorn contexts -
unicorn/prefer-iterator-concatPrefer
Iterator.concat(…)over temporary spread arrays.: error in All Unicorn contexts -
unicorn/prefer-iterator-helpersPrefer iterator helpers over temporary arrays from iterators.
: error in All Unicorn contexts -
unicorn/prefer-iterator-to-arrayPrefer
Iterator#toArray()over temporary arrays from iterator spreads.: error in All Unicorn contexts