Incorrect report of `no-unused-capturing-group` for `/^\.{1,2}(\/.*)?$/`
JounQin opened this issue · comments
Information: v8.18.0
- ESLint version:
eslint-plugin-regexp
version: 1.7.0
Description
const RELATIVE_PATH_PATTERN = /^\.{1,2}(\/.*)?$/
()?
should not be reported?
If you don't use a capturing group, I think you can use a non-capturing group instead.
const RELATIVE_PATH_PATTERN = /^\.{1,2}(?:\/.*)?$/
Seems my regexp skill is not good enough then. 🤣
Can this plugin provide suggestions
? (Auto fix maybe incorrect and risky.)
Seems my regexp skill is not good enough then. 🤣
I made this plugin and no-unused-capturing-group
rule, because I made many similar mistakes before 😏
no-unused-capturing-group
rule already supports the suggestion API.
If you tolerate the risk, you can optionally make an auto-fix.
https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-unused-capturing-group.html#options
closing since expected