-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Information:
- ESLint version: 9.17.0
eslint-plugin-regexp
version: 2.7.0
Description
const reResourceURL = new RegExp(`(?:${rePatterns.cssURL.source})|(?:${rePatterns.jsURL.source})`, 'gm')
... your plugin will falsely warn Unexpected unnecessary non-capturing group. This group can be removed without changing the behaviour of the regex
but it's required because the patterns defined earlier are:
const rePatterns = {
...
cssURL: /^\/\/ @resource.+(https:\/\/assets.+\.css.+)$/gm,
jsURL: /^\/\/ @require\s+(https:\/\/cdn\.jsdelivr\.net\/gh\/.+$)/gm,
...
}
... so without the grouping (capturing or not) the pipe will compare differently if pre-defined entire patterns weren't wholly grouped already (as in above examples)
I think probably other rules will false positive too since it looks like your plugin doesn't construct new RegExp()
before linting to gather the context required for determining truly useless things
Metadata
Metadata
Assignees
Labels
No labels