initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-named-group.js
generated
vendored
Normal file
30
github/codeql-action-v2/node_modules/eslint-plugin-escompat/lib/rules/no-regexp-named-group.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const hasNamedGroup = s => /\(\?<[_$\w]/.test(s)
|
||||
|
||||
module.exports = (context, badBrowser) => ({
|
||||
'Literal[regex]'(node) {
|
||||
if (hasNamedGroup(node.regex.pattern)) {
|
||||
context.report(node, `RegExp 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' &&
|
||||
hasNamedGroup(source.value)
|
||||
) ||
|
||||
(
|
||||
source.type === 'TemplateLiteral' &&
|
||||
source.quasis.some(({value: {raw}}) => hasNamedGroup(raw))
|
||||
)
|
||||
)
|
||||
) {
|
||||
context.report(node, `RegExp named groups are not supported in ${badBrowser}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue