Skip to content

Available Rules

💼 Configurations enabled in.
⚠️ Configurations set to warn in.
🟢 Set in the flat/recommended configuration.
🔵 Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

Possible Errors

NameDescription💼⚠️🔧💡
no-contradiction-with-assertiondisallow elements that contradict assertions🟢 🔵💡
no-control-characterdisallow control characters💡
no-dupe-disjunctionsdisallow duplicate disjunctions🟢 🔵💡
no-empty-alternativedisallow alternatives without elements🟢 🔵💡
no-empty-capturing-groupdisallow capturing group that captures empty.🟢 🔵
no-empty-character-classdisallow character classes that match no characters🟢 🔵
no-empty-groupdisallow empty group🟢 🔵
no-empty-lookarounds-assertiondisallow empty lookahead assertion or empty lookbehind assertion🟢 🔵
no-escape-backspacedisallow escape backspace ([\b])🟢 🔵💡
no-invalid-regexpdisallow invalid regular expression strings in RegExp constructors🟢 🔵
no-lazy-endsdisallow lazy quantifiers at the end of an expression🟢 🔵💡
no-misleading-capturing-groupdisallow capturing groups that do not behave as one would expect🟢 🔵💡
no-misleading-unicode-characterdisallow multi-code-point characters in character classes and quantifiers🟢 🔵🔧💡
no-missing-g-flagdisallow missing g flag in patterns used in String#matchAll and String#replaceAll🟢 🔵🔧
no-optional-assertiondisallow optional assertions🟢 🔵
no-potentially-useless-backreferencedisallow backreferences that reference a group that might not be matched🟢 🔵
no-super-linear-backtrackingdisallow exponential and polynomial backtracking🟢 🔵🔧
no-super-linear-movedisallow quantifiers that cause quadratic moves
no-useless-assertionsdisallow assertions that are known to always accept (or reject)🟢 🔵💡
no-useless-backreferencedisallow useless backreferences in regular expressions🟢 🔵
no-useless-dollar-replacementsdisallow useless $ replacements in replacement string🟢 🔵
strictdisallow not strictly valid regular expressions🟢 🔵🔧💡

Best Practices

NameDescription💼⚠️🔧💡
confusing-quantifierdisallow confusing quantifiers🟢 🔵
control-character-escapeenforce consistent escaping of control characters🟢 🔵🔧
negationenforce use of escapes on negation🟢 🔵🔧
no-dupe-characters-character-classdisallow duplicate characters in the RegExp character class🟢 🔵🔧
no-empty-string-literaldisallow empty string literals in character classes🟢 🔵
no-extra-lookaround-assertionsdisallow unnecessary nested lookaround assertions🟢 🔵🔧
no-invisible-characterdisallow invisible raw character🟢 🔵🔧
no-legacy-featuresdisallow legacy RegExp features🟢 🔵
no-non-standard-flagdisallow non-standard flags🟢 🔵
no-obscure-rangedisallow obscure character ranges🟢 🔵
no-octaldisallow octal escape sequence💡
no-standalone-backslashdisallow standalone backslashes (\)
no-trivially-nested-assertiondisallow trivially nested assertions🟢 🔵🔧
no-trivially-nested-quantifierdisallow nested quantifiers that can be rewritten as one quantifier🟢 🔵🔧
no-unused-capturing-groupdisallow unused capturing group🟢 🔵🔧💡
no-useless-character-classdisallow character class with one character🟢 🔵🔧
no-useless-flagdisallow unnecessary regex flags🟢 🔵🔧
no-useless-lazydisallow unnecessarily non-greedy quantifiers🟢 🔵🔧
no-useless-quantifierdisallow quantifiers that can be removed🟢 🔵🔧💡
no-useless-rangedisallow unnecessary character ranges🟢 🔵🔧
no-useless-set-operanddisallow unnecessary elements in expression character classes🟢 🔵🔧
no-useless-string-literaldisallow string disjunction of single characters in \q{...}🟢 🔵🔧
no-useless-two-nums-quantifierdisallow unnecessary {n,m} quantifier🟢 🔵🔧
no-zero-quantifierdisallow quantifiers with a maximum of zero🟢 🔵💡
optimal-lookaround-quantifierdisallow the alternatives of lookarounds that end with a non-constant quantifier🟢 🔵💡
optimal-quantifier-concatenationrequire optimal quantifiers for concatenated quantifiers🟢 🔵🔧
prefer-escape-replacement-dollar-charenforces escape of replacement $ character ($$).
prefer-predefined-assertionprefer predefined assertion over equivalent lookarounds🟢 🔵🔧
prefer-quantifierenforce using quantifier🔧
prefer-rangeenforce using character class range🟢 🔵🔧
prefer-regexp-execenforce that RegExp#exec is used instead of String#match if no global flag is provided
prefer-regexp-testenforce that RegExp#test is used instead of String#match and RegExp#exec🔧
prefer-set-operationprefer character class set operations instead of lookarounds🟢 🔵🔧
require-unicode-regexpenforce the use of the u flag🔧
require-unicode-sets-regexpenforce the use of the v flag🔧
simplify-set-operationsrequire simplify set operations🟢 🔵🔧
sort-alternativessort alternatives if order doesn't matter🔧
use-ignore-caseuse the i flag if it simplifies the pattern🟢 🔵🔧

Stylistic Issues

NameDescription💼⚠️🔧💡
grapheme-string-literalenforce single grapheme in string literal
hexadecimal-escapeenforce consistent usage of hexadecimal escape🔧
letter-caseenforce into your favorite case🔧
match-anyenforce match any character style🟢 🔵🔧
no-useless-escapedisallow unnecessary escape characters in RegExp🟢 🔵🔧
no-useless-non-capturing-groupdisallow unnecessary non-capturing group🟢 🔵🔧
prefer-character-classenforce using character class🟢 🔵🔧
prefer-denforce using \d🟢 🔵🔧
prefer-lookaroundprefer lookarounds over capturing group that do not replace🔧
prefer-named-backreferenceenforce using named backreferences🔧
prefer-named-capture-groupenforce using named capture groups
prefer-named-replacementenforce using named replacement🔧
prefer-plus-quantifierenforce using + quantifier🟢 🔵🔧
prefer-question-quantifierenforce using ? quantifier🟢 🔵🔧
prefer-result-array-groupsenforce using result array groups🔧
prefer-star-quantifierenforce using * quantifier🟢 🔵🔧
prefer-unicode-codepoint-escapesenforce use of unicode codepoint escapes🟢 🔵🔧
prefer-wenforce using \w🟢 🔵🔧
sort-character-class-elementsenforces elements order in character class🔧
sort-flagsrequire regex flags to be sorted🟢 🔵🔧
unicode-escapeenforce consistent usage of unicode escape or unicode codepoint escape🔧
unicode-propertyenforce consistent naming of unicode properties🔧

Removed

  • ⛔ These rules have been removed in a previous major release, after they have been deprecated for a while.
Rule IDReplaced byRemoved in version
no-assertion-capturing-groupregexp/no-empty-capturing-groupv2.0.0
no-useless-exactly-quantifierregexp/no-useless-quantifier, regexp/no-zero-quantifierv2.0.0
no-useless-non-greedyregexp/no-useless-lazyv2.0.0
order-in-character-classregexp/sort-character-class-elementsv2.0.0
prefer-tregexp/control-character-escapev2.0.0