Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
29
node_modules/eslint/lib/rules/no-empty-character-class.js
generated
vendored
29
node_modules/eslint/lib/rules/no-empty-character-class.js
generated
vendored
|
|
@ -12,28 +12,25 @@
|
|||
/*
|
||||
* plain-English description of the following regexp:
|
||||
* 0. `^` fix the match at the beginning of the string
|
||||
* 1. `\/`: the `/` that begins the regexp
|
||||
* 2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following
|
||||
* 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes)
|
||||
* 2.1. `\\.`: an escape sequence
|
||||
* 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty
|
||||
* 3. `\/` the `/` that ends the regexp
|
||||
* 4. `[gimuy]*`: optional regexp flags
|
||||
* 5. `$`: fix the match at the end of the string
|
||||
* 1. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following
|
||||
* 1.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes)
|
||||
* 1.1. `\\.`: an escape sequence
|
||||
* 1.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty
|
||||
* 2. `$`: fix the match at the end of the string
|
||||
*/
|
||||
const regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimuys]*$/u;
|
||||
const regex = /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "disallow empty character classes in regular expressions",
|
||||
category: "Possible Errors",
|
||||
description: "Disallow empty character classes in regular expressions",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/rules/no-empty-character-class"
|
||||
},
|
||||
|
|
@ -46,18 +43,12 @@ module.exports = {
|
|||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
|
||||
return {
|
||||
|
||||
Literal(node) {
|
||||
const token = sourceCode.getFirstToken(node);
|
||||
|
||||
if (token.type === "RegularExpression" && !regex.test(token.value)) {
|
||||
"Literal[regex]"(node) {
|
||||
if (!regex.test(node.regex.pattern)) {
|
||||
context.report({ node, messageId: "unexpected" });
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue