Upgrade ESLint
This pulls in version 8, which covers numerous breaking changes. Most
notably, the `CLIEngine` class has been removed, for which we should now
use `ESLint`.
R=jacktfranklin@chromium.org
Bug: none
Change-Id: I3b64600e690f073d4db19fb34539db7200f3b561
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3268298
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/node_modules/eslint/lib/rules/no-empty-character-class.js b/node_modules/eslint/lib/rules/no-empty-character-class.js
index 7dc219f..85e8ef7 100644
--- a/node_modules/eslint/lib/rules/no-empty-character-class.js
+++ b/node_modules/eslint/lib/rules/no-empty-character-class.js
@@ -12,16 +12,13 @@
/*
* 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
@@ -33,7 +30,6 @@
docs: {
description: "disallow empty character classes in regular expressions",
- category: "Possible Errors",
recommended: true,
url: "https://eslint.org/docs/rules/no-empty-character-class"
},
@@ -46,18 +42,12 @@
},
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" });
}
}
-
};
}