Update checked-in dependencies
This commit is contained in:
parent
49f7b34c3d
commit
5261a1223f
1640 changed files with 174830 additions and 182292 deletions
30
node_modules/eslint-plugin-escompat/lib/rules/no-regexp-duplicate-named-groups.js
generated
vendored
Normal file
30
node_modules/eslint-plugin-escompat/lib/rules/no-regexp-duplicate-named-groups.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const hasDuplicateNamedGroups = s => /(\(\?<[_$\w]*?)>.*?\1>/.test(s)
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (hasDuplicateNamedGroups(node.regex.pattern)) {
|
||||
context.report(node, `RegExp duplicate named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
},
|
||||
'CallExpression[callee.name="RegExp"], NewExpression[callee.name="RegExp"]'(node) {
|
||||
const [source] = node.arguments;
|
||||
if (
|
||||
source &&
|
||||
(
|
||||
(
|
||||
source.type === 'Literal' &&
|
||||
typeof source.value === 'string' &&
|
||||
hasDuplicateNamedGroups(source.value)
|
||||
) ||
|
||||
(
|
||||
source.type === 'TemplateLiteral' &&
|
||||
source.quasis.some(({value: {raw}}) => hasDuplicateNamedGroups(raw))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp duplicate named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue