ota-meshi / eslint-plugin-regexp

ESLint plugin for finding regex mistakes and style guide violations.

Home Page:https://ota-meshi.github.io/eslint-plugin-regexp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `no-useless-string-literal`

ota-meshi opened this issue · comments

Description

no-useless-string-literal rule reports the string alternatives of a single character.
They can be placed outside \q{...}.

/* ✗ BAD */
var foo = /[\q{a}]/v // => /[a]/v
var foo = /[\q{a|bc}]/v // => /[a\q{bc}]/v

/* ✓ GOOD */
var foo = /[\q{ab|}]/v