Unicorn
245 rules eslint-plugin-unicorn@78.0.0
Complete effective rule inventory.
Rules
No enabled Unicorn rules match this search.
-
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 and destructuring defaults over reassignment and fallback expressions.
: error in All Unicorn contexts -
unicorn/prefer-direct-iterationPrefer direct iteration over default iterator method calls.
: error in All Unicorn contexts -
unicorn/prefer-escaped-irregular-whitespacePrefer escape sequences for irregular whitespace characters.
: 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 -
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-literal-asciiPrefer literal printable ASCII characters over escape sequences.
: 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