Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 1.52 KB

no-useless-string-literal.md

File metadata and controls

58 lines (38 loc) · 1.52 KB
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

regexp/no-useless-string-literal

💼 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{...}

📖 Rule Details

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

🔧 Options

Nothing.

👫 Related rules

🚀 Version

This rule was introduced in eslint-plugin-regexp v2.0.0-next.12

🔍 Implementation