pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
regexp/no-useless-string-literal |
disallow string disjunction of single characters in `\q{...}` |
v2.0.0-next.12 |
💼 This rule is enabled in the ✅ plugin:regexp/recommended
config.
🔧 This rule is automatically fixable by the --fix
CLI option.
disallow string disjunction of single characters in
\q{...}
This rule reports the string alternatives of a single character in \q{...}
.
It can be placed outside \q{...}
.
/* eslint regexp/no-useless-string-literal: "error" */
/* ✓ GOOD */
var foo = /[\q{abc}]/v
var foo = /[\q{ab|}]/v
/* ✗ BAD */
var foo = /[\q{a}]/v // => /[a]/v
var foo = /[\q{a|bc}]/v // => /[a\q{bc}]/v
Nothing.
This rule was introduced in eslint-plugin-regexp v2.0.0-next.12