};
- };
-};
-
-export = js;
diff --git a/node_modules/@rollup/rollup-darwin-arm64/README.md b/node_modules/@rollup/rollup-darwin-arm64/README.md
deleted file mode 100644
index c29619c30..000000000
--- a/node_modules/@rollup/rollup-darwin-arm64/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# `@rollup/rollup-darwin-arm64`
-
-This is the **aarch64-apple-darwin** binary for `rollup`
diff --git a/node_modules/@rollup/rollup-darwin-arm64/package.json b/node_modules/@rollup/rollup-darwin-arm64/package.json
deleted file mode 100644
index fc4b22a8d..000000000
--- a/node_modules/@rollup/rollup-darwin-arm64/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@rollup/rollup-darwin-arm64",
- "version": "4.54.0",
- "os": [
- "darwin"
- ],
- "cpu": [
- "arm64"
- ],
- "files": [
- "rollup.darwin-arm64.node"
- ],
- "description": "Native bindings for Rollup",
- "author": "Lukas Taegert-Atkinson",
- "homepage": "https://rollupjs.org/",
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/rollup/rollup.git"
- },
- "main": "./rollup.darwin-arm64.node"
-}
\ No newline at end of file
diff --git a/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node b/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node
deleted file mode 100644
index 463a41b7d..000000000
Binary files a/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node and /dev/null differ
diff --git a/node_modules/acorn/CHANGELOG.md b/node_modules/acorn/CHANGELOG.md
index c86068cd7..d18759aea 100644
--- a/node_modules/acorn/CHANGELOG.md
+++ b/node_modules/acorn/CHANGELOG.md
@@ -1,3 +1,21 @@
+## 8.16.0 (2026-02-19)
+
+### New features
+
+The `sourceType` option can now be set to `"commonjs"` to have the parser treat the top level scope as a function scope.
+
+Add support for Unicode 17.
+
+### Bug fixes
+
+Don't recognize `await using` as contextual keywords when followed directly by a backslash.
+
+Fix an issue where the parser would allow `return` statements in `static` blocks when `allowReturnOutsideFunction` was enabled.
+
+Properly reject `using` declarations that appear directly in `switch` or `for` head scopes.
+
+Fix some corner case issues in the recognition of `using` syntax.
+
## 8.15.0 (2025-06-08)
### New features
diff --git a/node_modules/acorn/README.md b/node_modules/acorn/README.md
index f7ff96624..962de0272 100644
--- a/node_modules/acorn/README.md
+++ b/node_modules/acorn/README.md
@@ -26,6 +26,24 @@ git clone https://github.com/acornjs/acorn.git
cd acorn
npm install
```
+## Importing acorn
+
+ESM as well as CommonJS is supported for all 3: `acorn`, `acorn-walk` and `acorn-loose`.
+
+ESM example for `acorn`:
+
+```js
+import * as acorn from "acorn"
+```
+
+CommonJS example for `acorn`:
+
+```js
+let acorn = require("acorn")
+```
+
+ESM is preferred, as it allows better editor auto-completions by offering TypeScript support.
+For this reason, following examples will use ESM imports.
## Interface
@@ -36,8 +54,8 @@ syntax tree object as specified by the [ESTree
spec](https://github.com/estree/estree).
```javascript
-let acorn = require("acorn");
-console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
+import * as acorn from "acorn"
+console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}))
```
When encountering a syntax error, the parser will raise a
@@ -61,11 +79,12 @@ required):
implemented through plugins.
- **sourceType**: Indicate the mode the code should be parsed in. Can be
- either `"script"` or `"module"`. This influences global strict mode
+ either `"script"`, `"module"` or `"commonjs"`. This influences global strict mode
and parsing of `import` and `export` declarations.
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
- will be valid, even if `ecmaVersion` is less than 6.
+ will be valid, even if `ecmaVersion` is less than 6. If set to `"commonjs"`,
+ it is the same as `"script"` except that the top-level scope behaves like a function.
- **onInsertedSemicolon**: If given a callback, that callback will be
called whenever a missing semicolon is inserted by the parser. The
@@ -97,7 +116,7 @@ required):
for `ecmaVersion` 2022 and later, `false` for lower versions.
Setting this option to `true` allows to have top-level `await`
expressions. They are still not allowed in non-`async` functions,
- though.
+ though. Setting this option to `true` is not allowed when `sourceType: "commonjs"`.
- **allowSuperOutsideMethod**: By default, `super` outside a method
raises an error. Set this to `true` to accept such code.
@@ -217,7 +236,7 @@ for (let token of acorn.tokenizer(str)) {
}
// transform code to array of tokens:
-var tokens = [...acorn.tokenizer(str)];
+var tokens = [...acorn.tokenizer(str)]
```
**tokTypes** holds an object mapping names to the token type objects
@@ -238,10 +257,10 @@ on the extended version of the class. To extend a parser with plugins,
you can use its static `extend` method.
```javascript
-var acorn = require("acorn");
-var jsx = require("acorn-jsx");
-var JSXParser = acorn.Parser.extend(jsx());
-JSXParser.parse("foo()", {ecmaVersion: 2020});
+var acorn = require("acorn")
+var jsx = require("acorn-jsx")
+var JSXParser = acorn.Parser.extend(jsx())
+JSXParser.parse("foo()", {ecmaVersion: 2020})
```
The `extend` method takes any number of plugin values, and returns a
diff --git a/node_modules/acorn/dist/acorn.d.mts b/node_modules/acorn/dist/acorn.d.mts
index f2ec5243b..afbd9139e 100644
--- a/node_modules/acorn/dist/acorn.d.mts
+++ b/node_modules/acorn/dist/acorn.d.mts
@@ -614,10 +614,10 @@ export interface Options {
/**
* `sourceType` indicates the mode the code should be parsed in.
- * Can be either `"script"` or `"module"`. This influences global
+ * Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
* strict mode and parsing of `import` and `export` declarations.
*/
- sourceType?: "script" | "module"
+ sourceType?: "script" | "module" | "commonjs"
/**
* a callback that will be called when a semicolon is automatically inserted.
diff --git a/node_modules/acorn/dist/acorn.d.ts b/node_modules/acorn/dist/acorn.d.ts
index f2ec5243b..afbd9139e 100644
--- a/node_modules/acorn/dist/acorn.d.ts
+++ b/node_modules/acorn/dist/acorn.d.ts
@@ -614,10 +614,10 @@ export interface Options {
/**
* `sourceType` indicates the mode the code should be parsed in.
- * Can be either `"script"` or `"module"`. This influences global
+ * Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
* strict mode and parsing of `import` and `export` declarations.
*/
- sourceType?: "script" | "module"
+ sourceType?: "script" | "module" | "commonjs"
/**
* a callback that will be called when a semicolon is automatically inserted.
diff --git a/node_modules/acorn/dist/acorn.js b/node_modules/acorn/dist/acorn.js
index cb5628bf8..b4f281a46 100644
--- a/node_modules/acorn/dist/acorn.js
+++ b/node_modules/acorn/dist/acorn.js
@@ -5,16 +5,16 @@
})(this, (function (exports) { 'use strict';
// This file was generated. Do not modify manually!
- var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
+ var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
// This file was generated. Do not modify manually!
- var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
+ var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
// This file was generated. Do not modify manually!
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
+ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
// This file was generated. Do not modify manually!
- var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
+ var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
@@ -339,7 +339,7 @@
// for new syntax features.
ecmaVersion: null,
// `sourceType` indicates the mode the code should be parsed in.
- // Can be either `"script"` or `"module"`. This influences global
+ // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
// strict mode and parsing of `import` and `export` declarations.
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called when
@@ -463,6 +463,9 @@
if (isArray(options.onComment))
{ options.onComment = pushComment(options, options.onComment); }
+ if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
+ { throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") }
+
return options
}
@@ -494,6 +497,7 @@
SCOPE_DIRECT_SUPER = 128,
SCOPE_CLASS_STATIC_BLOCK = 256,
SCOPE_CLASS_FIELD_INIT = 512,
+ SCOPE_SWITCH = 1024,
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
function functionFlags(async, generator) {
@@ -583,7 +587,12 @@
// Scope tracking for duplicate variable names (see scope.js)
this.scopeStack = [];
- this.enterScope(SCOPE_TOP);
+ this.enterScope(
+ this.options.sourceType === "commonjs"
+ // In commonjs, the top-level scope behaves like a function scope
+ ? SCOPE_FUNCTION
+ : SCOPE_TOP
+ );
// For RegExp validation
this.regexpState = null;
@@ -594,7 +603,7 @@
this.privateNameStack = [];
};
- var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
+ var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } };
Parser.prototype.parse = function parse () {
var node = this.options.program || this.startNode();
@@ -618,6 +627,12 @@
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
};
+ prototypeAccessors.allowReturn.get = function () {
+ if (this.inFunction) { return true }
+ if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }
+ return false
+ };
+
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
@@ -638,6 +653,14 @@
return false
};
+ prototypeAccessors.allowUsing.get = function () {
+ var ref = this.currentScope();
+ var flags = ref.flags;
+ if (flags & SCOPE_SWITCH) { return false }
+ if (!this.inModule && flags & SCOPE_TOP) { return false }
+ return true
+ };
+
prototypeAccessors.inClassStaticBlock.get = function () {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
};
@@ -842,7 +865,7 @@
} }
this.adaptDirectivePrologue(node.body);
this.next();
- node.sourceType = this.options.sourceType;
+ node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
return this.finishNode(node, "Program")
};
@@ -852,7 +875,7 @@
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
- var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
+ var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
// For ambiguous cases, determine if a LexicalDeclaration (or only a
// Statement) is allowed here. If context is not empty then only a Statement
// is allowed. However, `let [` is an explicit negative lookahead for
@@ -860,12 +883,13 @@
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
if (context) { return false }
- if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
- if (isIdentifierStart(nextCh, true)) {
- var pos = next + 1;
- while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
- if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
- var ident = this.input.slice(next, pos);
+ if (nextCh === 123) { return true } // '{'
+ if (isIdentifierStart(nextCh)) {
+ var start = next;
+ do { next += nextCh <= 0xffff ? 1 : 2; }
+ while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)))
+ if (nextCh === 92) { return true }
+ var ident = this.input.slice(start, next);
if (!keywordRelationalOperator.test(ident)) { return true }
}
return false
@@ -884,7 +908,7 @@
return !lineBreak.test(this.input.slice(this.pos, next)) &&
this.input.slice(next, next + 8) === "function" &&
(next + 8 === this.input.length ||
- !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
+ !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\' */))
};
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
@@ -898,28 +922,28 @@
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
if (isAwaitUsing) {
- var awaitEndPos = next + 5 /* await */, after;
- if (this.input.slice(next, awaitEndPos) !== "using" ||
- awaitEndPos === this.input.length ||
- isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||
- (after > 0xd7ff && after < 0xdc00)
+ var usingEndPos = next + 5 /* using */, after;
+ if (this.input.slice(next, usingEndPos) !== "using" ||
+ usingEndPos === this.input.length ||
+ isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||
+ after === 92 /* '\' */
) { return false }
- skipWhiteSpace.lastIndex = awaitEndPos;
+ skipWhiteSpace.lastIndex = usingEndPos;
var skipAfterUsing = skipWhiteSpace.exec(this.input);
- if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }
- }
-
- if (isFor) {
- var ofEndPos = next + 2 /* of */, after$1;
- if (this.input.slice(next, ofEndPos) === "of") {
- if (ofEndPos === this.input.length ||
- (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }
- }
- }
-
- var ch = this.input.charCodeAt(next);
- return isIdentifierStart(ch, true) || ch === 92 // '\'
+ next = usingEndPos + skipAfterUsing[0].length;
+ if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false }
+ }
+
+ var ch = this.fullCharCodeAt(next);
+ if (!isIdentifierStart(ch) && ch !== 92 /* '\' */) { return false }
+ var idStart = next;
+ do { next += ch <= 0xffff ? 1 : 2; }
+ while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
+ if (ch === 92) { return true }
+ var id = this.input.slice(idStart, next);
+ if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false }
+ return true
};
pp$8.isAwaitUsing = function(isFor) {
@@ -1008,8 +1032,8 @@
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
if (usingKind) {
- if (topLevel && this.options.sourceType === "script") {
- this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
+ if (!this.allowUsing) {
+ this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
}
if (usingKind === "await using") {
if (!this.canAwait) {
@@ -1106,7 +1130,12 @@
if (usingKind) {
var init$2 = this.startNode();
this.next();
- if (usingKind === "await using") { this.next(); }
+ if (usingKind === "await using") {
+ if (!this.canAwait) {
+ this.raise(this.start, "Await using cannot appear outside of async function");
+ }
+ this.next();
+ }
this.parseVar(init$2, true, usingKind);
this.finishNode(init$2, "VariableDeclaration");
return this.parseForAfterInit(node, init$2, awaitAt)
@@ -1165,7 +1194,7 @@
};
pp$8.parseReturnStatement = function(node) {
- if (!this.inFunction && !this.options.allowReturnOutsideFunction)
+ if (!this.allowReturn)
{ this.raise(this.start, "'return' outside of function"); }
this.next();
@@ -1184,7 +1213,7 @@
node.cases = [];
this.expect(types$1.braceL);
this.labels.push(switchLabel);
- this.enterScope(0);
+ this.enterScope(SCOPE_SWITCH);
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
@@ -3892,7 +3921,7 @@
};
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
- var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
+ var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz";
// This file contains Unicode properties extracted from the ECMAScript specification.
// The lists are extracted like so:
@@ -5453,13 +5482,17 @@
return this.getTokenFromCode(code)
};
- pp.fullCharCodeAtPos = function() {
- var code = this.input.charCodeAt(this.pos);
+ pp.fullCharCodeAt = function(pos) {
+ var code = this.input.charCodeAt(pos);
if (code <= 0xd7ff || code >= 0xdc00) { return code }
- var next = this.input.charCodeAt(this.pos + 1);
+ var next = this.input.charCodeAt(pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
};
+ pp.fullCharCodeAtPos = function() {
+ return this.fullCharCodeAt(this.pos)
+ };
+
pp.skipBlockComment = function() {
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
@@ -6187,7 +6220,7 @@
// [ghbt]: https://github.com/acornjs/acorn/issues
- var version = "8.15.0";
+ var version = "8.16.0";
Parser.acorn = {
Parser: Parser,
diff --git a/node_modules/acorn/dist/acorn.mjs b/node_modules/acorn/dist/acorn.mjs
index 74d5fc431..9067e9bf9 100644
--- a/node_modules/acorn/dist/acorn.mjs
+++ b/node_modules/acorn/dist/acorn.mjs
@@ -1,14 +1,14 @@
// This file was generated. Do not modify manually!
-var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
+var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
// This file was generated. Do not modify manually!
-var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
+var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
// This file was generated. Do not modify manually!
-var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
+var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
// This file was generated. Do not modify manually!
-var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
+var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
@@ -333,7 +333,7 @@ var defaultOptions = {
// for new syntax features.
ecmaVersion: null,
// `sourceType` indicates the mode the code should be parsed in.
- // Can be either `"script"` or `"module"`. This influences global
+ // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
// strict mode and parsing of `import` and `export` declarations.
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called when
@@ -457,6 +457,9 @@ function getOptions(opts) {
if (isArray(options.onComment))
{ options.onComment = pushComment(options, options.onComment); }
+ if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
+ { throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs") }
+
return options
}
@@ -488,6 +491,7 @@ var
SCOPE_DIRECT_SUPER = 128,
SCOPE_CLASS_STATIC_BLOCK = 256,
SCOPE_CLASS_FIELD_INIT = 512,
+ SCOPE_SWITCH = 1024,
SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
function functionFlags(async, generator) {
@@ -577,7 +581,12 @@ var Parser = function Parser(options, input, startPos) {
// Scope tracking for duplicate variable names (see scope.js)
this.scopeStack = [];
- this.enterScope(SCOPE_TOP);
+ this.enterScope(
+ this.options.sourceType === "commonjs"
+ // In commonjs, the top-level scope behaves like a function scope
+ ? SCOPE_FUNCTION
+ : SCOPE_TOP
+ );
// For RegExp validation
this.regexpState = null;
@@ -588,7 +597,7 @@ var Parser = function Parser(options, input, startPos) {
this.privateNameStack = [];
};
-var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };
+var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } };
Parser.prototype.parse = function parse () {
var node = this.options.program || this.startNode();
@@ -612,6 +621,12 @@ prototypeAccessors.canAwait.get = function () {
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
};
+prototypeAccessors.allowReturn.get = function () {
+ if (this.inFunction) { return true }
+ if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) { return true }
+ return false
+};
+
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
@@ -632,6 +647,14 @@ prototypeAccessors.allowNewDotTarget.get = function () {
return false
};
+prototypeAccessors.allowUsing.get = function () {
+ var ref = this.currentScope();
+ var flags = ref.flags;
+ if (flags & SCOPE_SWITCH) { return false }
+ if (!this.inModule && flags & SCOPE_TOP) { return false }
+ return true
+};
+
prototypeAccessors.inClassStaticBlock.get = function () {
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0
};
@@ -836,7 +859,7 @@ pp$8.parseTopLevel = function(node) {
} }
this.adaptDirectivePrologue(node.body);
this.next();
- node.sourceType = this.options.sourceType;
+ node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
return this.finishNode(node, "Program")
};
@@ -846,7 +869,7 @@ pp$8.isLet = function(context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
- var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
+ var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
// For ambiguous cases, determine if a LexicalDeclaration (or only a
// Statement) is allowed here. If context is not empty then only a Statement
// is allowed. However, `let [` is an explicit negative lookahead for
@@ -854,12 +877,13 @@ pp$8.isLet = function(context) {
if (nextCh === 91 || nextCh === 92) { return true } // '[', '\'
if (context) { return false }
- if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral
- if (isIdentifierStart(nextCh, true)) {
- var pos = next + 1;
- while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
- if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
- var ident = this.input.slice(next, pos);
+ if (nextCh === 123) { return true } // '{'
+ if (isIdentifierStart(nextCh)) {
+ var start = next;
+ do { next += nextCh <= 0xffff ? 1 : 2; }
+ while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)))
+ if (nextCh === 92) { return true }
+ var ident = this.input.slice(start, next);
if (!keywordRelationalOperator.test(ident)) { return true }
}
return false
@@ -878,7 +902,7 @@ pp$8.isAsyncFunction = function() {
return !lineBreak.test(this.input.slice(this.pos, next)) &&
this.input.slice(next, next + 8) === "function" &&
(next + 8 === this.input.length ||
- !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
+ !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 /* '\' */))
};
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
@@ -892,28 +916,28 @@ pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
if (isAwaitUsing) {
- var awaitEndPos = next + 5 /* await */, after;
- if (this.input.slice(next, awaitEndPos) !== "using" ||
- awaitEndPos === this.input.length ||
- isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||
- (after > 0xd7ff && after < 0xdc00)
+ var usingEndPos = next + 5 /* using */, after;
+ if (this.input.slice(next, usingEndPos) !== "using" ||
+ usingEndPos === this.input.length ||
+ isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||
+ after === 92 /* '\' */
) { return false }
- skipWhiteSpace.lastIndex = awaitEndPos;
+ skipWhiteSpace.lastIndex = usingEndPos;
var skipAfterUsing = skipWhiteSpace.exec(this.input);
- if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }
- }
-
- if (isFor) {
- var ofEndPos = next + 2 /* of */, after$1;
- if (this.input.slice(next, ofEndPos) === "of") {
- if (ofEndPos === this.input.length ||
- (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }
- }
- }
-
- var ch = this.input.charCodeAt(next);
- return isIdentifierStart(ch, true) || ch === 92 // '\'
+ next = usingEndPos + skipAfterUsing[0].length;
+ if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) { return false }
+ }
+
+ var ch = this.fullCharCodeAt(next);
+ if (!isIdentifierStart(ch) && ch !== 92 /* '\' */) { return false }
+ var idStart = next;
+ do { next += ch <= 0xffff ? 1 : 2; }
+ while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
+ if (ch === 92) { return true }
+ var id = this.input.slice(idStart, next);
+ if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false }
+ return true
};
pp$8.isAwaitUsing = function(isFor) {
@@ -1002,8 +1026,8 @@ pp$8.parseStatement = function(context, topLevel, exports) {
var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
if (usingKind) {
- if (topLevel && this.options.sourceType === "script") {
- this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
+ if (!this.allowUsing) {
+ this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
}
if (usingKind === "await using") {
if (!this.canAwait) {
@@ -1100,7 +1124,12 @@ pp$8.parseForStatement = function(node) {
if (usingKind) {
var init$2 = this.startNode();
this.next();
- if (usingKind === "await using") { this.next(); }
+ if (usingKind === "await using") {
+ if (!this.canAwait) {
+ this.raise(this.start, "Await using cannot appear outside of async function");
+ }
+ this.next();
+ }
this.parseVar(init$2, true, usingKind);
this.finishNode(init$2, "VariableDeclaration");
return this.parseForAfterInit(node, init$2, awaitAt)
@@ -1159,7 +1188,7 @@ pp$8.parseIfStatement = function(node) {
};
pp$8.parseReturnStatement = function(node) {
- if (!this.inFunction && !this.options.allowReturnOutsideFunction)
+ if (!this.allowReturn)
{ this.raise(this.start, "'return' outside of function"); }
this.next();
@@ -1178,7 +1207,7 @@ pp$8.parseSwitchStatement = function(node) {
node.cases = [];
this.expect(types$1.braceL);
this.labels.push(switchLabel);
- this.enterScope(0);
+ this.enterScope(SCOPE_SWITCH);
// Statements under must be grouped (by label) in SwitchCase
// nodes. `cur` is used to keep the node that we are currently
@@ -3886,7 +3915,7 @@ pp$2.copyNode = function(node) {
};
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
-var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
+var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz";
// This file contains Unicode properties extracted from the ECMAScript specification.
// The lists are extracted like so:
@@ -5447,13 +5476,17 @@ pp.readToken = function(code) {
return this.getTokenFromCode(code)
};
-pp.fullCharCodeAtPos = function() {
- var code = this.input.charCodeAt(this.pos);
+pp.fullCharCodeAt = function(pos) {
+ var code = this.input.charCodeAt(pos);
if (code <= 0xd7ff || code >= 0xdc00) { return code }
- var next = this.input.charCodeAt(this.pos + 1);
+ var next = this.input.charCodeAt(pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
};
+pp.fullCharCodeAtPos = function() {
+ return this.fullCharCodeAt(this.pos)
+};
+
pp.skipBlockComment = function() {
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
@@ -6181,7 +6214,7 @@ pp.readWord = function() {
// [ghbt]: https://github.com/acornjs/acorn/issues
-var version = "8.15.0";
+var version = "8.16.0";
Parser.acorn = {
Parser: Parser,
diff --git a/node_modules/acorn/package.json b/node_modules/acorn/package.json
index 6f63ddbf6..7f4d1708b 100644
--- a/node_modules/acorn/package.json
+++ b/node_modules/acorn/package.json
@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
- "version": "8.15.0",
+ "version": "8.16.0",
"engines": {
"node": ">=0.4.0"
},
diff --git a/node_modules/eslint/README.md b/node_modules/eslint/README.md
index 77d194010..227d40c7c 100644
--- a/node_modules/eslint/README.md
+++ b/node_modules/eslint/README.md
@@ -1,9 +1,11 @@
[](https://www.npmjs.com/package/eslint)
[](https://www.npmjs.com/package/eslint)
[](https://github.com/eslint/eslint/actions)
-
+[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_shield)
+
[](https://opencollective.com/eslint)
[](https://opencollective.com/eslint)
+[](https://twitter.com/intent/user?screen_name=geteslint)
# ESLint
@@ -13,120 +15,109 @@
[Contribute to ESLint](https://eslint.org/docs/latest/contribute) |
[Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) |
[Code of Conduct](https://eslint.org/conduct) |
-[X](https://x.com/geteslint) |
+[Twitter](https://twitter.com/geteslint) |
[Discord](https://eslint.org/chat) |
-[Mastodon](https://fosstodon.org/@eslint) |
-[Bluesky](https://bsky.app/profile/eslint.org)
+[Mastodon](https://fosstodon.org/@eslint)
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:
-- ESLint uses [Espree](https://github.com/eslint/js/tree/main/packages/espree) for JavaScript parsing.
-- ESLint uses an AST to evaluate patterns in code.
-- ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.
+* ESLint uses [Espree](https://github.com/eslint/espree) for JavaScript parsing.
+* ESLint uses an AST to evaluate patterns in code.
+* ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.
## Table of Contents
1. [Installation and Usage](#installation-and-usage)
-1. [Configuration](#configuration)
-1. [Version Support](#version-support)
-1. [Code of Conduct](#code-of-conduct)
-1. [Filing Issues](#filing-issues)
-1. [Frequently Asked Questions](#frequently-asked-questions)
-1. [Releases](#releases)
-1. [Security Policy](#security-policy)
-1. [Semantic Versioning Policy](#semantic-versioning-policy)
-1. [License](#license)
-1. [Team](#team)
-1. [Sponsors](#sponsors)
-1. [Technology Sponsors](#technology-sponsors)
+2. [Configuration](#configuration)
+3. [Code of Conduct](#code-of-conduct)
+4. [Filing Issues](#filing-issues)
+5. [Frequently Asked Questions](#frequently-asked-questions)
+6. [Releases](#releases)
+7. [Security Policy](#security-policy)
+8. [Semantic Versioning Policy](#semantic-versioning-policy)
+9. [Stylistic Rule Updates](#stylistic-rule-updates)
+10. [License](#license)
+11. [Team](#team)
+12. [Sponsors](#sponsors)
+13. [Technology Sponsors](#technology-sponsors)
## Installation and Usage
-Prerequisites: [Node.js](https://nodejs.org/) (`^18.18.0`, `^20.9.0`, or `>=21.1.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
+Prerequisites: [Node.js](https://nodejs.org/) (`^12.22.0`, `^14.17.0`, or `>=16.0.0`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
You can install and configure ESLint using this command:
```shell
-npm init @eslint/config@latest
+npm init @eslint/config
```
After that, you can run ESLint on any file or directory like this:
```shell
-npx eslint yourfile.js
+./node_modules/.bin/eslint yourfile.js
```
-### pnpm Installation
-
-To use ESLint with pnpm, we recommend setting up a `.npmrc` file with at least the following settings:
-
-```text
-auto-install-peers=true
-node-linker=hoisted
-```
-
-This ensures that pnpm installs dependencies in a way that is more compatible with npm and is less likely to produce errors.
-
## Configuration
-You can configure rules in your `eslint.config.js` files as in this example:
-
-```js
-import { defineConfig } from "eslint/config";
+After running `npm init @eslint/config`, you'll have an `.eslintrc` file in your directory. In it, you'll see some rules configured like this:
-export default defineConfig([
- {
- files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
- rules: {
- "prefer-const": "warn",
- "no-constant-binary-expression": "error",
- },
- },
-]);
+```json
+{
+ "rules": {
+ "semi": ["error", "always"],
+ "quotes": ["error", "double"]
+ }
+}
```
-The names `"prefer-const"` and `"no-constant-binary-expression"` are the names of [rules](https://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values:
+The names `"semi"` and `"quotes"` are the names of [rules](https://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values:
-- `"off"` or `0` - turn the rule off
-- `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
-- `"error"` or `2` - turn the rule on as an error (exit code will be 1)
+* `"off"` or `0` - turn the rule off
+* `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
+* `"error"` or `2` - turn the rule on as an error (exit code will be 1)
The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/latest/use/configure)).
-## Version Support
-
-The ESLint team provides ongoing support for the current version and six months of limited support for the previous version. Limited support includes critical bug fixes, security issues, and compatibility issues only.
-
-ESLint offers commercial support for both current and previous versions through our partners, [Tidelift][tidelift] and [HeroDevs][herodevs].
-
-See [Version Support](https://eslint.org/version-support) for more details.
-
## Code of Conduct
-ESLint adheres to the [OpenJS Foundation Code of Conduct](https://eslint.org/conduct).
+ESLint adheres to the [JS Foundation Code of Conduct](https://eslint.org/conduct).
## Filing Issues
Before filing an issue, please be sure to read the guidelines for what you're reporting:
-- [Bug Report](https://eslint.org/docs/latest/contribute/report-bugs)
-- [Propose a New Rule](https://eslint.org/docs/latest/contribute/propose-new-rule)
-- [Proposing a Rule Change](https://eslint.org/docs/latest/contribute/propose-rule-change)
-- [Request a Change](https://eslint.org/docs/latest/contribute/request-change)
+* [Bug Report](https://eslint.org/docs/latest/contribute/report-bugs)
+* [Propose a New Rule](https://eslint.org/docs/latest/contribute/propose-new-rule)
+* [Proposing a Rule Change](https://eslint.org/docs/latest/contribute/propose-rule-change)
+* [Request a Change](https://eslint.org/docs/latest/contribute/request-change)
## Frequently Asked Questions
-### Does ESLint support JSX?
+### I'm using JSCS, should I migrate to ESLint?
+
+Yes. [JSCS has reached end of life](https://eslint.org/blog/2016/07/jscs-end-of-life) and is no longer supported.
-Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/latest/use/configure)). Please note that supporting JSX syntax _is not_ the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
+We have prepared a [migration guide](https://eslint.org/docs/latest/use/migrating-from-jscs) to help you convert your JSCS settings to an ESLint configuration.
+
+We are now at or near 100% compatibility with JSCS. If you try ESLint and believe we are not yet compatible with a JSCS rule/configuration, please create an issue (mentioning that it is a JSCS compatibility issue) and we will evaluate it as per our normal process.
### Does Prettier replace ESLint?
-No, ESLint and Prettier have different jobs: ESLint is a linter (looking for problematic patterns) and Prettier is a code formatter. Using both tools is common, refer to [Prettier's documentation](https://prettier.io/docs/en/install#eslint-and-other-linters) to learn how to configure them to work well with each other.
+No, ESLint and Prettier have diffent jobs: ESLint is a linter (looking for problematic patterns) and Prettier is a code formatter. Using both tools is common, refer to [Prettier's documentation](https://prettier.io/docs/en/install#eslint-and-other-linters) to learn how to configure them to work well with each other.
+
+### Why can't ESLint find my plugins?
+
+* Make sure your plugins (and ESLint) are both in your project's `package.json` as devDependencies (or dependencies, if your project uses ESLint at runtime).
+* Make sure you have run `npm install` and all your dependencies are installed.
+* Make sure your plugins' peerDependencies have been installed as well. You can use `npm view eslint-plugin-myplugin peerDependencies` to see what peer dependencies `eslint-plugin-myplugin` has.
+
+### Does ESLint support JSX?
+
+Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/latest/use/configure)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
### What ECMAScript versions does ESLint support?
-ESLint has full support for ECMAScript 3, 5, and every year from 2015 up until the most recent stage 4 specification (the default). You can set your desired ECMAScript syntax and other settings (like global variables) through [configuration](https://eslint.org/docs/latest/use/configure).
+ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, and 2023. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).
### What about experimental features?
@@ -136,18 +127,6 @@ In other cases (including if rules need to warn on more or fewer cases due to ne
Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the [TC39 process](https://tc39.github.io/process-document/)), we will accept issues and pull requests related to the new feature, subject to our [contributing guidelines](https://eslint.org/docs/latest/contribute). Until then, please use the appropriate parser and plugin(s) for your experimental feature.
-### Which Node.js versions does ESLint support?
-
-ESLint updates the supported Node.js versions with each major release of ESLint. At that time, ESLint's supported Node.js versions are updated to be:
-
-1. The most recent maintenance release of Node.js
-1. The lowest minor version of the Node.js LTS release that includes the features the ESLint team wants to use.
-1. The Node.js Current release
-
-ESLint is also expected to work with Node.js versions released after the Node.js Current release.
-
-Refer to the [Quick Start Guide](https://eslint.org/docs/latest/use/getting-started#prerequisites) for the officially supported Node.js versions for a given ESLint release.
-
### Where to ask for help?
Open a [discussion](https://github.com/eslint/eslint/discussions) or stop by our [Discord server](https://eslint.org/chat).
@@ -174,58 +153,47 @@ ESLint takes security seriously. We work hard to ensure that ESLint is safe for
ESLint follows [semantic versioning](https://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:
-- Patch release (intended to not break your lint build)
- - A bug fix in a rule that results in ESLint reporting fewer linting errors.
- - A bug fix to the CLI or core (including formatters).
- - Improvements to documentation.
- - Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
- - Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
-- Minor release (might break your lint build)
- - A bug fix in a rule that results in ESLint reporting more linting errors.
- - A new rule is created.
- - A new option to an existing rule that does not result in ESLint reporting more linting errors by default.
- - A new addition to an existing rule to support a newly-added language feature (within the last 12 months) that will result in ESLint reporting more linting errors by default.
- - An existing rule is deprecated.
- - A new CLI capability is created.
- - New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
- - A new formatter is created.
- - `eslint:recommended` is updated and will result in strictly fewer linting errors (e.g., rule removals).
-- Major release (likely to break your lint build)
- - `eslint:recommended` is updated and may result in new linting errors (e.g., rule additions, most rule option updates).
- - A new option to an existing rule that results in ESLint reporting more linting errors by default.
- - An existing formatter is removed.
- - Part of the public API is removed or changed in an incompatible way. The public API includes:
- - Rule schemas
- - Configuration schema
- - Command-line options
- - Node.js API
- - Rule, formatter, parser, plugin APIs
+* Patch release (intended to not break your lint build)
+ * A bug fix in a rule that results in ESLint reporting fewer linting errors.
+ * A bug fix to the CLI or core (including formatters).
+ * Improvements to documentation.
+ * Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
+ * Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
+* Minor release (might break your lint build)
+ * A bug fix in a rule that results in ESLint reporting more linting errors.
+ * A new rule is created.
+ * A new option to an existing rule that does not result in ESLint reporting more linting errors by default.
+ * A new addition to an existing rule to support a newly-added language feature (within the last 12 months) that will result in ESLint reporting more linting errors by default.
+ * An existing rule is deprecated.
+ * A new CLI capability is created.
+ * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
+ * A new formatter is created.
+ * `eslint:recommended` is updated and will result in strictly fewer linting errors (e.g., rule removals).
+* Major release (likely to break your lint build)
+ * `eslint:recommended` is updated and may result in new linting errors (e.g., rule additions, most rule option updates).
+ * A new option to an existing rule that results in ESLint reporting more linting errors by default.
+ * An existing formatter is removed.
+ * Part of the public API is removed or changed in an incompatible way. The public API includes:
+ * Rule schemas
+ * Configuration schema
+ * Command-line options
+ * Node.js API
+ * Rule, formatter, parser, plugin APIs
According to our policy, any minor update may report more linting errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
-## License
-
-MIT License
+## Stylistic Rule Updates
-Copyright OpenJS Foundation and other contributors,
+Stylistic rules are frozen according to [our policy](https://eslint.org/blog/2020/05/changes-to-rules-policies) on how we evaluate new rules and rule changes.
+This means:
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+* **Bug fixes**: We will still fix bugs in stylistic rules.
+* **New ECMAScript features**: We will also make sure stylistic rules are compatible with new ECMAScript features.
+* **New options**: We will **not** add any new options to stylistic rules unless an option is the only way to fix a bug or support a newly-added ECMAScript feature.
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+## License
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
## Team
@@ -245,11 +213,6 @@ The people who manage releases, review feature requests, and meet regularly to e
Nicholas C. Zakas
-
-
-Francesco Trotta
-
- |

Milos Djermanovic
@@ -277,35 +240,25 @@ Nitin Kumar
The people who review and fix bugs and help triage issues.
### Website Team
@@ -319,8 +272,8 @@ Amaresh S M
|
-
-Harish
+
+Strek
|
@@ -331,24 +284,21 @@ Percy Ma
-
-
-
## Sponsors
-The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
-to get your logo on our READMEs and [website](https://eslint.org/sponsors).
+The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://opencollective.com/eslint) to get your logo on our README and website.
+
+
Platinum Sponsors
- 
Gold Sponsors
- 
Silver Sponsors
- 
Bronze Sponsors
- 
-Technology Sponsors
-Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
- 
-
+ 
Gold Sponsors
+ 
Silver Sponsors
+ 
Bronze Sponsors
+ 
-[tidelift]: https://tidelift.com/funding/github/npm/eslint
-[herodevs]: https://www.herodevs.com/support/eslint-nes?utm_source=ESLintWebsite&utm_medium=ESLintWebsite&utm_campaign=ESLintNES&utm_id=ESLintNES
+## Technology Sponsors
+
+* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
+* Hosting for ([eslint.org](https://eslint.org)) is sponsored by [Netlify](https://www.netlify.com)
+* Password management is sponsored by [1Password](https://www.1password.com)
diff --git a/node_modules/eslint/bin/eslint.js b/node_modules/eslint/bin/eslint.js
index 9b202a982..eeb4647e7 100755
--- a/node_modules/eslint/bin/eslint.js
+++ b/node_modules/eslint/bin/eslint.js
@@ -9,14 +9,9 @@
"use strict";
-const mod = require("node:module");
-
-// to use V8's code cache to speed up instantiation time
-mod.enableCompileCache?.();
-
// must do this initialization *before* other requires in order to work
if (process.argv.includes("--debug")) {
- require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");
+ require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");
}
//------------------------------------------------------------------------------
@@ -45,20 +40,20 @@ if (process.argv.includes("--debug")) {
* @returns {Promise} The read text.
*/
function readStdin() {
- return new Promise((resolve, reject) => {
- let content = "";
- let chunk = "";
-
- process.stdin
- .setEncoding("utf8")
- .on("readable", () => {
- while ((chunk = process.stdin.read()) !== null) {
- content += chunk;
- }
- })
- .on("end", () => resolve(content))
- .on("error", reject);
- });
+ return new Promise((resolve, reject) => {
+ let content = "";
+ let chunk = "";
+
+ process.stdin
+ .setEncoding("utf8")
+ .on("readable", () => {
+ while ((chunk = process.stdin.read()) !== null) {
+ content += chunk;
+ }
+ })
+ .on("end", () => resolve(content))
+ .on("error", reject);
+ });
}
/**
@@ -67,32 +62,34 @@ function readStdin() {
* @returns {string} The error message.
*/
function getErrorMessage(error) {
- // Lazy loading because this is used only if an error happened.
- const util = require("node:util");
-
- // Foolproof -- third-party module might throw non-object.
- if (typeof error !== "object" || error === null) {
- return String(error);
- }
-
- // Use templates if `error.messageTemplate` is present.
- if (typeof error.messageTemplate === "string") {
- try {
- const template = require(`../messages/${error.messageTemplate}.js`);
-
- return template(error.messageData || {});
- } catch {
- // Ignore template error then fallback to use `error.stack`.
- }
- }
-
- // Use the stacktrace if it's an error object.
- if (typeof error.stack === "string") {
- return error.stack;
- }
-
- // Otherwise, dump the object.
- return util.format("%o", error);
+
+ // Lazy loading because this is used only if an error happened.
+ const util = require("util");
+
+ // Foolproof -- third-party module might throw non-object.
+ if (typeof error !== "object" || error === null) {
+ return String(error);
+ }
+
+ // Use templates if `error.messageTemplate` is present.
+ if (typeof error.messageTemplate === "string") {
+ try {
+ const template = require(`../messages/${error.messageTemplate}.js`);
+
+ return template(error.messageData || {});
+ } catch {
+
+ // Ignore template error then fallback to use `error.stack`.
+ }
+ }
+
+ // Use the stacktrace if it's an error object.
+ if (typeof error.stack === "string") {
+ return error.stack;
+ }
+
+ // Otherwise, dump the object.
+ return util.format("%o", error);
}
/**
@@ -114,21 +111,21 @@ let hadFatalError = false;
* @returns {void}
*/
function onFatalError(error) {
- process.exitCode = 2;
- hadFatalError = true;
+ process.exitCode = 2;
+ hadFatalError = true;
- const { version } = require("../package.json");
- const message = `
+ const { version } = require("../package.json");
+ const message = `
Oops! Something went wrong! :(
ESLint: ${version}
${getErrorMessage(error)}`;
- if (!displayedErrors.has(message)) {
- console.error(message);
- displayedErrors.add(message);
- }
+ if (!displayedErrors.has(message)) {
+ console.error(message);
+ displayedErrors.add(message);
+ }
}
//------------------------------------------------------------------------------
@@ -136,61 +133,41 @@ ${getErrorMessage(error)}`;
//------------------------------------------------------------------------------
(async function main() {
- process.on("uncaughtException", onFatalError);
- process.on("unhandledRejection", onFatalError);
-
- // Call the config initializer if `--init` is present.
- if (process.argv.includes("--init")) {
- // `eslint --init` has been moved to `@eslint/create-config`
- console.warn(
- "You can also run this command directly using 'npm init @eslint/config@latest'.",
- );
-
- const spawn = require("cross-spawn");
-
- spawn.sync("npm", ["init", "@eslint/config@latest"], {
- encoding: "utf8",
- stdio: "inherit",
- });
- return;
- }
-
- // start the MCP server if `--mcp` is present
- if (process.argv.includes("--mcp")) {
- console.warn(
- "You can also run this command directly using 'npx @eslint/mcp@latest'.",
- );
-
- const spawn = require("cross-spawn");
-
- spawn.sync("npx", ["@eslint/mcp@latest"], {
- encoding: "utf8",
- stdio: "inherit",
- });
- return;
- }
-
- // Otherwise, call the CLI.
- const cli = require("../lib/cli");
- const exitCode = await cli.execute(
- process.argv,
- process.argv.includes("--stdin") ? await readStdin() : null,
- true,
- );
-
- /*
- * If an uncaught exception or unhandled rejection was detected in the meantime,
- * keep the fatal exit code 2 that is already assigned to `process.exitCode`.
- * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with
- * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).
- * This ensures that unexpected errors that seemingly don't affect the success
- * of the execution will still cause a non-zero exit code, as it's a common
- * practice and the default behavior of Node.js to exit with non-zero
- * in case of an uncaught exception or unhandled rejection.
- *
- * Otherwise, assign the exit code returned from CLI.
- */
- if (!hadFatalError) {
- process.exitCode = exitCode;
- }
-})().catch(onFatalError);
+ process.on("uncaughtException", onFatalError);
+ process.on("unhandledRejection", onFatalError);
+
+ // Call the config initializer if `--init` is present.
+ if (process.argv.includes("--init")) {
+
+ // `eslint --init` has been moved to `@eslint/create-config`
+ console.warn("You can also run this command directly using 'npm init @eslint/config'.");
+
+ const spawn = require("cross-spawn");
+
+ spawn.sync("npm", ["init", "@eslint/config"], { encoding: "utf8", stdio: "inherit" });
+ return;
+ }
+
+ // Otherwise, call the CLI.
+ const exitCode = await require("../lib/cli").execute(
+ process.argv,
+ process.argv.includes("--stdin") ? await readStdin() : null,
+ true
+ );
+
+ /*
+ * If an uncaught exception or unhandled rejection was detected in the meantime,
+ * keep the fatal exit code 2 that is already assigned to `process.exitCode`.
+ * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with
+ * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).
+ * This ensures that unexpected errors that seemingly don't affect the success
+ * of the execution will still cause a non-zero exit code, as it's a common
+ * practice and the default behavior of Node.js to exit with non-zero
+ * in case of an uncaught exception or unhandled rejection.
+ *
+ * Otherwise, assign the exit code returned from CLI.
+ */
+ if (!hadFatalError) {
+ process.exitCode = exitCode;
+ }
+}()).catch(onFatalError);
diff --git a/node_modules/eslint/conf/default-cli-options.js b/node_modules/eslint/conf/default-cli-options.js
index dda88d655..dad03d89e 100644
--- a/node_modules/eslint/conf/default-cli-options.js
+++ b/node_modules/eslint/conf/default-cli-options.js
@@ -6,27 +6,27 @@
"use strict";
module.exports = {
- configFile: null,
- baseConfig: false,
- rulePaths: [],
- useEslintrc: true,
- envs: [],
- globals: [],
- extensions: null,
- ignore: true,
- ignorePath: void 0,
- cache: false,
+ configFile: null,
+ baseConfig: false,
+ rulePaths: [],
+ useEslintrc: true,
+ envs: [],
+ globals: [],
+ extensions: null,
+ ignore: true,
+ ignorePath: void 0,
+ cache: false,
- /*
- * in order to honor the cacheFile option if specified
- * this option should not have a default value otherwise
- * it will always be used
- */
- cacheLocation: "",
- cacheFile: ".eslintcache",
- cacheStrategy: "metadata",
- fix: false,
- allowInlineConfig: true,
- reportUnusedDisableDirectives: void 0,
- globInputPaths: true,
+ /*
+ * in order to honor the cacheFile option if specified
+ * this option should not have a default value otherwise
+ * it will always be used
+ */
+ cacheLocation: "",
+ cacheFile: ".eslintcache",
+ cacheStrategy: "metadata",
+ fix: false,
+ allowInlineConfig: true,
+ reportUnusedDisableDirectives: void 0,
+ globInputPaths: true
};
diff --git a/node_modules/eslint/conf/ecma-version.js b/node_modules/eslint/conf/ecma-version.js
deleted file mode 100644
index e68d30206..000000000
--- a/node_modules/eslint/conf/ecma-version.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @fileoverview Configuration related to ECMAScript versions
- * @author Milos Djermanovic
- */
-
-"use strict";
-
-/**
- * The latest ECMAScript version supported by ESLint.
- * @type {number} year-based ECMAScript version
- */
-const LATEST_ECMA_VERSION = 2026;
-
-module.exports = {
- LATEST_ECMA_VERSION,
-};
diff --git a/node_modules/eslint/conf/globals.js b/node_modules/eslint/conf/globals.js
index b630b272a..58710e05b 100644
--- a/node_modules/eslint/conf/globals.js
+++ b/node_modules/eslint/conf/globals.js
@@ -10,160 +10,145 @@
//-----------------------------------------------------------------------------
const commonjs = {
- exports: true,
- global: false,
- module: false,
- require: false,
+ exports: true,
+ global: false,
+ module: false,
+ require: false
};
const es3 = {
- Array: false,
- Boolean: false,
- constructor: false,
- Date: false,
- decodeURI: false,
- decodeURIComponent: false,
- encodeURI: false,
- encodeURIComponent: false,
- Error: false,
- escape: false,
- eval: false,
- EvalError: false,
- Function: false,
- hasOwnProperty: false,
- Infinity: false,
- isFinite: false,
- isNaN: false,
- isPrototypeOf: false,
- Math: false,
- NaN: false,
- Number: false,
- Object: false,
- parseFloat: false,
- parseInt: false,
- propertyIsEnumerable: false,
- RangeError: false,
- ReferenceError: false,
- RegExp: false,
- String: false,
- SyntaxError: false,
- toLocaleString: false,
- toString: false,
- TypeError: false,
- undefined: false,
- unescape: false,
- URIError: false,
- valueOf: false,
+ Array: false,
+ Boolean: false,
+ constructor: false,
+ Date: false,
+ decodeURI: false,
+ decodeURIComponent: false,
+ encodeURI: false,
+ encodeURIComponent: false,
+ Error: false,
+ escape: false,
+ eval: false,
+ EvalError: false,
+ Function: false,
+ hasOwnProperty: false,
+ Infinity: false,
+ isFinite: false,
+ isNaN: false,
+ isPrototypeOf: false,
+ Math: false,
+ NaN: false,
+ Number: false,
+ Object: false,
+ parseFloat: false,
+ parseInt: false,
+ propertyIsEnumerable: false,
+ RangeError: false,
+ ReferenceError: false,
+ RegExp: false,
+ String: false,
+ SyntaxError: false,
+ toLocaleString: false,
+ toString: false,
+ TypeError: false,
+ undefined: false,
+ unescape: false,
+ URIError: false,
+ valueOf: false
};
const es5 = {
- ...es3,
- JSON: false,
+ ...es3,
+ JSON: false
};
const es2015 = {
- ...es5,
- ArrayBuffer: false,
- DataView: false,
- Float32Array: false,
- Float64Array: false,
- Int16Array: false,
- Int32Array: false,
- Int8Array: false,
- Intl: false,
- Map: false,
- Promise: false,
- Proxy: false,
- Reflect: false,
- Set: false,
- Symbol: false,
- Uint16Array: false,
- Uint32Array: false,
- Uint8Array: false,
- Uint8ClampedArray: false,
- WeakMap: false,
- WeakSet: false,
+ ...es5,
+ ArrayBuffer: false,
+ DataView: false,
+ Float32Array: false,
+ Float64Array: false,
+ Int16Array: false,
+ Int32Array: false,
+ Int8Array: false,
+ Map: false,
+ Promise: false,
+ Proxy: false,
+ Reflect: false,
+ Set: false,
+ Symbol: false,
+ Uint16Array: false,
+ Uint32Array: false,
+ Uint8Array: false,
+ Uint8ClampedArray: false,
+ WeakMap: false,
+ WeakSet: false
};
// no new globals in ES2016
const es2016 = {
- ...es2015,
+ ...es2015
};
const es2017 = {
- ...es2016,
- Atomics: false,
- SharedArrayBuffer: false,
+ ...es2016,
+ Atomics: false,
+ SharedArrayBuffer: false
};
// no new globals in ES2018
const es2018 = {
- ...es2017,
+ ...es2017
};
// no new globals in ES2019
const es2019 = {
- ...es2018,
+ ...es2018
};
const es2020 = {
- ...es2019,
- BigInt: false,
- BigInt64Array: false,
- BigUint64Array: false,
- globalThis: false,
+ ...es2019,
+ BigInt: false,
+ BigInt64Array: false,
+ BigUint64Array: false,
+ globalThis: false
};
const es2021 = {
- ...es2020,
- AggregateError: false,
- FinalizationRegistry: false,
- WeakRef: false,
+ ...es2020,
+ AggregateError: false,
+ FinalizationRegistry: false,
+ WeakRef: false
};
const es2022 = {
- ...es2021,
+ ...es2021
};
const es2023 = {
- ...es2022,
+ ...es2022
};
const es2024 = {
- ...es2023,
+ ...es2023
};
-const es2025 = {
- ...es2024,
- Float16Array: false,
- Iterator: false,
-};
-
-const es2026 = {
- ...es2025,
- AsyncDisposableStack: false,
- DisposableStack: false,
- SuppressedError: false,
-};
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
module.exports = {
- commonjs,
- es3,
- es5,
- es2015,
- es2016,
- es2017,
- es2018,
- es2019,
- es2020,
- es2021,
- es2022,
- es2023,
- es2024,
- es2025,
- es2026,
+ commonjs,
+ es3,
+ es5,
+ es2015,
+ es2016,
+ es2017,
+ es2018,
+ es2019,
+ es2020,
+ es2021,
+ es2022,
+ es2023,
+ es2024
};
diff --git a/node_modules/eslint/conf/replacements.json b/node_modules/eslint/conf/replacements.json
index 27329c4c9..c047811e6 100644
--- a/node_modules/eslint/conf/replacements.json
+++ b/node_modules/eslint/conf/replacements.json
@@ -1,26 +1,22 @@
{
- "rules": {
- "generator-star": ["generator-star-spacing"],
- "global-strict": ["strict"],
- "no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"],
- "no-comma-dangle": ["comma-dangle"],
- "no-empty-class": ["no-empty-character-class"],
- "no-empty-label": ["no-labels"],
- "no-extra-strict": ["strict"],
- "no-reserved-keys": ["quote-props"],
- "no-space-before-semi": ["semi-spacing"],
- "no-wrap-func": ["no-extra-parens"],
- "space-after-function-name": ["space-before-function-paren"],
- "space-after-keywords": ["keyword-spacing"],
- "space-before-function-parentheses": ["space-before-function-paren"],
- "space-before-keywords": ["keyword-spacing"],
- "space-in-brackets": [
- "object-curly-spacing",
- "array-bracket-spacing",
- "computed-property-spacing"
- ],
- "space-return-throw-case": ["keyword-spacing"],
- "space-unary-word-ops": ["space-unary-ops"],
- "spaced-line-comment": ["spaced-comment"]
- }
+ "rules": {
+ "generator-star": ["generator-star-spacing"],
+ "global-strict": ["strict"],
+ "no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"],
+ "no-comma-dangle": ["comma-dangle"],
+ "no-empty-class": ["no-empty-character-class"],
+ "no-empty-label": ["no-labels"],
+ "no-extra-strict": ["strict"],
+ "no-reserved-keys": ["quote-props"],
+ "no-space-before-semi": ["semi-spacing"],
+ "no-wrap-func": ["no-extra-parens"],
+ "space-after-function-name": ["space-before-function-paren"],
+ "space-after-keywords": ["keyword-spacing"],
+ "space-before-function-parentheses": ["space-before-function-paren"],
+ "space-before-keywords": ["keyword-spacing"],
+ "space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"],
+ "space-return-throw-case": ["keyword-spacing"],
+ "space-unary-word-ops": ["space-unary-ops"],
+ "spaced-line-comment": ["spaced-comment"]
+ }
}
diff --git a/node_modules/eslint/conf/rule-type-list.json b/node_modules/eslint/conf/rule-type-list.json
index 05ddd3cb0..6ca730f34 100644
--- a/node_modules/eslint/conf/rule-type-list.json
+++ b/node_modules/eslint/conf/rule-type-list.json
@@ -1,91 +1,28 @@
{
- "types": {
- "problem": [],
- "suggestion": [],
- "layout": []
- },
- "deprecated": [],
- "removed": [
- {
- "removed": "generator-star",
- "replacedBy": [{ "rule": { "name": "generator-star-spacing" } }]
- },
- {
- "removed": "global-strict",
- "replacedBy": [{ "rule": { "name": "strict" } }]
- },
- {
- "removed": "no-arrow-condition",
- "replacedBy": [
- { "rule": { "name": "no-confusing-arrow" } },
- { "rule": { "name": "no-constant-condition" } }
- ]
- },
- {
- "removed": "no-comma-dangle",
- "replacedBy": [{ "rule": { "name": "comma-dangle" } }]
- },
- {
- "removed": "no-empty-class",
- "replacedBy": [{ "rule": { "name": "no-empty-character-class" } }]
- },
- {
- "removed": "no-empty-label",
- "replacedBy": [{ "rule": { "name": "no-labels" } }]
- },
- {
- "removed": "no-extra-strict",
- "replacedBy": [{ "rule": { "name": "strict" } }]
- },
- {
- "removed": "no-reserved-keys",
- "replacedBy": [{ "rule": { "name": "quote-props" } }]
- },
- {
- "removed": "no-space-before-semi",
- "replacedBy": [{ "rule": { "name": "semi-spacing" } }]
- },
- {
- "removed": "no-wrap-func",
- "replacedBy": [{ "rule": { "name": "no-extra-parens" } }]
- },
- {
- "removed": "space-after-function-name",
- "replacedBy": [{ "rule": { "name": "space-before-function-paren" } }]
- },
- {
- "removed": "space-after-keywords",
- "replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
- },
- {
- "removed": "space-before-function-parentheses",
- "replacedBy": [{ "rule": { "name": "space-before-function-paren" } }]
- },
- {
- "removed": "space-before-keywords",
- "replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
- },
- {
- "removed": "space-in-brackets",
- "replacedBy": [
- { "rule": { "name": "object-curly-spacing" } },
- { "rule": { "name": "array-bracket-spacing" } },
- { "rule": { "name": "computed-property-spacing" } }
- ]
- },
- {
- "removed": "space-return-throw-case",
- "replacedBy": [{ "rule": { "name": "keyword-spacing" } }]
- },
- {
- "removed": "space-unary-word-ops",
- "replacedBy": [{ "rule": { "name": "space-unary-ops" } }]
- },
- {
- "removed": "spaced-line-comment",
- "replacedBy": [{ "rule": { "name": "spaced-comment" } }]
- },
- { "removed": "valid-jsdoc", "replacedBy": [] },
- { "removed": "require-jsdoc", "replacedBy": [] }
- ]
+ "types": {
+ "problem": [],
+ "suggestion": [],
+ "layout": []
+ },
+ "deprecated": [],
+ "removed": [
+ { "removed": "generator-star", "replacedBy": ["generator-star-spacing"] },
+ { "removed": "global-strict", "replacedBy": ["strict"] },
+ { "removed": "no-arrow-condition", "replacedBy": ["no-confusing-arrow", "no-constant-condition"] },
+ { "removed": "no-comma-dangle", "replacedBy": ["comma-dangle"] },
+ { "removed": "no-empty-class", "replacedBy": ["no-empty-character-class"] },
+ { "removed": "no-empty-label", "replacedBy": ["no-labels"] },
+ { "removed": "no-extra-strict", "replacedBy": ["strict"] },
+ { "removed": "no-reserved-keys", "replacedBy": ["quote-props"] },
+ { "removed": "no-space-before-semi", "replacedBy": ["semi-spacing"] },
+ { "removed": "no-wrap-func", "replacedBy": ["no-extra-parens"] },
+ { "removed": "space-after-function-name", "replacedBy": ["space-before-function-paren"] },
+ { "removed": "space-after-keywords", "replacedBy": ["keyword-spacing"] },
+ { "removed": "space-before-function-parentheses", "replacedBy": ["space-before-function-paren"] },
+ { "removed": "space-before-keywords", "replacedBy": ["keyword-spacing"] },
+ { "removed": "space-in-brackets", "replacedBy": ["object-curly-spacing", "array-bracket-spacing"] },
+ { "removed": "space-return-throw-case", "replacedBy": ["keyword-spacing"] },
+ { "removed": "space-unary-word-ops", "replacedBy": ["space-unary-ops"] },
+ { "removed": "spaced-line-comment", "replacedBy": ["spaced-comment"] }
+ ]
}
diff --git a/node_modules/eslint/lib/api.js b/node_modules/eslint/lib/api.js
index ce6102dad..cbaac8fef 100644
--- a/node_modules/eslint/lib/api.js
+++ b/node_modules/eslint/lib/api.js
@@ -9,11 +9,11 @@
// Requirements
//-----------------------------------------------------------------------------
-const { ESLint, shouldUseFlatConfig } = require("./eslint/eslint");
-const { LegacyESLint } = require("./eslint/legacy-eslint");
+const { ESLint, FlatESLint } = require("./eslint");
+const { shouldUseFlatConfig } = require("./eslint/flat-eslint");
const { Linter } = require("./linter");
const { RuleTester } = require("./rule-tester");
-const { SourceCode } = require("./languages/js/source-code");
+const { SourceCode } = require("./source-code");
//-----------------------------------------------------------------------------
// Functions
@@ -23,18 +23,22 @@ const { SourceCode } = require("./languages/js/source-code");
* Loads the correct ESLint constructor given the options.
* @param {Object} [options] The options object
* @param {boolean} [options.useFlatConfig] Whether or not to use a flat config
+ * @param {string} [options.cwd] The current working directory
* @returns {Promise} The ESLint constructor
*/
-async function loadESLint({ useFlatConfig } = {}) {
- /*
- * Note: The v8.x version of this function also accepted a `cwd` option, but
- * it is not used in this implementation so we silently ignore it.
- */
+async function loadESLint({ useFlatConfig, cwd = process.cwd() } = {}) {
- const shouldESLintUseFlatConfig =
- useFlatConfig ?? (await shouldUseFlatConfig());
+ /*
+ * Note: The v9.x version of this function doesn't have a cwd option
+ * because it's not used. It's only used in the v8.x version of this
+ * function.
+ */
- return shouldESLintUseFlatConfig ? ESLint : LegacyESLint;
+ const shouldESLintUseFlatConfig = typeof useFlatConfig === "boolean"
+ ? useFlatConfig
+ : await shouldUseFlatConfig({ cwd });
+
+ return shouldESLintUseFlatConfig ? FlatESLint : ESLint;
}
//-----------------------------------------------------------------------------
@@ -42,9 +46,9 @@ async function loadESLint({ useFlatConfig } = {}) {
//-----------------------------------------------------------------------------
module.exports = {
- Linter,
- loadESLint,
- ESLint,
- RuleTester,
- SourceCode,
+ Linter,
+ loadESLint,
+ ESLint,
+ RuleTester,
+ SourceCode
};
diff --git a/node_modules/eslint/lib/cli-engine/cli-engine.js b/node_modules/eslint/lib/cli-engine/cli-engine.js
index a0c3bc67b..49c8902c1 100644
--- a/node_modules/eslint/lib/cli-engine/cli-engine.js
+++ b/node_modules/eslint/lib/cli-engine/cli-engine.js
@@ -15,20 +15,21 @@
// Requirements
//------------------------------------------------------------------------------
-const fs = require("node:fs");
-const path = require("node:path");
+const fs = require("fs");
+const path = require("path");
const defaultOptions = require("../../conf/default-cli-options");
const pkg = require("../../package.json");
+
const {
- Legacy: {
- ConfigOps,
- naming,
- CascadingConfigArrayFactory,
- IgnorePattern,
- getUsedExtractedConfigs,
- ModuleResolver,
- },
+ Legacy: {
+ ConfigOps,
+ naming,
+ CascadingConfigArrayFactory,
+ IgnorePattern,
+ getUsedExtractedConfigs,
+ ModuleResolver
+ }
} = require("@eslint/eslintrc");
const { FileEnumerator } = require("./file-enumerator");
@@ -40,17 +41,6 @@ const hash = require("./hash");
const LintResultCache = require("./lint-result-cache");
const debug = require("debug")("eslint:cli-engine");
-const removedFormatters = new Set([
- "checkstyle",
- "codeframe",
- "compact",
- "jslint-xml",
- "junit",
- "table",
- "tap",
- "unix",
- "visualstudio",
-]);
const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
//------------------------------------------------------------------------------
@@ -58,15 +48,15 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
//------------------------------------------------------------------------------
// For VSCode IntelliSense
-/** @typedef {import("../types").ESLint.ConfigData} ConfigData */
-/** @typedef {import("../types").ESLint.DeprecatedRuleUse} DeprecatedRuleInfo */
-/** @typedef {import("../types").ESLint.FormatterFunction} FormatterFunction */
-/** @typedef {import("../types").Linter.LintMessage} LintMessage */
-/** @typedef {import("../types").Linter.ParserOptions} ParserOptions */
-/** @typedef {import("../types").ESLint.Plugin} Plugin */
-/** @typedef {import("../types").Rule.RuleModule} Rule */
-/** @typedef {import("../types").Linter.RuleEntry} RuleConf */
-/** @typedef {import("../types").Linter.SuppressedLintMessage} SuppressedLintMessage */
+/** @typedef {import("../shared/types").ConfigData} ConfigData */
+/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
+/** @typedef {import("../shared/types").LintMessage} LintMessage */
+/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */
+/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
+/** @typedef {import("../shared/types").Plugin} Plugin */
+/** @typedef {import("../shared/types").RuleConf} RuleConf */
+/** @typedef {import("../shared/types").Rule} Rule */
+/** @typedef {import("../shared/types").FormatterFunction} FormatterFunction */
/** @typedef {ReturnType} ConfigArray */
/** @typedef {ReturnType} ExtractedConfig */
@@ -154,11 +144,11 @@ const internalSlotsMap = new WeakMap();
* @throws {Error} If an invalid fix type is found.
*/
function validateFixTypes(fixTypes) {
- for (const fixType of fixTypes) {
- if (!validFixTypes.has(fixType)) {
- throw new Error(`Invalid fix type "${fixType}" found.`);
- }
- }
+ for (const fixType of fixTypes) {
+ if (!validFixTypes.has(fixType)) {
+ throw new Error(`Invalid fix type "${fixType}" found.`);
+ }
+ }
}
/**
@@ -168,33 +158,33 @@ function validateFixTypes(fixTypes) {
* @private
*/
function calculateStatsPerFile(messages) {
- const stat = {
- errorCount: 0,
- fatalErrorCount: 0,
- warningCount: 0,
- fixableErrorCount: 0,
- fixableWarningCount: 0,
- };
-
- for (let i = 0; i < messages.length; i++) {
- const message = messages[i];
-
- if (message.fatal || message.severity === 2) {
- stat.errorCount++;
- if (message.fatal) {
- stat.fatalErrorCount++;
- }
- if (message.fix) {
- stat.fixableErrorCount++;
- }
- } else {
- stat.warningCount++;
- if (message.fix) {
- stat.fixableWarningCount++;
- }
- }
- }
- return stat;
+ const stat = {
+ errorCount: 0,
+ fatalErrorCount: 0,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
+ };
+
+ for (let i = 0; i < messages.length; i++) {
+ const message = messages[i];
+
+ if (message.fatal || message.severity === 2) {
+ stat.errorCount++;
+ if (message.fatal) {
+ stat.fatalErrorCount++;
+ }
+ if (message.fix) {
+ stat.fixableErrorCount++;
+ }
+ } else {
+ stat.warningCount++;
+ if (message.fix) {
+ stat.fixableWarningCount++;
+ }
+ }
+ }
+ return stat;
}
/**
@@ -204,25 +194,25 @@ function calculateStatsPerFile(messages) {
* @private
*/
function calculateStatsPerRun(results) {
- const stat = {
- errorCount: 0,
- fatalErrorCount: 0,
- warningCount: 0,
- fixableErrorCount: 0,
- fixableWarningCount: 0,
- };
-
- for (let i = 0; i < results.length; i++) {
- const result = results[i];
-
- stat.errorCount += result.errorCount;
- stat.fatalErrorCount += result.fatalErrorCount;
- stat.warningCount += result.warningCount;
- stat.fixableErrorCount += result.fixableErrorCount;
- stat.fixableWarningCount += result.fixableWarningCount;
- }
-
- return stat;
+ const stat = {
+ errorCount: 0,
+ fatalErrorCount: 0,
+ warningCount: 0,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
+ };
+
+ for (let i = 0; i < results.length; i++) {
+ const result = results[i];
+
+ stat.errorCount += result.errorCount;
+ stat.fatalErrorCount += result.fatalErrorCount;
+ stat.warningCount += result.warningCount;
+ stat.fixableErrorCount += result.fixableErrorCount;
+ stat.fixableWarningCount += result.fixableWarningCount;
+ }
+
+ return stat;
}
/**
@@ -241,62 +231,65 @@ function calculateStatsPerRun(results) {
* @private
*/
function verifyText({
- text,
- cwd,
- filePath: providedFilePath,
- config,
- fix,
- allowInlineConfig,
- reportUnusedDisableDirectives,
- fileEnumerator,
- linter,
+ text,
+ cwd,
+ filePath: providedFilePath,
+ config,
+ fix,
+ allowInlineConfig,
+ reportUnusedDisableDirectives,
+ fileEnumerator,
+ linter
}) {
- const filePath = providedFilePath || "";
-
- debug(`Lint ${filePath}`);
-
- /*
- * Verify.
- * `config.extractConfig(filePath)` requires an absolute path, but `linter`
- * doesn't know CWD, so it gives `linter` an absolute path always.
- */
- const filePathToVerify =
- filePath === "" ? path.join(cwd, filePath) : filePath;
- const { fixed, messages, output } = linter.verifyAndFix(text, config, {
- allowInlineConfig,
- filename: filePathToVerify,
- fix,
- reportUnusedDisableDirectives,
-
- /**
- * Check if the linter should adopt a given code block or not.
- * @param {string} blockFilename The virtual filename of a code block.
- * @returns {boolean} `true` if the linter should adopt the code block.
- */
- filterCodeBlock(blockFilename) {
- return fileEnumerator.isTargetPath(blockFilename);
- },
- });
-
- // Tweak and return.
- const result = {
- filePath,
- messages,
- suppressedMessages: linter.getSuppressedMessages(),
- ...calculateStatsPerFile(messages),
- };
-
- if (fixed) {
- result.output = output;
- }
- if (
- result.errorCount + result.warningCount > 0 &&
- typeof result.output === "undefined"
- ) {
- result.source = text;
- }
-
- return result;
+ const filePath = providedFilePath || "";
+
+ debug(`Lint ${filePath}`);
+
+ /*
+ * Verify.
+ * `config.extractConfig(filePath)` requires an absolute path, but `linter`
+ * doesn't know CWD, so it gives `linter` an absolute path always.
+ */
+ const filePathToVerify = filePath === "" ? path.join(cwd, filePath) : filePath;
+ const { fixed, messages, output } = linter.verifyAndFix(
+ text,
+ config,
+ {
+ allowInlineConfig,
+ filename: filePathToVerify,
+ fix,
+ reportUnusedDisableDirectives,
+
+ /**
+ * Check if the linter should adopt a given code block or not.
+ * @param {string} blockFilename The virtual filename of a code block.
+ * @returns {boolean} `true` if the linter should adopt the code block.
+ */
+ filterCodeBlock(blockFilename) {
+ return fileEnumerator.isTargetPath(blockFilename);
+ }
+ }
+ );
+
+ // Tweak and return.
+ const result = {
+ filePath,
+ messages,
+ suppressedMessages: linter.getSuppressedMessages(),
+ ...calculateStatsPerFile(messages)
+ };
+
+ if (fixed) {
+ result.output = output;
+ }
+ if (
+ result.errorCount + result.warningCount > 0 &&
+ typeof result.output === "undefined"
+ ) {
+ result.source = text;
+ }
+
+ return result;
}
/**
@@ -307,42 +300,37 @@ function verifyText({
* @private
*/
function createIgnoreResult(filePath, baseDir) {
- let message;
- const isHidden = filePath
- .split(path.sep)
- .find(segment => /^\./u.test(segment));
- const isInNodeModules =
- baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
-
- if (isHidden) {
- message =
- "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!'\") to override.";
- } else if (isInNodeModules) {
- message =
- "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
- } else {
- message =
- 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.';
- }
-
- return {
- filePath: path.resolve(filePath),
- messages: [
- {
- ruleId: null,
- fatal: false,
- severity: 1,
- message,
- nodeType: null,
- },
- ],
- suppressedMessages: [],
- errorCount: 0,
- fatalErrorCount: 0,
- warningCount: 1,
- fixableErrorCount: 0,
- fixableWarningCount: 0,
- };
+ let message;
+ const isHidden = filePath.split(path.sep)
+ .find(segment => /^\./u.test(segment));
+ const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules");
+
+ if (isHidden) {
+ message = "File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!'\") to override.";
+ } else if (isInNodeModules) {
+ message = "File ignored by default. Use \"--ignore-pattern '!node_modules/*'\" to override.";
+ } else {
+ message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
+ }
+
+ return {
+ filePath: path.resolve(filePath),
+ messages: [
+ {
+ ruleId: null,
+ fatal: false,
+ severity: 1,
+ message,
+ nodeType: null
+ }
+ ],
+ suppressedMessages: [],
+ errorCount: 0,
+ fatalErrorCount: 0,
+ warningCount: 1,
+ fixableErrorCount: 0,
+ fixableWarningCount: 0
+ };
}
/**
@@ -352,14 +340,14 @@ function createIgnoreResult(filePath, baseDir) {
* @returns {Rule|null} The rule or null.
*/
function getRule(ruleId, configArrays) {
- for (const configArray of configArrays) {
- const rule = configArray.pluginRules.get(ruleId);
-
- if (rule) {
- return rule;
- }
- }
- return builtInRules.get(ruleId) || null;
+ for (const configArray of configArrays) {
+ const rule = configArray.pluginRules.get(ruleId);
+
+ if (rule) {
+ return rule;
+ }
+ }
+ return builtInRules.get(ruleId) || null;
}
/**
@@ -370,13 +358,13 @@ function getRule(ruleId, configArrays) {
* @returns {boolean} Whether the message should be fixed.
*/
function shouldMessageBeFixed(message, lastConfigArrays, fixTypes) {
- if (!message.ruleId) {
- return fixTypes.has("directive");
- }
+ if (!message.ruleId) {
+ return fixTypes.has("directive");
+ }
- const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays);
+ const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays);
- return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type));
+ return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type));
}
/**
@@ -384,40 +372,41 @@ function shouldMessageBeFixed(message, lastConfigArrays, fixTypes) {
* @param {ConfigArray[]} usedConfigArrays The config arrays which were used.
* @returns {IterableIterator} Used deprecated rules.
*/
-function* iterateRuleDeprecationWarnings(usedConfigArrays) {
- const processedRuleIds = new Set();
-
- // Flatten used configs.
- /** @type {ExtractedConfig[]} */
- const configs = usedConfigArrays.flatMap(getUsedExtractedConfigs);
-
- // Traverse rule configs.
- for (const config of configs) {
- for (const [ruleId, ruleConfig] of Object.entries(config.rules)) {
- // Skip if it was processed.
- if (processedRuleIds.has(ruleId)) {
- continue;
- }
- processedRuleIds.add(ruleId);
-
- // Skip if it's not used.
- if (!ConfigOps.getRuleSeverity(ruleConfig)) {
- continue;
- }
- const rule = getRule(ruleId, usedConfigArrays);
-
- // Skip if it's not deprecated.
- if (!(rule && rule.meta && rule.meta.deprecated)) {
- continue;
- }
-
- // This rule was used and deprecated.
- yield {
- ruleId,
- replacedBy: rule.meta.replacedBy || [],
- };
- }
- }
+function *iterateRuleDeprecationWarnings(usedConfigArrays) {
+ const processedRuleIds = new Set();
+
+ // Flatten used configs.
+ /** @type {ExtractedConfig[]} */
+ const configs = usedConfigArrays.flatMap(getUsedExtractedConfigs);
+
+ // Traverse rule configs.
+ for (const config of configs) {
+ for (const [ruleId, ruleConfig] of Object.entries(config.rules)) {
+
+ // Skip if it was processed.
+ if (processedRuleIds.has(ruleId)) {
+ continue;
+ }
+ processedRuleIds.add(ruleId);
+
+ // Skip if it's not used.
+ if (!ConfigOps.getRuleSeverity(ruleConfig)) {
+ continue;
+ }
+ const rule = getRule(ruleId, usedConfigArrays);
+
+ // Skip if it's not deprecated.
+ if (!(rule && rule.meta && rule.meta.deprecated)) {
+ continue;
+ }
+
+ // This rule was used and deprecated.
+ yield {
+ ruleId,
+ replacedBy: rule.meta.replacedBy || []
+ };
+ }
+ }
}
/**
@@ -427,9 +416,10 @@ function* iterateRuleDeprecationWarnings(usedConfigArrays) {
* @private
*/
function isErrorMessage(message) {
- return message.severity === 2;
+ return message.severity === 2;
}
+
/**
* return the cacheFile to be used by eslint, based on whether the provided parameter is
* a directory or looks like a directory (ends in `path.sep`), in which case the file
@@ -441,62 +431,65 @@ function isErrorMessage(message) {
* @returns {string} the resolved path to the cache file
*/
function getCacheFile(cacheFile, cwd) {
- /*
- * make sure the path separators are normalized for the environment/os
- * keeping the trailing path separator if present
- */
- const normalizedCacheFile = path.normalize(cacheFile);
-
- const resolvedCacheFile = path.resolve(cwd, normalizedCacheFile);
- const looksLikeADirectory = normalizedCacheFile.slice(-1) === path.sep;
-
- /**
- * return the name for the cache file in case the provided parameter is a directory
- * @returns {string} the resolved path to the cacheFile
- */
- function getCacheFileForDirectory() {
- return path.join(resolvedCacheFile, `.cache_${hash(cwd)}`);
- }
-
- let fileStats;
-
- try {
- fileStats = fs.lstatSync(resolvedCacheFile);
- } catch {
- fileStats = null;
- }
-
- /*
- * in case the file exists we need to verify if the provided path
- * is a directory or a file. If it is a directory we want to create a file
- * inside that directory
- */
- if (fileStats) {
- /*
- * is a directory or is a file, but the original file the user provided
- * looks like a directory but `path.resolve` removed the `last path.sep`
- * so we need to still treat this like a directory
- */
- if (fileStats.isDirectory() || looksLikeADirectory) {
- return getCacheFileForDirectory();
- }
-
- // is file so just use that file
- return resolvedCacheFile;
- }
-
- /*
- * here we known the file or directory doesn't exist,
- * so we will try to infer if its a directory if it looks like a directory
- * for the current operating system.
- */
-
- // if the last character passed is a path separator we assume is a directory
- if (looksLikeADirectory) {
- return getCacheFileForDirectory();
- }
-
- return resolvedCacheFile;
+
+ /*
+ * make sure the path separators are normalized for the environment/os
+ * keeping the trailing path separator if present
+ */
+ const normalizedCacheFile = path.normalize(cacheFile);
+
+ const resolvedCacheFile = path.resolve(cwd, normalizedCacheFile);
+ const looksLikeADirectory = normalizedCacheFile.slice(-1) === path.sep;
+
+ /**
+ * return the name for the cache file in case the provided parameter is a directory
+ * @returns {string} the resolved path to the cacheFile
+ */
+ function getCacheFileForDirectory() {
+ return path.join(resolvedCacheFile, `.cache_${hash(cwd)}`);
+ }
+
+ let fileStats;
+
+ try {
+ fileStats = fs.lstatSync(resolvedCacheFile);
+ } catch {
+ fileStats = null;
+ }
+
+
+ /*
+ * in case the file exists we need to verify if the provided path
+ * is a directory or a file. If it is a directory we want to create a file
+ * inside that directory
+ */
+ if (fileStats) {
+
+ /*
+ * is a directory or is a file, but the original file the user provided
+ * looks like a directory but `path.resolve` removed the `last path.sep`
+ * so we need to still treat this like a directory
+ */
+ if (fileStats.isDirectory() || looksLikeADirectory) {
+ return getCacheFileForDirectory();
+ }
+
+ // is file so just use that file
+ return resolvedCacheFile;
+ }
+
+ /*
+ * here we known the file or directory doesn't exist,
+ * so we will try to infer if its a directory if it looks like a directory
+ * for the current operating system.
+ */
+
+ // if the last character passed is a path separator we assume is a directory
+ if (looksLikeADirectory) {
+ return getCacheFileForDirectory();
+ }
+
+ return resolvedCacheFile;
}
/**
@@ -508,21 +501,23 @@ function getCacheFile(cacheFile, cwd) {
* @returns {Record} The boolean map.
*/
function toBooleanMap(keys, defaultValue, displayName) {
- if (keys && !Array.isArray(keys)) {
- throw new Error(`${displayName} must be an array.`);
- }
- if (keys && keys.length > 0) {
- return keys.reduce((map, def) => {
- const [key, value] = def.split(":");
-
- if (key !== "__proto__") {
- map[key] = value === void 0 ? defaultValue : value === "true";
- }
-
- return map;
- }, {});
- }
- return void 0;
+ if (keys && !Array.isArray(keys)) {
+ throw new Error(`${displayName} must be an array.`);
+ }
+ if (keys && keys.length > 0) {
+ return keys.reduce((map, def) => {
+ const [key, value] = def.split(":");
+
+ if (key !== "__proto__") {
+ map[key] = value === void 0
+ ? defaultValue
+ : value === "true";
+ }
+
+ return map;
+ }, {});
+ }
+ return void 0;
}
/**
@@ -531,30 +526,36 @@ function toBooleanMap(keys, defaultValue, displayName) {
* @returns {ConfigData|null} The created config data.
*/
function createConfigDataFromOptions(options) {
- const { ignorePattern, parser, parserOptions, plugins, rules } = options;
- const env = toBooleanMap(options.envs, true, "envs");
- const globals = toBooleanMap(options.globals, false, "globals");
-
- if (
- env === void 0 &&
- globals === void 0 &&
- (ignorePattern === void 0 || ignorePattern.length === 0) &&
- parser === void 0 &&
- parserOptions === void 0 &&
- plugins === void 0 &&
- rules === void 0
- ) {
- return null;
- }
- return {
- env,
- globals,
- ignorePatterns: ignorePattern,
- parser,
- parserOptions,
- plugins,
- rules,
- };
+ const {
+ ignorePattern,
+ parser,
+ parserOptions,
+ plugins,
+ rules
+ } = options;
+ const env = toBooleanMap(options.envs, true, "envs");
+ const globals = toBooleanMap(options.globals, false, "globals");
+
+ if (
+ env === void 0 &&
+ globals === void 0 &&
+ (ignorePattern === void 0 || ignorePattern.length === 0) &&
+ parser === void 0 &&
+ parserOptions === void 0 &&
+ plugins === void 0 &&
+ rules === void 0
+ ) {
+ return null;
+ }
+ return {
+ env,
+ globals,
+ ignorePatterns: ignorePattern,
+ parser,
+ parserOptions,
+ plugins,
+ rules
+ };
}
/**
@@ -564,14 +565,14 @@ function createConfigDataFromOptions(options) {
* @returns {boolean} `true` if a directory exists
*/
function directoryExists(resolvedPath) {
- try {
- return fs.statSync(resolvedPath).isDirectory();
- } catch (error) {
- if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
- return false;
- }
- throw error;
- }
+ try {
+ return fs.statSync(resolvedPath).isDirectory();
+ } catch (error) {
+ if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
+ return false;
+ }
+ throw error;
+ }
}
//------------------------------------------------------------------------------
@@ -582,528 +583,496 @@ function directoryExists(resolvedPath) {
* Core CLI.
*/
class CLIEngine {
- /**
- * Creates a new instance of the core CLI engine.
- * @param {CLIEngineOptions} providedOptions The options for this instance.
- * @param {Object} [additionalData] Additional settings that are not CLIEngineOptions.
- * @param {Record|null} [additionalData.preloadedPlugins] Preloaded plugins.
- */
- constructor(providedOptions, { preloadedPlugins } = {}) {
- const options = Object.assign(
- Object.create(null),
- defaultOptions,
- { cwd: process.cwd() },
- providedOptions,
- );
-
- if (options.fix === void 0) {
- options.fix = false;
- }
-
- const additionalPluginPool = new Map();
-
- if (preloadedPlugins) {
- for (const [id, plugin] of Object.entries(preloadedPlugins)) {
- additionalPluginPool.set(id, plugin);
- }
- }
-
- const cacheFilePath = getCacheFile(
- options.cacheLocation || options.cacheFile,
- options.cwd,
- );
- const configArrayFactory = new CascadingConfigArrayFactory({
- additionalPluginPool,
- baseConfig: options.baseConfig || null,
- cliConfig: createConfigDataFromOptions(options),
- cwd: options.cwd,
- ignorePath: options.ignorePath,
- resolvePluginsRelativeTo: options.resolvePluginsRelativeTo,
- rulePaths: options.rulePaths,
- specificConfigPath: options.configFile,
- useEslintrc: options.useEslintrc,
- builtInRules,
- loadRules,
- getEslintRecommendedConfig: () =>
- require("@eslint/js").configs.recommended,
- getEslintAllConfig: () => require("@eslint/js").configs.all,
- });
- const fileEnumerator = new FileEnumerator({
- configArrayFactory,
- cwd: options.cwd,
- extensions: options.extensions,
- globInputPaths: options.globInputPaths,
- errorOnUnmatchedPattern: options.errorOnUnmatchedPattern,
- ignore: options.ignore,
- });
- const lintResultCache = options.cache
- ? new LintResultCache(cacheFilePath, options.cacheStrategy)
- : null;
- const linter = new Linter({ cwd: options.cwd, configType: "eslintrc" });
-
- /** @type {ConfigArray[]} */
- const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()];
-
- // Store private data.
- internalSlotsMap.set(this, {
- additionalPluginPool,
- cacheFilePath,
- configArrayFactory,
- defaultIgnores: IgnorePattern.createDefaultIgnore(options.cwd),
- fileEnumerator,
- lastConfigArrays,
- lintResultCache,
- linter,
- options,
- });
-
- // setup special filter for fixes
- if (options.fix && options.fixTypes && options.fixTypes.length > 0) {
- debug(`Using fix types ${options.fixTypes}`);
-
- // throw an error if any invalid fix types are found
- validateFixTypes(options.fixTypes);
-
- // convert to Set for faster lookup
- const fixTypes = new Set(options.fixTypes);
-
- // save original value of options.fix in case it's a function
- const originalFix =
- typeof options.fix === "function" ? options.fix : () => true;
-
- options.fix = message =>
- shouldMessageBeFixed(message, lastConfigArrays, fixTypes) &&
- originalFix(message);
- }
- }
-
- getRules() {
- const { lastConfigArrays } = internalSlotsMap.get(this);
-
- return new Map(
- (function* () {
- yield* builtInRules;
-
- for (const configArray of lastConfigArrays) {
- yield* configArray.pluginRules;
- }
- })(),
- );
- }
-
- /**
- * Returns results that only contains errors.
- * @param {LintResult[]} results The results to filter.
- * @returns {LintResult[]} The filtered results.
- */
- static getErrorResults(results) {
- const filtered = [];
-
- results.forEach(result => {
- const filteredMessages = result.messages.filter(isErrorMessage);
- const filteredSuppressedMessages =
- result.suppressedMessages.filter(isErrorMessage);
-
- if (filteredMessages.length > 0) {
- filtered.push({
- ...result,
- messages: filteredMessages,
- suppressedMessages: filteredSuppressedMessages,
- errorCount: filteredMessages.length,
- warningCount: 0,
- fixableErrorCount: result.fixableErrorCount,
- fixableWarningCount: 0,
- });
- }
- });
-
- return filtered;
- }
-
- /**
- * Outputs fixes from the given results to files.
- * @param {LintReport} report The report object created by CLIEngine.
- * @returns {void}
- */
- static outputFixes(report) {
- report.results
- .filter(result => Object.hasOwn(result, "output"))
- .forEach(result => {
- fs.writeFileSync(result.filePath, result.output);
- });
- }
-
- /**
- * Resolves the patterns passed into executeOnFiles() into glob-based patterns
- * for easier handling.
- * @param {string[]} patterns The file patterns passed on the command line.
- * @returns {string[]} The equivalent glob patterns.
- */
- resolveFileGlobPatterns(patterns) {
- const { options } = internalSlotsMap.get(this);
-
- if (options.globInputPaths === false) {
- return patterns.filter(Boolean);
- }
-
- const extensions = (options.extensions || [".js"]).map(ext =>
- ext.replace(/^\./u, ""),
- );
- const dirSuffix = `/**/*.{${extensions.join(",")}}`;
-
- return patterns.filter(Boolean).map(pathname => {
- const resolvedPath = path.resolve(options.cwd, pathname);
- const newPath = directoryExists(resolvedPath)
- ? pathname.replace(/[/\\]$/u, "") + dirSuffix
- : pathname;
-
- return path.normalize(newPath).replace(/\\/gu, "/");
- });
- }
-
- /**
- * Executes the current configuration on an array of file and directory names.
- * @param {string[]} patterns An array of file and directory names.
- * @throws {Error} As may be thrown by `fs.unlinkSync`.
- * @returns {LintReport} The results for all files that were linted.
- */
- executeOnFiles(patterns) {
- const {
- cacheFilePath,
- fileEnumerator,
- lastConfigArrays,
- lintResultCache,
- linter,
- options: {
- allowInlineConfig,
- cache,
- cwd,
- fix,
- reportUnusedDisableDirectives,
- },
- } = internalSlotsMap.get(this);
- const results = [];
- const startTime = Date.now();
-
- // Clear the last used config arrays.
- lastConfigArrays.length = 0;
-
- // Delete cache file; should this do here?
- if (!cache) {
- try {
- fs.unlinkSync(cacheFilePath);
- } catch (error) {
- const errorCode = error && error.code;
-
- // Ignore errors when no such file exists or file system is read only (and cache file does not exist)
- if (
- errorCode !== "ENOENT" &&
- !(errorCode === "EROFS" && !fs.existsSync(cacheFilePath))
- ) {
- throw error;
- }
- }
- }
-
- // Iterate source code files.
- for (const { config, filePath, ignored } of fileEnumerator.iterateFiles(
- patterns,
- )) {
- if (ignored) {
- results.push(createIgnoreResult(filePath, cwd));
- continue;
- }
-
- /*
- * Store used configs for:
- * - this method uses to collect used deprecated rules.
- * - `getRules()` method uses to collect all loaded rules.
- * - `--fix-type` option uses to get the loaded rule's meta data.
- */
- if (!lastConfigArrays.includes(config)) {
- lastConfigArrays.push(config);
- }
-
- // Skip if there is cached result.
- if (lintResultCache) {
- const cachedResult = lintResultCache.getCachedLintResults(
- filePath,
- config,
- );
-
- if (cachedResult) {
- const hadMessages =
- cachedResult.messages &&
- cachedResult.messages.length > 0;
-
- if (hadMessages && fix) {
- debug(
- `Reprocessing cached file to allow autofix: ${filePath}`,
- );
- } else {
- debug(
- `Skipping file since it hasn't changed: ${filePath}`,
- );
- results.push(cachedResult);
- continue;
- }
- }
- }
-
- // Do lint.
- const result = verifyText({
- text: fs.readFileSync(filePath, "utf8"),
- filePath,
- config,
- cwd,
- fix,
- allowInlineConfig,
- reportUnusedDisableDirectives,
- fileEnumerator,
- linter,
- });
-
- results.push(result);
-
- /*
- * Store the lint result in the LintResultCache.
- * NOTE: The LintResultCache will remove the file source and any
- * other properties that are difficult to serialize, and will
- * hydrate those properties back in on future lint runs.
- */
- if (lintResultCache) {
- lintResultCache.setCachedLintResults(filePath, config, result);
- }
- }
-
- // Persist the cache to disk.
- if (lintResultCache) {
- lintResultCache.reconcile();
- }
-
- debug(`Linting complete in: ${Date.now() - startTime}ms`);
- let usedDeprecatedRules;
-
- return {
- results,
- ...calculateStatsPerRun(results),
-
- // Initialize it lazily because CLI and `ESLint` API don't use it.
- get usedDeprecatedRules() {
- if (!usedDeprecatedRules) {
- usedDeprecatedRules = Array.from(
- iterateRuleDeprecationWarnings(lastConfigArrays),
- );
- }
- return usedDeprecatedRules;
- },
- };
- }
-
- /**
- * Executes the current configuration on text.
- * @param {string} text A string of JavaScript code to lint.
- * @param {string} [filename] An optional string representing the texts filename.
- * @param {boolean} [warnIgnored] Always warn when a file is ignored
- * @returns {LintReport} The results for the linting.
- */
- executeOnText(text, filename, warnIgnored) {
- const {
- configArrayFactory,
- fileEnumerator,
- lastConfigArrays,
- linter,
- options: {
- allowInlineConfig,
- cwd,
- fix,
- reportUnusedDisableDirectives,
- },
- } = internalSlotsMap.get(this);
- const results = [];
- const startTime = Date.now();
- const resolvedFilename = filename && path.resolve(cwd, filename);
-
- // Clear the last used config arrays.
- lastConfigArrays.length = 0;
- if (resolvedFilename && this.isPathIgnored(resolvedFilename)) {
- if (warnIgnored) {
- results.push(createIgnoreResult(resolvedFilename, cwd));
- }
- } else {
- const config = configArrayFactory.getConfigArrayForFile(
- resolvedFilename || "__placeholder__.js",
- );
-
- /*
- * Store used configs for:
- * - this method uses to collect used deprecated rules.
- * - `getRules()` method uses to collect all loaded rules.
- * - `--fix-type` option uses to get the loaded rule's meta data.
- */
- lastConfigArrays.push(config);
-
- // Do lint.
- results.push(
- verifyText({
- text,
- filePath: resolvedFilename,
- config,
- cwd,
- fix,
- allowInlineConfig,
- reportUnusedDisableDirectives,
- fileEnumerator,
- linter,
- }),
- );
- }
-
- debug(`Linting complete in: ${Date.now() - startTime}ms`);
- let usedDeprecatedRules;
-
- return {
- results,
- ...calculateStatsPerRun(results),
-
- // Initialize it lazily because CLI and `ESLint` API don't use it.
- get usedDeprecatedRules() {
- if (!usedDeprecatedRules) {
- usedDeprecatedRules = Array.from(
- iterateRuleDeprecationWarnings(lastConfigArrays),
- );
- }
- return usedDeprecatedRules;
- },
- };
- }
-
- /**
- * Returns a configuration object for the given file based on the CLI options.
- * This is the same logic used by the ESLint CLI executable to determine
- * configuration for each file it processes.
- * @param {string} filePath The path of the file to retrieve a config object for.
- * @throws {Error} If filepath a directory path.
- * @returns {ConfigData} A configuration object for the file.
- */
- getConfigForFile(filePath) {
- const { configArrayFactory, options } = internalSlotsMap.get(this);
- const absolutePath = path.resolve(options.cwd, filePath);
-
- if (directoryExists(absolutePath)) {
- throw Object.assign(
- new Error("'filePath' should not be a directory path."),
- { messageTemplate: "print-config-with-directory-path" },
- );
- }
-
- return configArrayFactory
- .getConfigArrayForFile(absolutePath)
- .extractConfig(absolutePath)
- .toCompatibleObjectAsConfigFileContent();
- }
-
- /**
- * Checks if a given path is ignored by ESLint.
- * @param {string} filePath The path of the file to check.
- * @returns {boolean} Whether or not the given path is ignored.
- */
- isPathIgnored(filePath) {
- const {
- configArrayFactory,
- defaultIgnores,
- options: { cwd, ignore },
- } = internalSlotsMap.get(this);
- const absolutePath = path.resolve(cwd, filePath);
-
- if (ignore) {
- const config = configArrayFactory
- .getConfigArrayForFile(absolutePath)
- .extractConfig(absolutePath);
- const ignores = config.ignores || defaultIgnores;
-
- return ignores(absolutePath);
- }
-
- return defaultIgnores(absolutePath);
- }
-
- /**
- * Returns the formatter representing the given format or null if the `format` is not a string.
- * @param {string} [format] The name of the format to load or the path to a
- * custom formatter.
- * @throws {any} As may be thrown by requiring of formatter
- * @returns {(FormatterFunction|null)} The formatter function or null if the `format` is not a string.
- */
- getFormatter(format) {
- // default is stylish
- const resolvedFormatName = format || "stylish";
-
- // only strings are valid formatters
- if (typeof resolvedFormatName === "string") {
- // replace \ with / for Windows compatibility
- const normalizedFormatName = resolvedFormatName.replace(
- /\\/gu,
- "/",
- );
-
- const slots = internalSlotsMap.get(this);
- const cwd = slots ? slots.options.cwd : process.cwd();
- const namespace = naming.getNamespaceFromTerm(normalizedFormatName);
-
- let formatterPath;
-
- // if there's a slash, then it's a file (TODO: this check seems dubious for scoped npm packages)
- if (!namespace && normalizedFormatName.includes("/")) {
- formatterPath = path.resolve(cwd, normalizedFormatName);
- } else {
- try {
- const npmFormat = naming.normalizePackageName(
- normalizedFormatName,
- "eslint-formatter",
- );
-
- formatterPath = ModuleResolver.resolve(
- npmFormat,
- path.join(cwd, "__placeholder__.js"),
- );
- } catch {
- formatterPath = path.resolve(
- __dirname,
- "formatters",
- normalizedFormatName,
- );
- }
- }
-
- try {
- return require(formatterPath);
- } catch (ex) {
- if (removedFormatters.has(format)) {
- ex.message = `The ${format} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${format}\``;
- } else {
- ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`;
- }
- throw ex;
- }
- } else {
- return null;
- }
- }
+
+ /**
+ * Creates a new instance of the core CLI engine.
+ * @param {CLIEngineOptions} providedOptions The options for this instance.
+ * @param {Object} [additionalData] Additional settings that are not CLIEngineOptions.
+ * @param {Record|null} [additionalData.preloadedPlugins] Preloaded plugins.
+ */
+ constructor(providedOptions, { preloadedPlugins } = {}) {
+ const options = Object.assign(
+ Object.create(null),
+ defaultOptions,
+ { cwd: process.cwd() },
+ providedOptions
+ );
+
+ if (options.fix === void 0) {
+ options.fix = false;
+ }
+
+ const additionalPluginPool = new Map();
+
+ if (preloadedPlugins) {
+ for (const [id, plugin] of Object.entries(preloadedPlugins)) {
+ additionalPluginPool.set(id, plugin);
+ }
+ }
+
+ const cacheFilePath = getCacheFile(
+ options.cacheLocation || options.cacheFile,
+ options.cwd
+ );
+ const configArrayFactory = new CascadingConfigArrayFactory({
+ additionalPluginPool,
+ baseConfig: options.baseConfig || null,
+ cliConfig: createConfigDataFromOptions(options),
+ cwd: options.cwd,
+ ignorePath: options.ignorePath,
+ resolvePluginsRelativeTo: options.resolvePluginsRelativeTo,
+ rulePaths: options.rulePaths,
+ specificConfigPath: options.configFile,
+ useEslintrc: options.useEslintrc,
+ builtInRules,
+ loadRules,
+ getEslintRecommendedConfig: () => require("@eslint/js").configs.recommended,
+ getEslintAllConfig: () => require("@eslint/js").configs.all
+ });
+ const fileEnumerator = new FileEnumerator({
+ configArrayFactory,
+ cwd: options.cwd,
+ extensions: options.extensions,
+ globInputPaths: options.globInputPaths,
+ errorOnUnmatchedPattern: options.errorOnUnmatchedPattern,
+ ignore: options.ignore
+ });
+ const lintResultCache =
+ options.cache ? new LintResultCache(cacheFilePath, options.cacheStrategy) : null;
+ const linter = new Linter({ cwd: options.cwd });
+
+ /** @type {ConfigArray[]} */
+ const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()];
+
+ // Store private data.
+ internalSlotsMap.set(this, {
+ additionalPluginPool,
+ cacheFilePath,
+ configArrayFactory,
+ defaultIgnores: IgnorePattern.createDefaultIgnore(options.cwd),
+ fileEnumerator,
+ lastConfigArrays,
+ lintResultCache,
+ linter,
+ options
+ });
+
+ // setup special filter for fixes
+ if (options.fix && options.fixTypes && options.fixTypes.length > 0) {
+ debug(`Using fix types ${options.fixTypes}`);
+
+ // throw an error if any invalid fix types are found
+ validateFixTypes(options.fixTypes);
+
+ // convert to Set for faster lookup
+ const fixTypes = new Set(options.fixTypes);
+
+ // save original value of options.fix in case it's a function
+ const originalFix = (typeof options.fix === "function")
+ ? options.fix : () => true;
+
+ options.fix = message => shouldMessageBeFixed(message, lastConfigArrays, fixTypes) && originalFix(message);
+ }
+ }
+
+ getRules() {
+ const { lastConfigArrays } = internalSlotsMap.get(this);
+
+ return new Map(function *() {
+ yield* builtInRules;
+
+ for (const configArray of lastConfigArrays) {
+ yield* configArray.pluginRules;
+ }
+ }());
+ }
+
+ /**
+ * Returns results that only contains errors.
+ * @param {LintResult[]} results The results to filter.
+ * @returns {LintResult[]} The filtered results.
+ */
+ static getErrorResults(results) {
+ const filtered = [];
+
+ results.forEach(result => {
+ const filteredMessages = result.messages.filter(isErrorMessage);
+ const filteredSuppressedMessages = result.suppressedMessages.filter(isErrorMessage);
+
+ if (filteredMessages.length > 0) {
+ filtered.push({
+ ...result,
+ messages: filteredMessages,
+ suppressedMessages: filteredSuppressedMessages,
+ errorCount: filteredMessages.length,
+ warningCount: 0,
+ fixableErrorCount: result.fixableErrorCount,
+ fixableWarningCount: 0
+ });
+ }
+ });
+
+ return filtered;
+ }
+
+ /**
+ * Outputs fixes from the given results to files.
+ * @param {LintReport} report The report object created by CLIEngine.
+ * @returns {void}
+ */
+ static outputFixes(report) {
+ report.results.filter(result => Object.prototype.hasOwnProperty.call(result, "output")).forEach(result => {
+ fs.writeFileSync(result.filePath, result.output);
+ });
+ }
+
+ /**
+ * Resolves the patterns passed into executeOnFiles() into glob-based patterns
+ * for easier handling.
+ * @param {string[]} patterns The file patterns passed on the command line.
+ * @returns {string[]} The equivalent glob patterns.
+ */
+ resolveFileGlobPatterns(patterns) {
+ const { options } = internalSlotsMap.get(this);
+
+ if (options.globInputPaths === false) {
+ return patterns.filter(Boolean);
+ }
+
+ const extensions = (options.extensions || [".js"]).map(ext => ext.replace(/^\./u, ""));
+ const dirSuffix = `/**/*.{${extensions.join(",")}}`;
+
+ return patterns.filter(Boolean).map(pathname => {
+ const resolvedPath = path.resolve(options.cwd, pathname);
+ const newPath = directoryExists(resolvedPath)
+ ? pathname.replace(/[/\\]$/u, "") + dirSuffix
+ : pathname;
+
+ return path.normalize(newPath).replace(/\\/gu, "/");
+ });
+ }
+
+ /**
+ * Executes the current configuration on an array of file and directory names.
+ * @param {string[]} patterns An array of file and directory names.
+ * @throws {Error} As may be thrown by `fs.unlinkSync`.
+ * @returns {LintReport} The results for all files that were linted.
+ */
+ executeOnFiles(patterns) {
+ const {
+ cacheFilePath,
+ fileEnumerator,
+ lastConfigArrays,
+ lintResultCache,
+ linter,
+ options: {
+ allowInlineConfig,
+ cache,
+ cwd,
+ fix,
+ reportUnusedDisableDirectives
+ }
+ } = internalSlotsMap.get(this);
+ const results = [];
+ const startTime = Date.now();
+
+ // Clear the last used config arrays.
+ lastConfigArrays.length = 0;
+
+ // Delete cache file; should this do here?
+ if (!cache) {
+ try {
+ fs.unlinkSync(cacheFilePath);
+ } catch (error) {
+ const errorCode = error && error.code;
+
+ // Ignore errors when no such file exists or file system is read only (and cache file does not exist)
+ if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !fs.existsSync(cacheFilePath))) {
+ throw error;
+ }
+ }
+ }
+
+ // Iterate source code files.
+ for (const { config, filePath, ignored } of fileEnumerator.iterateFiles(patterns)) {
+ if (ignored) {
+ results.push(createIgnoreResult(filePath, cwd));
+ continue;
+ }
+
+ /*
+ * Store used configs for:
+ * - this method uses to collect used deprecated rules.
+ * - `getRules()` method uses to collect all loaded rules.
+ * - `--fix-type` option uses to get the loaded rule's meta data.
+ */
+ if (!lastConfigArrays.includes(config)) {
+ lastConfigArrays.push(config);
+ }
+
+ // Skip if there is cached result.
+ if (lintResultCache) {
+ const cachedResult =
+ lintResultCache.getCachedLintResults(filePath, config);
+
+ if (cachedResult) {
+ const hadMessages =
+ cachedResult.messages &&
+ cachedResult.messages.length > 0;
+
+ if (hadMessages && fix) {
+ debug(`Reprocessing cached file to allow autofix: ${filePath}`);
+ } else {
+ debug(`Skipping file since it hasn't changed: ${filePath}`);
+ results.push(cachedResult);
+ continue;
+ }
+ }
+ }
+
+ // Do lint.
+ const result = verifyText({
+ text: fs.readFileSync(filePath, "utf8"),
+ filePath,
+ config,
+ cwd,
+ fix,
+ allowInlineConfig,
+ reportUnusedDisableDirectives,
+ fileEnumerator,
+ linter
+ });
+
+ results.push(result);
+
+ /*
+ * Store the lint result in the LintResultCache.
+ * NOTE: The LintResultCache will remove the file source and any
+ * other properties that are difficult to serialize, and will
+ * hydrate those properties back in on future lint runs.
+ */
+ if (lintResultCache) {
+ lintResultCache.setCachedLintResults(filePath, config, result);
+ }
+ }
+
+ // Persist the cache to disk.
+ if (lintResultCache) {
+ lintResultCache.reconcile();
+ }
+
+ debug(`Linting complete in: ${Date.now() - startTime}ms`);
+ let usedDeprecatedRules;
+
+ return {
+ results,
+ ...calculateStatsPerRun(results),
+
+ // Initialize it lazily because CLI and `ESLint` API don't use it.
+ get usedDeprecatedRules() {
+ if (!usedDeprecatedRules) {
+ usedDeprecatedRules = Array.from(
+ iterateRuleDeprecationWarnings(lastConfigArrays)
+ );
+ }
+ return usedDeprecatedRules;
+ }
+ };
+ }
+
+ /**
+ * Executes the current configuration on text.
+ * @param {string} text A string of JavaScript code to lint.
+ * @param {string} [filename] An optional string representing the texts filename.
+ * @param {boolean} [warnIgnored] Always warn when a file is ignored
+ * @returns {LintReport} The results for the linting.
+ */
+ executeOnText(text, filename, warnIgnored) {
+ const {
+ configArrayFactory,
+ fileEnumerator,
+ lastConfigArrays,
+ linter,
+ options: {
+ allowInlineConfig,
+ cwd,
+ fix,
+ reportUnusedDisableDirectives
+ }
+ } = internalSlotsMap.get(this);
+ const results = [];
+ const startTime = Date.now();
+ const resolvedFilename = filename && path.resolve(cwd, filename);
+
+
+ // Clear the last used config arrays.
+ lastConfigArrays.length = 0;
+ if (resolvedFilename && this.isPathIgnored(resolvedFilename)) {
+ if (warnIgnored) {
+ results.push(createIgnoreResult(resolvedFilename, cwd));
+ }
+ } else {
+ const config = configArrayFactory.getConfigArrayForFile(
+ resolvedFilename || "__placeholder__.js"
+ );
+
+ /*
+ * Store used configs for:
+ * - this method uses to collect used deprecated rules.
+ * - `getRules()` method uses to collect all loaded rules.
+ * - `--fix-type` option uses to get the loaded rule's meta data.
+ */
+ lastConfigArrays.push(config);
+
+ // Do lint.
+ results.push(verifyText({
+ text,
+ filePath: resolvedFilename,
+ config,
+ cwd,
+ fix,
+ allowInlineConfig,
+ reportUnusedDisableDirectives,
+ fileEnumerator,
+ linter
+ }));
+ }
+
+ debug(`Linting complete in: ${Date.now() - startTime}ms`);
+ let usedDeprecatedRules;
+
+ return {
+ results,
+ ...calculateStatsPerRun(results),
+
+ // Initialize it lazily because CLI and `ESLint` API don't use it.
+ get usedDeprecatedRules() {
+ if (!usedDeprecatedRules) {
+ usedDeprecatedRules = Array.from(
+ iterateRuleDeprecationWarnings(lastConfigArrays)
+ );
+ }
+ return usedDeprecatedRules;
+ }
+ };
+ }
+
+ /**
+ * Returns a configuration object for the given file based on the CLI options.
+ * This is the same logic used by the ESLint CLI executable to determine
+ * configuration for each file it processes.
+ * @param {string} filePath The path of the file to retrieve a config object for.
+ * @throws {Error} If filepath a directory path.
+ * @returns {ConfigData} A configuration object for the file.
+ */
+ getConfigForFile(filePath) {
+ const { configArrayFactory, options } = internalSlotsMap.get(this);
+ const absolutePath = path.resolve(options.cwd, filePath);
+
+ if (directoryExists(absolutePath)) {
+ throw Object.assign(
+ new Error("'filePath' should not be a directory path."),
+ { messageTemplate: "print-config-with-directory-path" }
+ );
+ }
+
+ return configArrayFactory
+ .getConfigArrayForFile(absolutePath)
+ .extractConfig(absolutePath)
+ .toCompatibleObjectAsConfigFileContent();
+ }
+
+ /**
+ * Checks if a given path is ignored by ESLint.
+ * @param {string} filePath The path of the file to check.
+ * @returns {boolean} Whether or not the given path is ignored.
+ */
+ isPathIgnored(filePath) {
+ const {
+ configArrayFactory,
+ defaultIgnores,
+ options: { cwd, ignore }
+ } = internalSlotsMap.get(this);
+ const absolutePath = path.resolve(cwd, filePath);
+
+ if (ignore) {
+ const config = configArrayFactory
+ .getConfigArrayForFile(absolutePath)
+ .extractConfig(absolutePath);
+ const ignores = config.ignores || defaultIgnores;
+
+ return ignores(absolutePath);
+ }
+
+ return defaultIgnores(absolutePath);
+ }
+
+ /**
+ * Returns the formatter representing the given format or null if the `format` is not a string.
+ * @param {string} [format] The name of the format to load or the path to a
+ * custom formatter.
+ * @throws {any} As may be thrown by requiring of formatter
+ * @returns {(FormatterFunction|null)} The formatter function or null if the `format` is not a string.
+ */
+ getFormatter(format) {
+
+ // default is stylish
+ const resolvedFormatName = format || "stylish";
+
+ // only strings are valid formatters
+ if (typeof resolvedFormatName === "string") {
+
+ // replace \ with / for Windows compatibility
+ const normalizedFormatName = resolvedFormatName.replace(/\\/gu, "/");
+
+ const slots = internalSlotsMap.get(this);
+ const cwd = slots ? slots.options.cwd : process.cwd();
+ const namespace = naming.getNamespaceFromTerm(normalizedFormatName);
+
+ let formatterPath;
+
+ // if there's a slash, then it's a file (TODO: this check seems dubious for scoped npm packages)
+ if (!namespace && normalizedFormatName.includes("/")) {
+ formatterPath = path.resolve(cwd, normalizedFormatName);
+ } else {
+ try {
+ const npmFormat = naming.normalizePackageName(normalizedFormatName, "eslint-formatter");
+
+ formatterPath = ModuleResolver.resolve(npmFormat, path.join(cwd, "__placeholder__.js"));
+ } catch {
+ formatterPath = path.resolve(__dirname, "formatters", normalizedFormatName);
+ }
+ }
+
+ try {
+ return require(formatterPath);
+ } catch (ex) {
+ if (format === "table" || format === "codeframe") {
+ ex.message = `The ${format} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${format}\``;
+ } else {
+ ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`;
+ }
+ throw ex;
+ }
+
+ } else {
+ return null;
+ }
+ }
}
CLIEngine.version = pkg.version;
CLIEngine.getFormatter = CLIEngine.prototype.getFormatter;
module.exports = {
- CLIEngine,
-
- /**
- * Get the internal slots of a given CLIEngine instance for tests.
- * @param {CLIEngine} instance The CLIEngine instance to get.
- * @returns {CLIEngineInternalSlots} The internal slots.
- */
- getCLIEngineInternalSlots(instance) {
- return internalSlotsMap.get(instance);
- },
+ CLIEngine,
+
+ /**
+ * Get the internal slots of a given CLIEngine instance for tests.
+ * @param {CLIEngine} instance The CLIEngine instance to get.
+ * @returns {CLIEngineInternalSlots} The internal slots.
+ */
+ getCLIEngineInternalSlots(instance) {
+ return internalSlotsMap.get(instance);
+ }
};
diff --git a/node_modules/eslint/lib/cli-engine/file-enumerator.js b/node_modules/eslint/lib/cli-engine/file-enumerator.js
index 91c4013c9..5dff8d09c 100644
--- a/node_modules/eslint/lib/cli-engine/file-enumerator.js
+++ b/node_modules/eslint/lib/cli-engine/file-enumerator.js
@@ -34,15 +34,18 @@
// Requirements
//------------------------------------------------------------------------------
-const fs = require("node:fs");
-const path = require("node:path");
+const fs = require("fs");
+const path = require("path");
const getGlobParent = require("glob-parent");
const isGlob = require("is-glob");
const escapeRegExp = require("escape-string-regexp");
const { Minimatch } = require("minimatch");
const {
- Legacy: { IgnorePattern, CascadingConfigArrayFactory },
+ Legacy: {
+ IgnorePattern,
+ CascadingConfigArrayFactory
+ }
} = require("@eslint/eslintrc");
const debug = require("debug")("eslint:file-enumerator");
@@ -51,7 +54,7 @@ const debug = require("debug")("eslint:file-enumerator");
//------------------------------------------------------------------------------
const minimatchOpts = { dot: true, matchBase: true };
-const dotfilesPattern = /(?:^\.|[/\\]\.)[^/\\.].*/u;
+const dotfilesPattern = /(?:(?:^\.)|(?:[/\\]\.))[^/\\.].*/u;
const NONE = 0;
const IGNORED_SILENTLY = 1;
const IGNORED = 2;
@@ -105,7 +108,7 @@ const internalSlotsMap = new WeakMap();
* @returns {boolean} `true` if the string is a glob pattern.
*/
function isGlobPattern(pattern) {
- return isGlob(path.sep === "\\" ? pattern.replace(/\\/gu, "/") : pattern);
+ return isGlob(path.sep === "\\" ? pattern.replace(/\\/gu, "/") : pattern);
}
/**
@@ -116,15 +119,16 @@ function isGlobPattern(pattern) {
* @private
*/
function statSafeSync(filePath) {
- try {
- return fs.statSync(filePath);
- } catch (error) {
- /* c8 ignore next */
- if (error.code !== "ENOENT") {
- throw error;
- }
- return null;
- }
+ try {
+ return fs.statSync(filePath);
+ } catch (error) {
+
+ /* c8 ignore next */
+ if (error.code !== "ENOENT") {
+ throw error;
+ }
+ return null;
+ }
}
/**
@@ -135,15 +139,16 @@ function statSafeSync(filePath) {
* @private
*/
function readdirSafeSync(directoryPath) {
- try {
- return fs.readdirSync(directoryPath, { withFileTypes: true });
- } catch (error) {
- /* c8 ignore next */
- if (error.code !== "ENOENT") {
- throw error;
- }
- return [];
- }
+ try {
+ return fs.readdirSync(directoryPath, { withFileTypes: true });
+ } catch (error) {
+
+ /* c8 ignore next */
+ if (error.code !== "ENOENT") {
+ throw error;
+ }
+ return [];
+ }
}
/**
@@ -152,45 +157,50 @@ function readdirSafeSync(directoryPath) {
* @returns {RegExp | null} The created `RegExp` object or null.
*/
function createExtensionRegExp(extensions) {
- if (extensions) {
- const normalizedExts = extensions.map(ext =>
- escapeRegExp(ext.startsWith(".") ? ext.slice(1) : ext),
- );
-
- return new RegExp(`.\\.(?:${normalizedExts.join("|")})$`, "u");
- }
- return null;
+ if (extensions) {
+ const normalizedExts = extensions.map(ext => escapeRegExp(
+ ext.startsWith(".")
+ ? ext.slice(1)
+ : ext
+ ));
+
+ return new RegExp(
+ `.\\.(?:${normalizedExts.join("|")})$`,
+ "u"
+ );
+ }
+ return null;
}
/**
* The error type when no files match a glob.
*/
class NoFilesFoundError extends Error {
- /**
- * @param {string} pattern The glob pattern which was not found.
- * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled.
- */
- constructor(pattern, globDisabled) {
- super(
- `No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`,
- );
- this.messageTemplate = "file-not-found";
- this.messageData = { pattern, globDisabled };
- }
+
+ /**
+ * @param {string} pattern The glob pattern which was not found.
+ * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled.
+ */
+ constructor(pattern, globDisabled) {
+ super(`No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`);
+ this.messageTemplate = "file-not-found";
+ this.messageData = { pattern, globDisabled };
+ }
}
/**
* The error type when there are files matched by a glob, but all of them have been ignored.
*/
class AllFilesIgnoredError extends Error {
- /**
- * @param {string} pattern The glob pattern which was not found.
- */
- constructor(pattern) {
- super(`All files matched by '${pattern}' are ignored.`);
- this.messageTemplate = "all-files-ignored";
- this.messageData = { pattern };
- }
+
+ /**
+ * @param {string} pattern The glob pattern which was not found.
+ */
+ constructor(pattern) {
+ super(`All files matched by '${pattern}' are ignored.`);
+ this.messageTemplate = "all-files-ignored";
+ this.messageData = { pattern };
+ }
}
/**
@@ -198,340 +208,336 @@ class AllFilesIgnoredError extends Error {
* matched by given glob patterns and that configuration.
*/
class FileEnumerator {
- /**
- * Initialize this enumerator.
- * @param {FileEnumeratorOptions} options The options.
- */
- constructor({
- cwd = process.cwd(),
- configArrayFactory = new CascadingConfigArrayFactory({
- cwd,
- getEslintRecommendedConfig: () =>
- require("@eslint/js").configs.recommended,
- getEslintAllConfig: () => require("@eslint/js").configs.all,
- }),
- extensions = null,
- globInputPaths = true,
- errorOnUnmatchedPattern = true,
- ignore = true,
- } = {}) {
- internalSlotsMap.set(this, {
- configArrayFactory,
- cwd,
- defaultIgnores: IgnorePattern.createDefaultIgnore(cwd),
- extensionRegExp: createExtensionRegExp(extensions),
- globInputPaths,
- errorOnUnmatchedPattern,
- ignoreFlag: ignore,
- });
- }
-
- /**
- * Check if a given file is target or not.
- * @param {string} filePath The path to a candidate file.
- * @param {ConfigArray} [providedConfig] Optional. The configuration for the file.
- * @returns {boolean} `true` if the file is a target.
- */
- isTargetPath(filePath, providedConfig) {
- const { configArrayFactory, extensionRegExp } =
- internalSlotsMap.get(this);
-
- // If `--ext` option is present, use it.
- if (extensionRegExp) {
- return extensionRegExp.test(filePath);
- }
-
- // `.js` file is target by default.
- if (filePath.endsWith(".js")) {
- return true;
- }
-
- // use `overrides[].files` to check additional targets.
- const config =
- providedConfig ||
- configArrayFactory.getConfigArrayForFile(filePath, {
- ignoreNotFoundError: true,
- });
-
- return config.isAdditionalTargetPath(filePath);
- }
-
- /**
- * Iterate files which are matched by given glob patterns.
- * @param {string|string[]} patternOrPatterns The glob patterns to iterate files.
- * @throws {NoFilesFoundError|AllFilesIgnoredError} On an unmatched pattern.
- * @returns {IterableIterator} The found files.
- */
- *iterateFiles(patternOrPatterns) {
- const { globInputPaths, errorOnUnmatchedPattern } =
- internalSlotsMap.get(this);
- const patterns = Array.isArray(patternOrPatterns)
- ? patternOrPatterns
- : [patternOrPatterns];
-
- debug("Start to iterate files: %o", patterns);
-
- // The set of paths to remove duplicate.
- const set = new Set();
-
- for (const pattern of patterns) {
- let foundRegardlessOfIgnored = false;
- let found = false;
-
- // Skip empty string.
- if (!pattern) {
- continue;
- }
-
- // Iterate files of this pattern.
- for (const { config, filePath, flag } of this._iterateFiles(
- pattern,
- )) {
- foundRegardlessOfIgnored = true;
- if (flag === IGNORED_SILENTLY) {
- continue;
- }
- found = true;
-
- // Remove duplicate paths while yielding paths.
- if (!set.has(filePath)) {
- set.add(filePath);
- yield {
- config,
- filePath,
- ignored: flag === IGNORED,
- };
- }
- }
-
- // Raise an error if any files were not found.
- if (errorOnUnmatchedPattern) {
- if (!foundRegardlessOfIgnored) {
- throw new NoFilesFoundError(
- pattern,
- !globInputPaths && isGlob(pattern),
- );
- }
- if (!found) {
- throw new AllFilesIgnoredError(pattern);
- }
- }
- }
-
- debug(`Complete iterating files: ${JSON.stringify(patterns)}`);
- }
-
- /**
- * Iterate files which are matched by a given glob pattern.
- * @param {string} pattern The glob pattern to iterate files.
- * @returns {IterableIterator} The found files.
- */
- _iterateFiles(pattern) {
- const { cwd, globInputPaths } = internalSlotsMap.get(this);
- const absolutePath = path.resolve(cwd, pattern);
- const isDot = dotfilesPattern.test(pattern);
- const stat = statSafeSync(absolutePath);
-
- if (stat && stat.isDirectory()) {
- return this._iterateFilesWithDirectory(absolutePath, isDot);
- }
- if (stat && stat.isFile()) {
- return this._iterateFilesWithFile(absolutePath);
- }
- if (globInputPaths && isGlobPattern(pattern)) {
- return this._iterateFilesWithGlob(pattern, isDot);
- }
-
- return [];
- }
-
- /**
- * Iterate a file which is matched by a given path.
- * @param {string} filePath The path to the target file.
- * @returns {IterableIterator} The found files.
- * @private
- */
- _iterateFilesWithFile(filePath) {
- debug(`File: ${filePath}`);
-
- const { configArrayFactory } = internalSlotsMap.get(this);
- const config = configArrayFactory.getConfigArrayForFile(filePath);
- const ignored = this._isIgnoredFile(filePath, { config, direct: true });
- const flag = ignored ? IGNORED : NONE;
-
- return [{ config, filePath, flag }];
- }
-
- /**
- * Iterate files in a given path.
- * @param {string} directoryPath The path to the target directory.
- * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default.
- * @returns {IterableIterator} The found files.
- * @private
- */
- _iterateFilesWithDirectory(directoryPath, dotfiles) {
- debug(`Directory: ${directoryPath}`);
-
- return this._iterateFilesRecursive(directoryPath, {
- dotfiles,
- recursive: true,
- selector: null,
- });
- }
-
- /**
- * Iterate files which are matched by a given glob pattern.
- * @param {string} pattern The glob pattern to iterate files.
- * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default.
- * @returns {IterableIterator} The found files.
- * @private
- */
- _iterateFilesWithGlob(pattern, dotfiles) {
- debug(`Glob: ${pattern}`);
-
- const { cwd } = internalSlotsMap.get(this);
- const directoryPath = path.resolve(cwd, getGlobParent(pattern));
- const absolutePath = path.resolve(cwd, pattern);
- const globPart = absolutePath.slice(directoryPath.length + 1);
-
- /*
- * recursive if there are `**` or path separators in the glob part.
- * Otherwise, patterns such as `src/*.js`, it doesn't need recursive.
- */
- const recursive = /\*\*|\/|\\/u.test(globPart);
- const selector = new Minimatch(absolutePath, minimatchOpts);
-
- debug(`recursive? ${recursive}`);
-
- return this._iterateFilesRecursive(directoryPath, {
- dotfiles,
- recursive,
- selector,
- });
- }
-
- /**
- * Iterate files in a given path.
- * @param {string} directoryPath The path to the target directory.
- * @param {Object} options The options to iterate files.
- * @param {boolean} [options.dotfiles] If `true` then it doesn't skip dot files by default.
- * @param {boolean} [options.recursive] If `true` then it dives into sub directories.
- * @param {InstanceType} [options.selector] The matcher to choose files.
- * @returns {IterableIterator} The found files.
- * @private
- */
- *_iterateFilesRecursive(directoryPath, options) {
- debug(`Enter the directory: ${directoryPath}`);
- const { configArrayFactory } = internalSlotsMap.get(this);
-
- /** @type {ConfigArray|null} */
- let config = null;
-
- // Enumerate the files of this directory.
- for (const entry of readdirSafeSync(directoryPath)) {
- const filePath = path.join(directoryPath, entry.name);
- const fileInfo = entry.isSymbolicLink()
- ? statSafeSync(filePath)
- : entry;
-
- if (!fileInfo) {
- continue;
- }
-
- // Check if the file is matched.
- if (fileInfo.isFile()) {
- if (!config) {
- config = configArrayFactory.getConfigArrayForFile(
- filePath,
-
- /*
- * We must ignore `ConfigurationNotFoundError` at this
- * point because we don't know if target files exist in
- * this directory.
- */
- { ignoreNotFoundError: true },
- );
- }
- const matched = options.selector
- ? // Started with a glob pattern; choose by the pattern.
- options.selector.match(filePath)
- : // Started with a directory path; choose by file extensions.
- this.isTargetPath(filePath, config);
-
- if (matched) {
- const ignored = this._isIgnoredFile(filePath, {
- ...options,
- config,
- });
- const flag = ignored ? IGNORED_SILENTLY : NONE;
-
- debug(
- `Yield: ${entry.name}${ignored ? " but ignored" : ""}`,
- );
- yield {
- config: configArrayFactory.getConfigArrayForFile(
- filePath,
- ),
- filePath,
- flag,
- };
- } else {
- debug(`Didn't match: ${entry.name}`);
- }
-
- // Dive into the sub directory.
- } else if (options.recursive && fileInfo.isDirectory()) {
- if (!config) {
- config = configArrayFactory.getConfigArrayForFile(
- filePath,
- { ignoreNotFoundError: true },
- );
- }
- const ignored = this._isIgnoredFile(filePath + path.sep, {
- ...options,
- config,
- });
-
- if (!ignored) {
- yield* this._iterateFilesRecursive(filePath, options);
- }
- }
- }
-
- debug(`Leave the directory: ${directoryPath}`);
- }
-
- /**
- * Check if a given file should be ignored.
- * @param {string} filePath The path to a file to check.
- * @param {Object} options Options
- * @param {ConfigArray} [options.config] The config for this file.
- * @param {boolean} [options.dotfiles] If `true` then this is not ignore dot files by default.
- * @param {boolean} [options.direct] If `true` then this is a direct specified file.
- * @returns {boolean} `true` if the file should be ignored.
- * @private
- */
- _isIgnoredFile(
- filePath,
- { config: providedConfig, dotfiles = false, direct = false },
- ) {
- const { configArrayFactory, defaultIgnores, ignoreFlag } =
- internalSlotsMap.get(this);
-
- if (ignoreFlag) {
- const config =
- providedConfig ||
- configArrayFactory.getConfigArrayForFile(filePath, {
- ignoreNotFoundError: true,
- });
- const ignores =
- config.extractConfig(filePath).ignores || defaultIgnores;
-
- return ignores(filePath, dotfiles);
- }
-
- return !direct && defaultIgnores(filePath, dotfiles);
- }
+
+ /**
+ * Initialize this enumerator.
+ * @param {FileEnumeratorOptions} options The options.
+ */
+ constructor({
+ cwd = process.cwd(),
+ configArrayFactory = new CascadingConfigArrayFactory({
+ cwd,
+ getEslintRecommendedConfig: () => require("@eslint/js").configs.recommended,
+ getEslintAllConfig: () => require("@eslint/js").configs.all
+ }),
+ extensions = null,
+ globInputPaths = true,
+ errorOnUnmatchedPattern = true,
+ ignore = true
+ } = {}) {
+ internalSlotsMap.set(this, {
+ configArrayFactory,
+ cwd,
+ defaultIgnores: IgnorePattern.createDefaultIgnore(cwd),
+ extensionRegExp: createExtensionRegExp(extensions),
+ globInputPaths,
+ errorOnUnmatchedPattern,
+ ignoreFlag: ignore
+ });
+ }
+
+ /**
+ * Check if a given file is target or not.
+ * @param {string} filePath The path to a candidate file.
+ * @param {ConfigArray} [providedConfig] Optional. The configuration for the file.
+ * @returns {boolean} `true` if the file is a target.
+ */
+ isTargetPath(filePath, providedConfig) {
+ const {
+ configArrayFactory,
+ extensionRegExp
+ } = internalSlotsMap.get(this);
+
+ // If `--ext` option is present, use it.
+ if (extensionRegExp) {
+ return extensionRegExp.test(filePath);
+ }
+
+ // `.js` file is target by default.
+ if (filePath.endsWith(".js")) {
+ return true;
+ }
+
+ // use `overrides[].files` to check additional targets.
+ const config =
+ providedConfig ||
+ configArrayFactory.getConfigArrayForFile(
+ filePath,
+ { ignoreNotFoundError: true }
+ );
+
+ return config.isAdditionalTargetPath(filePath);
+ }
+
+ /**
+ * Iterate files which are matched by given glob patterns.
+ * @param {string|string[]} patternOrPatterns The glob patterns to iterate files.
+ * @throws {NoFilesFoundError|AllFilesIgnoredError} On an unmatched pattern.
+ * @returns {IterableIterator} The found files.
+ */
+ *iterateFiles(patternOrPatterns) {
+ const { globInputPaths, errorOnUnmatchedPattern } = internalSlotsMap.get(this);
+ const patterns = Array.isArray(patternOrPatterns)
+ ? patternOrPatterns
+ : [patternOrPatterns];
+
+ debug("Start to iterate files: %o", patterns);
+
+ // The set of paths to remove duplicate.
+ const set = new Set();
+
+ for (const pattern of patterns) {
+ let foundRegardlessOfIgnored = false;
+ let found = false;
+
+ // Skip empty string.
+ if (!pattern) {
+ continue;
+ }
+
+ // Iterate files of this pattern.
+ for (const { config, filePath, flag } of this._iterateFiles(pattern)) {
+ foundRegardlessOfIgnored = true;
+ if (flag === IGNORED_SILENTLY) {
+ continue;
+ }
+ found = true;
+
+ // Remove duplicate paths while yielding paths.
+ if (!set.has(filePath)) {
+ set.add(filePath);
+ yield {
+ config,
+ filePath,
+ ignored: flag === IGNORED
+ };
+ }
+ }
+
+ // Raise an error if any files were not found.
+ if (errorOnUnmatchedPattern) {
+ if (!foundRegardlessOfIgnored) {
+ throw new NoFilesFoundError(
+ pattern,
+ !globInputPaths && isGlob(pattern)
+ );
+ }
+ if (!found) {
+ throw new AllFilesIgnoredError(pattern);
+ }
+ }
+ }
+
+ debug(`Complete iterating files: ${JSON.stringify(patterns)}`);
+ }
+
+ /**
+ * Iterate files which are matched by a given glob pattern.
+ * @param {string} pattern The glob pattern to iterate files.
+ * @returns {IterableIterator} The found files.
+ */
+ _iterateFiles(pattern) {
+ const { cwd, globInputPaths } = internalSlotsMap.get(this);
+ const absolutePath = path.resolve(cwd, pattern);
+ const isDot = dotfilesPattern.test(pattern);
+ const stat = statSafeSync(absolutePath);
+
+ if (stat && stat.isDirectory()) {
+ return this._iterateFilesWithDirectory(absolutePath, isDot);
+ }
+ if (stat && stat.isFile()) {
+ return this._iterateFilesWithFile(absolutePath);
+ }
+ if (globInputPaths && isGlobPattern(pattern)) {
+ return this._iterateFilesWithGlob(pattern, isDot);
+ }
+
+ return [];
+ }
+
+ /**
+ * Iterate a file which is matched by a given path.
+ * @param {string} filePath The path to the target file.
+ * @returns {IterableIterator} The found files.
+ * @private
+ */
+ _iterateFilesWithFile(filePath) {
+ debug(`File: ${filePath}`);
+
+ const { configArrayFactory } = internalSlotsMap.get(this);
+ const config = configArrayFactory.getConfigArrayForFile(filePath);
+ const ignored = this._isIgnoredFile(filePath, { config, direct: true });
+ const flag = ignored ? IGNORED : NONE;
+
+ return [{ config, filePath, flag }];
+ }
+
+ /**
+ * Iterate files in a given path.
+ * @param {string} directoryPath The path to the target directory.
+ * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default.
+ * @returns {IterableIterator} The found files.
+ * @private
+ */
+ _iterateFilesWithDirectory(directoryPath, dotfiles) {
+ debug(`Directory: ${directoryPath}`);
+
+ return this._iterateFilesRecursive(
+ directoryPath,
+ { dotfiles, recursive: true, selector: null }
+ );
+ }
+
+ /**
+ * Iterate files which are matched by a given glob pattern.
+ * @param {string} pattern The glob pattern to iterate files.
+ * @param {boolean} dotfiles If `true` then it doesn't skip dot files by default.
+ * @returns {IterableIterator} The found files.
+ * @private
+ */
+ _iterateFilesWithGlob(pattern, dotfiles) {
+ debug(`Glob: ${pattern}`);
+
+ const { cwd } = internalSlotsMap.get(this);
+ const directoryPath = path.resolve(cwd, getGlobParent(pattern));
+ const absolutePath = path.resolve(cwd, pattern);
+ const globPart = absolutePath.slice(directoryPath.length + 1);
+
+ /*
+ * recursive if there are `**` or path separators in the glob part.
+ * Otherwise, patterns such as `src/*.js`, it doesn't need recursive.
+ */
+ const recursive = /\*\*|\/|\\/u.test(globPart);
+ const selector = new Minimatch(absolutePath, minimatchOpts);
+
+ debug(`recursive? ${recursive}`);
+
+ return this._iterateFilesRecursive(
+ directoryPath,
+ { dotfiles, recursive, selector }
+ );
+ }
+
+ /**
+ * Iterate files in a given path.
+ * @param {string} directoryPath The path to the target directory.
+ * @param {Object} options The options to iterate files.
+ * @param {boolean} [options.dotfiles] If `true` then it doesn't skip dot files by default.
+ * @param {boolean} [options.recursive] If `true` then it dives into sub directories.
+ * @param {InstanceType} [options.selector] The matcher to choose files.
+ * @returns {IterableIterator} The found files.
+ * @private
+ */
+ *_iterateFilesRecursive(directoryPath, options) {
+ debug(`Enter the directory: ${directoryPath}`);
+ const { configArrayFactory } = internalSlotsMap.get(this);
+
+ /** @type {ConfigArray|null} */
+ let config = null;
+
+ // Enumerate the files of this directory.
+ for (const entry of readdirSafeSync(directoryPath)) {
+ const filePath = path.join(directoryPath, entry.name);
+ const fileInfo = entry.isSymbolicLink() ? statSafeSync(filePath) : entry;
+
+ if (!fileInfo) {
+ continue;
+ }
+
+ // Check if the file is matched.
+ if (fileInfo.isFile()) {
+ if (!config) {
+ config = configArrayFactory.getConfigArrayForFile(
+ filePath,
+
+ /*
+ * We must ignore `ConfigurationNotFoundError` at this
+ * point because we don't know if target files exist in
+ * this directory.
+ */
+ { ignoreNotFoundError: true }
+ );
+ }
+ const matched = options.selector
+
+ // Started with a glob pattern; choose by the pattern.
+ ? options.selector.match(filePath)
+
+ // Started with a directory path; choose by file extensions.
+ : this.isTargetPath(filePath, config);
+
+ if (matched) {
+ const ignored = this._isIgnoredFile(filePath, { ...options, config });
+ const flag = ignored ? IGNORED_SILENTLY : NONE;
+
+ debug(`Yield: ${entry.name}${ignored ? " but ignored" : ""}`);
+ yield {
+ config: configArrayFactory.getConfigArrayForFile(filePath),
+ filePath,
+ flag
+ };
+ } else {
+ debug(`Didn't match: ${entry.name}`);
+ }
+
+ // Dive into the sub directory.
+ } else if (options.recursive && fileInfo.isDirectory()) {
+ if (!config) {
+ config = configArrayFactory.getConfigArrayForFile(
+ filePath,
+ { ignoreNotFoundError: true }
+ );
+ }
+ const ignored = this._isIgnoredFile(
+ filePath + path.sep,
+ { ...options, config }
+ );
+
+ if (!ignored) {
+ yield* this._iterateFilesRecursive(filePath, options);
+ }
+ }
+ }
+
+ debug(`Leave the directory: ${directoryPath}`);
+ }
+
+ /**
+ * Check if a given file should be ignored.
+ * @param {string} filePath The path to a file to check.
+ * @param {Object} options Options
+ * @param {ConfigArray} [options.config] The config for this file.
+ * @param {boolean} [options.dotfiles] If `true` then this is not ignore dot files by default.
+ * @param {boolean} [options.direct] If `true` then this is a direct specified file.
+ * @returns {boolean} `true` if the file should be ignored.
+ * @private
+ */
+ _isIgnoredFile(filePath, {
+ config: providedConfig,
+ dotfiles = false,
+ direct = false
+ }) {
+ const {
+ configArrayFactory,
+ defaultIgnores,
+ ignoreFlag
+ } = internalSlotsMap.get(this);
+
+ if (ignoreFlag) {
+ const config =
+ providedConfig ||
+ configArrayFactory.getConfigArrayForFile(
+ filePath,
+ { ignoreNotFoundError: true }
+ );
+ const ignores =
+ config.extractConfig(filePath).ignores || defaultIgnores;
+
+ return ignores(filePath, dotfiles);
+ }
+
+ return !direct && defaultIgnores(filePath, dotfiles);
+ }
}
//------------------------------------------------------------------------------
diff --git a/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json b/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json
index cf3205291..bcd35e504 100644
--- a/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json
+++ b/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json
@@ -1,18 +1,46 @@
[
- {
- "name": "html",
- "description": "Outputs results to HTML. The `html` formatter is useful for visual presentation in the browser."
- },
- {
- "name": "json-with-metadata",
- "description": "Outputs JSON-serialized results. The `json-with-metadata` provides the same linting results as the [`json`](#json) formatter with additional metadata about the rules applied. The linting results are included in the `results` property and the rules metadata is included in the `metadata` property.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
- },
- {
- "name": "json",
- "description": "Outputs JSON-serialized results. The `json` formatter is useful when you want to programmatically work with the CLI's linting results.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
- },
- {
- "name": "stylish",
- "description": "Human-readable output format. This is the default formatter."
- }
-]
+ {
+ "name": "checkstyle",
+ "description": "Outputs results to the [Checkstyle](https://checkstyle.sourceforge.io/) format."
+ },
+ {
+ "name": "compact",
+ "description": "Human-readable output format. Mimics the default output of JSHint."
+ },
+ {
+ "name": "html",
+ "description": "Outputs results to HTML. The `html` formatter is useful for visual presentation in the browser."
+ },
+ {
+ "name": "jslint-xml",
+ "description": "Outputs results to format compatible with the [JSLint Jenkins plugin](https://plugins.jenkins.io/jslint/)."
+ },
+ {
+ "name": "json-with-metadata",
+ "description": "Outputs JSON-serialized results. The `json-with-metadata` provides the same linting results as the [`json`](#json) formatter with additional metadata about the rules applied. The linting results are included in the `results` property and the rules metadata is included in the `metadata` property.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
+ },
+ {
+ "name": "json",
+ "description": "Outputs JSON-serialized results. The `json` formatter is useful when you want to programmatically work with the CLI's linting results.\n\nAlternatively, you can use the [ESLint Node.js API](../../integrate/nodejs-api) to programmatically use ESLint."
+ },
+ {
+ "name": "junit",
+ "description": "Outputs results to format compatible with the [JUnit Jenkins plugin](https://plugins.jenkins.io/junit/)."
+ },
+ {
+ "name": "stylish",
+ "description": "Human-readable output format. This is the default formatter."
+ },
+ {
+ "name": "tap",
+ "description": "Outputs results to the [Test Anything Protocol (TAP)](https://testanything.org/) specification format."
+ },
+ {
+ "name": "unix",
+ "description": "Outputs results to a format similar to many commands in UNIX-like systems. Parsable with tools such as [grep](https://www.gnu.org/software/grep/manual/grep.html), [sed](https://www.gnu.org/software/sed/manual/sed.html), and [awk](https://www.gnu.org/software/gawk/manual/gawk.html)."
+ },
+ {
+ "name": "visualstudio",
+ "description": "Outputs results to format compatible with the integrated terminal of the [Visual Studio](https://visualstudio.microsoft.com/) IDE. When using Visual Studio, you can click on the linting results in the integrated terminal to go to the issue in the source code."
+ }
+]
\ No newline at end of file
diff --git a/node_modules/eslint/lib/cli-engine/formatters/html.js b/node_modules/eslint/lib/cli-engine/formatters/html.js
index ef8d445ab..1aa66fcef 100644
--- a/node_modules/eslint/lib/cli-engine/formatters/html.js
+++ b/node_modules/eslint/lib/cli-engine/formatters/html.js
@@ -8,22 +8,22 @@
// Helpers
//------------------------------------------------------------------------------
-const encodeHTML = (function () {
- const encodeHTMLRules = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- };
- const matchHTML = /[&<>"']/gu;
-
- return function (code) {
- return code
- ? code.toString().replace(matchHTML, m => encodeHTMLRules[m] || m)
- : "";
- };
-})();
+const encodeHTML = (function() {
+ const encodeHTMLRules = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'"
+ };
+ const matchHTML = /[&<>"']/ug;
+
+ return function(code) {
+ return code
+ ? code.toString().replace(matchHTML, m => encodeHTMLRules[m] || m)
+ : "";
+ };
+}());
/**
* Get the final HTML document.
@@ -31,9 +31,9 @@ const encodeHTML = (function () {
* @returns {string} HTML document.
*/
function pageTemplate(it) {
- const { reportColor, reportSummary, date, results } = it;
+ const { reportColor, reportSummary, date, results } = it;
- return `
+ return `
@@ -182,11 +182,11 @@ function pageTemplate(it) {
/**
* Given a word and a count, append an s if count is not one.
* @param {string} word A word in its singular form.
- * @param {number} count A number controlling whether word should be pluralized.
+ * @param {int} count A number controlling whether word should be pluralized.
* @returns {string} The original word with an s on the end if count is not one.
*/
function pluralize(word, count) {
- return count === 1 ? word : `${word}s`;
+ return (count === 1 ? word : `${word}s`);
}
/**
@@ -196,29 +196,29 @@ function pluralize(word, count) {
* @returns {string} The formatted string, pluralized where necessary
*/
function renderSummary(totalErrors, totalWarnings) {
- const totalProblems = totalErrors + totalWarnings;
- let renderedText = `${totalProblems} ${pluralize("problem", totalProblems)}`;
+ const totalProblems = totalErrors + totalWarnings;
+ let renderedText = `${totalProblems} ${pluralize("problem", totalProblems)}`;
- if (totalProblems !== 0) {
- renderedText += ` (${totalErrors} ${pluralize("error", totalErrors)}, ${totalWarnings} ${pluralize("warning", totalWarnings)})`;
- }
- return renderedText;
+ if (totalProblems !== 0) {
+ renderedText += ` (${totalErrors} ${pluralize("error", totalErrors)}, ${totalWarnings} ${pluralize("warning", totalWarnings)})`;
+ }
+ return renderedText;
}
/**
* Get the color based on whether there are errors/warnings...
* @param {string} totalErrors Total errors
* @param {string} totalWarnings Total warnings
- * @returns {number} The color code (0 = green, 1 = yellow, 2 = red)
+ * @returns {int} The color code (0 = green, 1 = yellow, 2 = red)
*/
function renderColor(totalErrors, totalWarnings) {
- if (totalErrors !== 0) {
- return 2;
- }
- if (totalWarnings !== 0) {
- return 1;
- }
- return 0;
+ if (totalErrors !== 0) {
+ return 2;
+ }
+ if (totalWarnings !== 0) {
+ return 1;
+ }
+ return 0;
}
/**
@@ -227,18 +227,18 @@ function renderColor(totalErrors, totalWarnings) {
* @returns {string} HTML (table row) describing the message.
*/
function messageTemplate(it) {
- const {
- parentIndex,
- lineNumber,
- columnNumber,
- severityNumber,
- severityName,
- message,
- ruleUrl,
- ruleId,
- } = it;
-
- return `
+ const {
+ parentIndex,
+ lineNumber,
+ columnNumber,
+ severityNumber,
+ severityName,
+ message,
+ ruleUrl,
+ ruleId
+ } = it;
+
+ return `
| ${lineNumber}:${columnNumber} |
${severityName} |
@@ -253,42 +253,41 @@ function messageTemplate(it) {
/**
* Get HTML (table rows) describing the messages.
* @param {Array} messages Messages.
- * @param {number} parentIndex Index of the parent HTML row.
+ * @param {int} parentIndex Index of the parent HTML row.
* @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis.
* @returns {string} HTML (table rows) describing the messages.
*/
function renderMessages(messages, parentIndex, rulesMeta) {
- /**
- * Get HTML (table row) describing a message.
- * @param {Object} message Message.
- * @returns {string} HTML (table row) describing a message.
- */
- return messages
- .map(message => {
- const lineNumber = message.line || 0;
- const columnNumber = message.column || 0;
- let ruleUrl;
-
- if (rulesMeta) {
- const meta = rulesMeta[message.ruleId];
-
- if (meta && meta.docs && meta.docs.url) {
- ruleUrl = meta.docs.url;
- }
- }
-
- return messageTemplate({
- parentIndex,
- lineNumber,
- columnNumber,
- severityNumber: message.severity,
- severityName: message.severity === 1 ? "Warning" : "Error",
- message: message.message,
- ruleId: message.ruleId,
- ruleUrl,
- });
- })
- .join("\n");
+
+ /**
+ * Get HTML (table row) describing a message.
+ * @param {Object} message Message.
+ * @returns {string} HTML (table row) describing a message.
+ */
+ return messages.map(message => {
+ const lineNumber = message.line || 0;
+ const columnNumber = message.column || 0;
+ let ruleUrl;
+
+ if (rulesMeta) {
+ const meta = rulesMeta[message.ruleId];
+
+ if (meta && meta.docs && meta.docs.url) {
+ ruleUrl = meta.docs.url;
+ }
+ }
+
+ return messageTemplate({
+ parentIndex,
+ lineNumber,
+ columnNumber,
+ severityNumber: message.severity,
+ severityName: message.severity === 1 ? "Warning" : "Error",
+ message: message.message,
+ ruleId: message.ruleId,
+ ruleUrl
+ });
+ }).join("\n");
}
/**
@@ -297,9 +296,9 @@ function renderMessages(messages, parentIndex, rulesMeta) {
* @returns {string} HTML (table row) describing the result for the file.
*/
function resultTemplate(it) {
- const { color, index, filePath, summary } = it;
+ const { color, index, filePath, summary } = it;
- return `
+ return `
|
[+] ${encodeHTML(filePath)}
@@ -316,44 +315,37 @@ function resultTemplate(it) {
* @returns {string} HTML string describing the results.
*/
function renderResults(results, rulesMeta) {
- return results
- .map(
- (result, index) =>
- resultTemplate({
- index,
- color: renderColor(result.errorCount, result.warningCount),
- filePath: result.filePath,
- summary: renderSummary(
- result.errorCount,
- result.warningCount,
- ),
- }) + renderMessages(result.messages, index, rulesMeta),
- )
- .join("\n");
+ return results.map((result, index) => resultTemplate({
+ index,
+ color: renderColor(result.errorCount, result.warningCount),
+ filePath: result.filePath,
+ summary: renderSummary(result.errorCount, result.warningCount)
+ }) + renderMessages(result.messages, index, rulesMeta)).join("\n");
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
-module.exports = function (results, data) {
- let totalErrors, totalWarnings;
+module.exports = function(results, data) {
+ let totalErrors,
+ totalWarnings;
- const metaData = data ? data.rulesMeta : {};
+ const metaData = data ? data.rulesMeta : {};
- totalErrors = 0;
- totalWarnings = 0;
+ totalErrors = 0;
+ totalWarnings = 0;
- // Iterate over results to get totals
- results.forEach(result => {
- totalErrors += result.errorCount;
- totalWarnings += result.warningCount;
- });
+ // Iterate over results to get totals
+ results.forEach(result => {
+ totalErrors += result.errorCount;
+ totalWarnings += result.warningCount;
+ });
- return pageTemplate({
- date: new Date(),
- reportColor: renderColor(totalErrors, totalWarnings),
- reportSummary: renderSummary(totalErrors, totalWarnings),
- results: renderResults(results, metaData),
- });
+ return pageTemplate({
+ date: new Date(),
+ reportColor: renderColor(totalErrors, totalWarnings),
+ reportSummary: renderSummary(totalErrors, totalWarnings),
+ results: renderResults(results, metaData)
+ });
};
diff --git a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js
index 44c785c74..689947154 100644
--- a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js
+++ b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js
@@ -8,9 +8,9 @@
// Public Interface
//------------------------------------------------------------------------------
-module.exports = function (results, data) {
- return JSON.stringify({
- results,
- metadata: data,
- });
+module.exports = function(results, data) {
+ return JSON.stringify({
+ results,
+ metadata: data
+ });
};
diff --git a/node_modules/eslint/lib/cli-engine/formatters/json.js b/node_modules/eslint/lib/cli-engine/formatters/json.js
index 230f5c587..82138af18 100644
--- a/node_modules/eslint/lib/cli-engine/formatters/json.js
+++ b/node_modules/eslint/lib/cli-engine/formatters/json.js
@@ -8,6 +8,6 @@
// Public Interface
//------------------------------------------------------------------------------
-module.exports = function (results) {
- return JSON.stringify(results);
+module.exports = function(results) {
+ return JSON.stringify(results);
};
diff --git a/node_modules/eslint/lib/cli-engine/formatters/stylish.js b/node_modules/eslint/lib/cli-engine/formatters/stylish.js
index 18aa58154..a808448b6 100644
--- a/node_modules/eslint/lib/cli-engine/formatters/stylish.js
+++ b/node_modules/eslint/lib/cli-engine/formatters/stylish.js
@@ -5,8 +5,8 @@
"use strict";
const chalk = require("chalk"),
- util = require("node:util"),
- table = require("../../shared/text-table");
+ stripAnsi = require("strip-ansi"),
+ table = require("text-table");
//------------------------------------------------------------------------------
// Helpers
@@ -15,108 +15,87 @@ const chalk = require("chalk"),
/**
* Given a word and a count, append an s if count is not one.
* @param {string} word A word in its singular form.
- * @param {number} count A number controlling whether word should be pluralized.
+ * @param {int} count A number controlling whether word should be pluralized.
* @returns {string} The original word with an s on the end if count is not one.
*/
function pluralize(word, count) {
- return count === 1 ? word : `${word}s`;
+ return (count === 1 ? word : `${word}s`);
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
-module.exports = function (results) {
- let output = "\n",
- errorCount = 0,
- warningCount = 0,
- fixableErrorCount = 0,
- fixableWarningCount = 0,
- summaryColor = "yellow";
-
- results.forEach(result => {
- const messages = result.messages;
-
- if (messages.length === 0) {
- return;
- }
-
- errorCount += result.errorCount;
- warningCount += result.warningCount;
- fixableErrorCount += result.fixableErrorCount;
- fixableWarningCount += result.fixableWarningCount;
-
- output += `${chalk.underline(result.filePath)}\n`;
-
- output += `${table(
- messages.map(message => {
- let messageType;
-
- if (message.fatal || message.severity === 2) {
- messageType = chalk.red("error");
- summaryColor = "red";
- } else {
- messageType = chalk.yellow("warning");
- }
-
- return [
- "",
- String(message.line || 0),
- String(message.column || 0),
- messageType,
- message.message.replace(/([^ ])\.$/u, "$1"),
- chalk.dim(message.ruleId || ""),
- ];
- }),
- {
- align: ["", "r", "l"],
- stringLength(str) {
- return util.stripVTControlCharacters(str).length;
- },
- },
- )
- .split("\n")
- .map(el =>
- el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) =>
- chalk.dim(`${p1}:${p2}`),
- ),
- )
- .join("\n")}\n\n`;
- });
-
- const total = errorCount + warningCount;
-
- if (total > 0) {
- output += chalk[summaryColor].bold(
- [
- "\u2716 ",
- total,
- pluralize(" problem", total),
- " (",
- errorCount,
- pluralize(" error", errorCount),
- ", ",
- warningCount,
- pluralize(" warning", warningCount),
- ")\n",
- ].join(""),
- );
-
- if (fixableErrorCount > 0 || fixableWarningCount > 0) {
- output += chalk[summaryColor].bold(
- [
- " ",
- fixableErrorCount,
- pluralize(" error", fixableErrorCount),
- " and ",
- fixableWarningCount,
- pluralize(" warning", fixableWarningCount),
- " potentially fixable with the `--fix` option.\n",
- ].join(""),
- );
- }
- }
-
- // Resets output color, for prevent change on top level
- return total > 0 ? chalk.reset(output) : "";
+module.exports = function(results) {
+
+ let output = "\n",
+ errorCount = 0,
+ warningCount = 0,
+ fixableErrorCount = 0,
+ fixableWarningCount = 0,
+ summaryColor = "yellow";
+
+ results.forEach(result => {
+ const messages = result.messages;
+
+ if (messages.length === 0) {
+ return;
+ }
+
+ errorCount += result.errorCount;
+ warningCount += result.warningCount;
+ fixableErrorCount += result.fixableErrorCount;
+ fixableWarningCount += result.fixableWarningCount;
+
+ output += `${chalk.underline(result.filePath)}\n`;
+
+ output += `${table(
+ messages.map(message => {
+ let messageType;
+
+ if (message.fatal || message.severity === 2) {
+ messageType = chalk.red("error");
+ summaryColor = "red";
+ } else {
+ messageType = chalk.yellow("warning");
+ }
+
+ return [
+ "",
+ message.line || 0,
+ message.column || 0,
+ messageType,
+ message.message.replace(/([^ ])\.$/u, "$1"),
+ chalk.dim(message.ruleId || "")
+ ];
+ }),
+ {
+ align: ["", "r", "l"],
+ stringLength(str) {
+ return stripAnsi(str).length;
+ }
+ }
+ ).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`;
+ });
+
+ const total = errorCount + warningCount;
+
+ if (total > 0) {
+ output += chalk[summaryColor].bold([
+ "\u2716 ", total, pluralize(" problem", total),
+ " (", errorCount, pluralize(" error", errorCount), ", ",
+ warningCount, pluralize(" warning", warningCount), ")\n"
+ ].join(""));
+
+ if (fixableErrorCount > 0 || fixableWarningCount > 0) {
+ output += chalk[summaryColor].bold([
+ " ", fixableErrorCount, pluralize(" error", fixableErrorCount), " and ",
+ fixableWarningCount, pluralize(" warning", fixableWarningCount),
+ " potentially fixable with the `--fix` option.\n"
+ ].join(""));
+ }
+ }
+
+ // Resets output color, for prevent change on top level
+ return total > 0 ? chalk.reset(output) : "";
};
diff --git a/node_modules/eslint/lib/cli-engine/hash.js b/node_modules/eslint/lib/cli-engine/hash.js
index 4c306b9b4..8e467734a 100644
--- a/node_modules/eslint/lib/cli-engine/hash.js
+++ b/node_modules/eslint/lib/cli-engine/hash.js
@@ -25,7 +25,7 @@ const murmur = require("imurmurhash");
* @returns {string} the hash
*/
function hash(str) {
- return murmur(str).result().toString(36);
+ return murmur(str).result().toString(36);
}
//------------------------------------------------------------------------------
diff --git a/node_modules/eslint/lib/cli-engine/index.js b/node_modules/eslint/lib/cli-engine/index.js
index bba3fb0b8..52e45a6d7 100644
--- a/node_modules/eslint/lib/cli-engine/index.js
+++ b/node_modules/eslint/lib/cli-engine/index.js
@@ -3,5 +3,5 @@
const { CLIEngine } = require("./cli-engine");
module.exports = {
- CLIEngine,
+ CLIEngine
};
diff --git a/node_modules/eslint/lib/cli-engine/lint-result-cache.js b/node_modules/eslint/lib/cli-engine/lint-result-cache.js
index 48f42e19b..97d2ee40b 100644
--- a/node_modules/eslint/lib/cli-engine/lint-result-cache.js
+++ b/node_modules/eslint/lib/cli-engine/lint-result-cache.js
@@ -8,21 +8,15 @@
// Requirements
//-----------------------------------------------------------------------------
-const fs = require("node:fs");
+const assert = require("assert");
+const fs = require("fs");
const fileEntryCache = require("file-entry-cache");
const stringify = require("json-stable-stringify-without-jsonify");
const pkg = require("../../package.json");
-const assert = require("../shared/assert");
const hash = require("./hash");
const debug = require("debug")("eslint:lint-result-cache");
-//------------------------------------------------------------------------------
-// Typedefs
-//------------------------------------------------------------------------------
-
-/** @typedef {import("../types").Linter.Config} Config */
-
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
@@ -32,8 +26,8 @@ const nodeVersion = process && process.version;
const validCacheStrategies = ["metadata", "content"];
const invalidCacheStrategyErrorMessage = `Cache strategy must be one of: ${validCacheStrategies
- .map(strategy => `"${strategy}"`)
- .join(", ")}`;
+ .map(strategy => `"${strategy}"`)
+ .join(", ")}`;
/**
* Tests whether a provided cacheStrategy is valid
@@ -41,23 +35,22 @@ const invalidCacheStrategyErrorMessage = `Cache strategy must be one of: ${valid
* @returns {boolean} true if `cacheStrategy` is one of `validCacheStrategies`; false otherwise
*/
function isValidCacheStrategy(cacheStrategy) {
- return validCacheStrategies.includes(cacheStrategy);
+ return (
+ validCacheStrategies.includes(cacheStrategy)
+ );
}
/**
* Calculates the hash of the config
- * @param {Config} config The config.
+ * @param {ConfigArray} config The config.
* @returns {string} The hash of the config
*/
function hashOfConfigFor(config) {
- if (!configHashCache.has(config)) {
- configHashCache.set(
- config,
- hash(`${pkg.version}_${nodeVersion}_${stringify(config)}`),
- );
- }
-
- return configHashCache.get(config);
+ if (!configHashCache.has(config)) {
+ configHashCache.set(config, hash(`${pkg.version}_${nodeVersion}_${stringify(config)}`));
+ }
+
+ return configHashCache.get(config);
}
//-----------------------------------------------------------------------------
@@ -70,151 +63,141 @@ function hashOfConfigFor(config) {
* serialize and adding them back in on retrieval.
*/
class LintResultCache {
- /**
- * Creates a new LintResultCache instance.
- * @param {string} cacheFileLocation The cache file location.
- * @param {"metadata" | "content"} cacheStrategy The cache strategy to use.
- */
- constructor(cacheFileLocation, cacheStrategy) {
- assert(cacheFileLocation, "Cache file location is required");
- assert(cacheStrategy, "Cache strategy is required");
- assert(
- isValidCacheStrategy(cacheStrategy),
- invalidCacheStrategyErrorMessage,
- );
-
- debug(`Caching results to ${cacheFileLocation}`);
-
- const useChecksum = cacheStrategy === "content";
-
- debug(`Using "${cacheStrategy}" strategy to detect changes`);
-
- this.fileEntryCache = fileEntryCache.create(
- cacheFileLocation,
- void 0,
- useChecksum,
- );
- this.cacheFileLocation = cacheFileLocation;
- }
-
- /**
- * Retrieve cached lint results for a given file path, if present in the
- * cache. If the file is present and has not been changed, rebuild any
- * missing result information.
- * @param {string} filePath The file for which to retrieve lint results.
- * @param {Config} config The config of the file.
- * @returns {Object|null} The rebuilt lint results, or null if the file is
- * changed or not in the filesystem.
- */
- getCachedLintResults(filePath, config) {
- const cachedResults = this.getValidCachedLintResults(filePath, config);
-
- if (!cachedResults) {
- return cachedResults;
- }
-
- /*
- * Shallow clone the object to ensure that any properties added or modified afterwards
- * will not be accidentally stored in the cache file when `reconcile()` is called.
- * https://github.com/eslint/eslint/issues/13507
- * All intentional changes to the cache file must be done through `setCachedLintResults()`.
- */
- const results = { ...cachedResults };
-
- // If source is present but null, need to reread the file from the filesystem.
- if (results.source === null) {
- debug(
- `Rereading cached result source from filesystem: ${filePath}`,
- );
- results.source = fs.readFileSync(filePath, "utf-8");
- }
-
- return results;
- }
-
- /**
- * Retrieve cached lint results for a given file path, if present in the
- * cache and still valid.
- * @param {string} filePath The file for which to retrieve lint results.
- * @param {Config} config The config of the file.
- * @returns {Object|null} The cached lint results if present in the cache
- * and still valid; null otherwise.
- */
- getValidCachedLintResults(filePath, config) {
- /*
- * Cached lint results are valid if and only if:
- * 1. The file is present in the filesystem
- * 2. The file has not changed since the time it was previously linted
- * 3. The ESLint configuration has not changed since the time the file
- * was previously linted
- * If any of these are not true, we will not reuse the lint results.
- */
- const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
-
- if (fileDescriptor.notFound) {
- debug(`File not found on the file system: ${filePath}`);
- return null;
- }
-
- const hashOfConfig = hashOfConfigFor(config);
- const changed =
- fileDescriptor.changed ||
- fileDescriptor.meta.hashOfConfig !== hashOfConfig;
-
- if (changed) {
- debug(`Cache entry not found or no longer valid: ${filePath}`);
- return null;
- }
-
- return fileDescriptor.meta.results;
- }
-
- /**
- * Set the cached lint results for a given file path, after removing any
- * information that will be both unnecessary and difficult to serialize.
- * Avoids caching results with an "output" property (meaning fixes were
- * applied), to prevent potentially incorrect results if fixes are not
- * written to disk.
- * @param {string} filePath The file for which to set lint results.
- * @param {Config} config The config of the file.
- * @param {Object} result The lint result to be set for the file.
- * @returns {void}
- */
- setCachedLintResults(filePath, config, result) {
- if (result && Object.hasOwn(result, "output")) {
- return;
- }
-
- const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
-
- if (fileDescriptor && !fileDescriptor.notFound) {
- debug(`Updating cached result: ${filePath}`);
-
- // Serialize the result, except that we want to remove the file source if present.
- const resultToSerialize = Object.assign({}, result);
-
- /*
- * Set result.source to null.
- * In `getCachedLintResults`, if source is explicitly null, we will
- * read the file from the filesystem to set the value again.
- */
- if (Object.hasOwn(resultToSerialize, "source")) {
- resultToSerialize.source = null;
- }
-
- fileDescriptor.meta.results = resultToSerialize;
- fileDescriptor.meta.hashOfConfig = hashOfConfigFor(config);
- }
- }
-
- /**
- * Persists the in-memory cache to disk.
- * @returns {void}
- */
- reconcile() {
- debug(`Persisting cached results: ${this.cacheFileLocation}`);
- this.fileEntryCache.reconcile();
- }
+
+ /**
+ * Creates a new LintResultCache instance.
+ * @param {string} cacheFileLocation The cache file location.
+ * @param {"metadata" | "content"} cacheStrategy The cache strategy to use.
+ */
+ constructor(cacheFileLocation, cacheStrategy) {
+ assert(cacheFileLocation, "Cache file location is required");
+ assert(cacheStrategy, "Cache strategy is required");
+ assert(
+ isValidCacheStrategy(cacheStrategy),
+ invalidCacheStrategyErrorMessage
+ );
+
+ debug(`Caching results to ${cacheFileLocation}`);
+
+ const useChecksum = cacheStrategy === "content";
+
+ debug(
+ `Using "${cacheStrategy}" strategy to detect changes`
+ );
+
+ this.fileEntryCache = fileEntryCache.create(
+ cacheFileLocation,
+ void 0,
+ useChecksum
+ );
+ this.cacheFileLocation = cacheFileLocation;
+ }
+
+ /**
+ * Retrieve cached lint results for a given file path, if present in the
+ * cache. If the file is present and has not been changed, rebuild any
+ * missing result information.
+ * @param {string} filePath The file for which to retrieve lint results.
+ * @param {ConfigArray} config The config of the file.
+ * @returns {Object|null} The rebuilt lint results, or null if the file is
+ * changed or not in the filesystem.
+ */
+ getCachedLintResults(filePath, config) {
+
+ /*
+ * Cached lint results are valid if and only if:
+ * 1. The file is present in the filesystem
+ * 2. The file has not changed since the time it was previously linted
+ * 3. The ESLint configuration has not changed since the time the file
+ * was previously linted
+ * If any of these are not true, we will not reuse the lint results.
+ */
+ const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
+ const hashOfConfig = hashOfConfigFor(config);
+ const changed =
+ fileDescriptor.changed ||
+ fileDescriptor.meta.hashOfConfig !== hashOfConfig;
+
+ if (fileDescriptor.notFound) {
+ debug(`File not found on the file system: ${filePath}`);
+ return null;
+ }
+
+ if (changed) {
+ debug(`Cache entry not found or no longer valid: ${filePath}`);
+ return null;
+ }
+
+ const cachedResults = fileDescriptor.meta.results;
+
+ // Just in case, not sure if this can ever happen.
+ if (!cachedResults) {
+ return cachedResults;
+ }
+
+ /*
+ * Shallow clone the object to ensure that any properties added or modified afterwards
+ * will not be accidentally stored in the cache file when `reconcile()` is called.
+ * https://github.com/eslint/eslint/issues/13507
+ * All intentional changes to the cache file must be done through `setCachedLintResults()`.
+ */
+ const results = { ...cachedResults };
+
+ // If source is present but null, need to reread the file from the filesystem.
+ if (results.source === null) {
+ debug(`Rereading cached result source from filesystem: ${filePath}`);
+ results.source = fs.readFileSync(filePath, "utf-8");
+ }
+
+ return results;
+ }
+
+ /**
+ * Set the cached lint results for a given file path, after removing any
+ * information that will be both unnecessary and difficult to serialize.
+ * Avoids caching results with an "output" property (meaning fixes were
+ * applied), to prevent potentially incorrect results if fixes are not
+ * written to disk.
+ * @param {string} filePath The file for which to set lint results.
+ * @param {ConfigArray} config The config of the file.
+ * @param {Object} result The lint result to be set for the file.
+ * @returns {void}
+ */
+ setCachedLintResults(filePath, config, result) {
+ if (result && Object.prototype.hasOwnProperty.call(result, "output")) {
+ return;
+ }
+
+ const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
+
+ if (fileDescriptor && !fileDescriptor.notFound) {
+ debug(`Updating cached result: ${filePath}`);
+
+ // Serialize the result, except that we want to remove the file source if present.
+ const resultToSerialize = Object.assign({}, result);
+
+ /*
+ * Set result.source to null.
+ * In `getCachedLintResults`, if source is explicitly null, we will
+ * read the file from the filesystem to set the value again.
+ */
+ if (Object.prototype.hasOwnProperty.call(resultToSerialize, "source")) {
+ resultToSerialize.source = null;
+ }
+
+ fileDescriptor.meta.results = resultToSerialize;
+ fileDescriptor.meta.hashOfConfig = hashOfConfigFor(config);
+ }
+ }
+
+ /**
+ * Persists the in-memory cache to disk.
+ * @returns {void}
+ */
+ reconcile() {
+ debug(`Persisting cached results: ${this.cacheFileLocation}`);
+ this.fileEntryCache.reconcile();
+ }
}
module.exports = LintResultCache;
diff --git a/node_modules/eslint/lib/cli-engine/load-rules.js b/node_modules/eslint/lib/cli-engine/load-rules.js
index 5a7dc3498..81bab63fa 100644
--- a/node_modules/eslint/lib/cli-engine/load-rules.js
+++ b/node_modules/eslint/lib/cli-engine/load-rules.js
@@ -9,8 +9,8 @@
// Requirements
//------------------------------------------------------------------------------
-const fs = require("node:fs"),
- path = require("node:path");
+const fs = require("fs"),
+ path = require("path");
const rulesDirCache = {};
@@ -24,23 +24,23 @@ const rulesDirCache = {};
* @param {string} cwd Current working directory
* @returns {Object} Loaded rule modules.
*/
-module.exports = function (relativeRulesDir, cwd) {
- const rulesDir = path.resolve(cwd, relativeRulesDir);
+module.exports = function(relativeRulesDir, cwd) {
+ const rulesDir = path.resolve(cwd, relativeRulesDir);
- // cache will help performance as IO operation are expensive
- if (rulesDirCache[rulesDir]) {
- return rulesDirCache[rulesDir];
- }
+ // cache will help performance as IO operation are expensive
+ if (rulesDirCache[rulesDir]) {
+ return rulesDirCache[rulesDir];
+ }
- const rules = Object.create(null);
+ const rules = Object.create(null);
- fs.readdirSync(rulesDir).forEach(file => {
- if (path.extname(file) !== ".js") {
- return;
- }
- rules[file.slice(0, -3)] = require(path.join(rulesDir, file));
- });
- rulesDirCache[rulesDir] = rules;
+ fs.readdirSync(rulesDir).forEach(file => {
+ if (path.extname(file) !== ".js") {
+ return;
+ }
+ rules[file.slice(0, -3)] = require(path.join(rulesDir, file));
+ });
+ rulesDirCache[rulesDir] = rules;
- return rules;
+ return rules;
};
diff --git a/node_modules/eslint/lib/cli.js b/node_modules/eslint/lib/cli.js
index 4e81721a9..1d909ec1c 100644
--- a/node_modules/eslint/lib/cli.js
+++ b/node_modules/eslint/lib/cli.js
@@ -15,73 +15,217 @@
// Requirements
//------------------------------------------------------------------------------
-const fs = require("node:fs"),
- { mkdir, stat, writeFile } = require("node:fs/promises"),
- path = require("node:path"),
- { pathToFileURL } = require("node:url"),
- { LegacyESLint } = require("./eslint"),
- {
- ESLint,
- shouldUseFlatConfig,
- locateConfigFileToUse,
- } = require("./eslint/eslint"),
- createCLIOptions = require("./options"),
- log = require("./shared/logging"),
- RuntimeInfo = require("./shared/runtime-info"),
- translateOptions = require("./shared/translate-cli-options");
-const { getCacheFile } = require("./eslint/eslint-helpers");
-const { SuppressionsService } = require("./services/suppressions-service");
+const fs = require("fs"),
+ path = require("path"),
+ { promisify } = require("util"),
+ { ESLint } = require("./eslint"),
+ { FlatESLint, shouldUseFlatConfig } = require("./eslint/flat-eslint"),
+ createCLIOptions = require("./options"),
+ log = require("./shared/logging"),
+ RuntimeInfo = require("./shared/runtime-info"),
+ { normalizeSeverityToString } = require("./shared/severity");
+const { Legacy: { naming } } = require("@eslint/eslintrc");
+const { ModuleImporter } = require("@humanwhocodes/module-importer");
+
const debug = require("debug")("eslint:cli");
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
+/** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */
+/** @typedef {import("./eslint/eslint").LintMessage} LintMessage */
+/** @typedef {import("./eslint/eslint").LintResult} LintResult */
/** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */
-/** @typedef {import("./types").ESLint.LintResult} LintResult */
-/** @typedef {import("./types").ESLint.ResultsMeta} ResultsMeta */
+/** @typedef {import("./shared/types").ResultsMeta} ResultsMeta */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
+const mkdir = promisify(fs.mkdir);
+const stat = promisify(fs.stat);
+const writeFile = promisify(fs.writeFile);
+
+/**
+ * Predicate function for whether or not to apply fixes in quiet mode.
+ * If a message is a warning, do not apply a fix.
+ * @param {LintMessage} message The lint result.
+ * @returns {boolean} True if the lint message is an error (and thus should be
+ * autofixed), false otherwise.
+ */
+function quietFixPredicate(message) {
+ return message.severity === 2;
+}
+
+/**
+ * Translates the CLI options into the options expected by the ESLint constructor.
+ * @param {ParsedCLIOptions} cliOptions The CLI options to translate.
+ * @param {"flat"|"eslintrc"} [configType="eslintrc"] The format of the
+ * config to generate.
+ * @returns {Promise} The options object for the ESLint constructor.
+ * @private
+ */
+async function translateOptions({
+ cache,
+ cacheFile,
+ cacheLocation,
+ cacheStrategy,
+ config,
+ configLookup,
+ env,
+ errorOnUnmatchedPattern,
+ eslintrc,
+ ext,
+ fix,
+ fixDryRun,
+ fixType,
+ global,
+ ignore,
+ ignorePath,
+ ignorePattern,
+ inlineConfig,
+ parser,
+ parserOptions,
+ plugin,
+ quiet,
+ reportUnusedDisableDirectives,
+ reportUnusedDisableDirectivesSeverity,
+ resolvePluginsRelativeTo,
+ rule,
+ rulesdir,
+ warnIgnored
+}, configType) {
+
+ let overrideConfig, overrideConfigFile;
+ const importer = new ModuleImporter();
+
+ if (configType === "flat") {
+ overrideConfigFile = (typeof config === "string") ? config : !configLookup;
+ if (overrideConfigFile === false) {
+ overrideConfigFile = void 0;
+ }
+
+ let globals = {};
+
+ if (global) {
+ globals = global.reduce((obj, name) => {
+ if (name.endsWith(":true")) {
+ obj[name.slice(0, -5)] = "writable";
+ } else {
+ obj[name] = "readonly";
+ }
+ return obj;
+ }, globals);
+ }
+
+ overrideConfig = [{
+ languageOptions: {
+ globals,
+ parserOptions: parserOptions || {}
+ },
+ rules: rule ? rule : {}
+ }];
+
+ if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) {
+ overrideConfig[0].linterOptions = {
+ reportUnusedDisableDirectives: reportUnusedDisableDirectives
+ ? "error"
+ : normalizeSeverityToString(reportUnusedDisableDirectivesSeverity)
+ };
+ }
+
+ if (parser) {
+ overrideConfig[0].languageOptions.parser = await importer.import(parser);
+ }
+
+ if (plugin) {
+ const plugins = {};
+
+ for (const pluginName of plugin) {
+
+ const shortName = naming.getShorthandName(pluginName, "eslint-plugin");
+ const longName = naming.normalizePackageName(pluginName, "eslint-plugin");
+
+ plugins[shortName] = await importer.import(longName);
+ }
+
+ overrideConfig[0].plugins = plugins;
+ }
+
+ } else {
+ overrideConfigFile = config;
+
+ overrideConfig = {
+ env: env && env.reduce((obj, name) => {
+ obj[name] = true;
+ return obj;
+ }, {}),
+ globals: global && global.reduce((obj, name) => {
+ if (name.endsWith(":true")) {
+ obj[name.slice(0, -5)] = "writable";
+ } else {
+ obj[name] = "readonly";
+ }
+ return obj;
+ }, {}),
+ ignorePatterns: ignorePattern,
+ parser,
+ parserOptions,
+ plugins: plugin,
+ rules: rule
+ };
+ }
+
+ const options = {
+ allowInlineConfig: inlineConfig,
+ cache,
+ cacheLocation: cacheLocation || cacheFile,
+ cacheStrategy,
+ errorOnUnmatchedPattern,
+ fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),
+ fixTypes: fixType,
+ ignore,
+ overrideConfig,
+ overrideConfigFile
+ };
+
+ if (configType === "flat") {
+ options.ignorePatterns = ignorePattern;
+ options.warnIgnored = warnIgnored;
+ } else {
+ options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
+ options.rulePaths = rulesdir;
+ options.useEslintrc = eslintrc;
+ options.extensions = ext;
+ options.ignorePath = ignorePath;
+ if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) {
+ options.reportUnusedDisableDirectives = reportUnusedDisableDirectives
+ ? "error"
+ : normalizeSeverityToString(reportUnusedDisableDirectivesSeverity);
+ }
+ }
+
+ return options;
+}
+
/**
* Count error messages.
* @param {LintResult[]} results The lint results.
* @returns {{errorCount:number;fatalErrorCount:number,warningCount:number}} The number of error messages.
*/
function countErrors(results) {
- let errorCount = 0;
- let fatalErrorCount = 0;
- let warningCount = 0;
-
- for (const result of results) {
- errorCount += result.errorCount;
- fatalErrorCount += result.fatalErrorCount;
- warningCount += result.warningCount;
- }
+ let errorCount = 0;
+ let fatalErrorCount = 0;
+ let warningCount = 0;
- return { errorCount, fatalErrorCount, warningCount };
-}
+ for (const result of results) {
+ errorCount += result.errorCount;
+ fatalErrorCount += result.fatalErrorCount;
+ warningCount += result.warningCount;
+ }
-/**
- * Creates an options module from the provided CLI options and encodes it as a data URL.
- * @param {ParsedCLIOptions} options The CLI options.
- * @returns {URL} The URL of the options module.
- */
-function createOptionsModule(options) {
- const translateOptionsFileURL = new URL(
- "./shared/translate-cli-options.js",
- pathToFileURL(__filename),
- ).href;
- const optionsSrc =
- `import translateOptions from ${JSON.stringify(translateOptionsFileURL)};\n` +
- `export default await translateOptions(${JSON.stringify(options)}, "flat");\n`;
-
- // Base64 encoding is typically shorter than URL encoding
- return new URL(
- `data:text/javascript;base64,${Buffer.from(optionsSrc).toString("base64")}`,
- );
+ return { errorCount, fatalErrorCount, warningCount };
}
/**
@@ -90,14 +234,14 @@ function createOptionsModule(options) {
* @returns {Promise} `true` if the given path is a directory.
*/
async function isDirectory(filePath) {
- try {
- return (await stat(filePath)).isDirectory();
- } catch (error) {
- if (error.code === "ENOENT" || error.code === "ENOTDIR") {
- return false;
- }
- throw error;
- }
+ try {
+ return (await stat(filePath)).isDirectory();
+ } catch (error) {
+ if (error.code === "ENOENT" || error.code === "ENOTDIR") {
+ return false;
+ }
+ throw error;
+ }
}
/**
@@ -111,64 +255,39 @@ async function isDirectory(filePath) {
* @private
*/
async function printResults(engine, results, format, outputFile, resultsMeta) {
- let formatter;
-
- try {
- formatter = await engine.loadFormatter(format);
- } catch (e) {
- log.error(e.message);
- return false;
- }
-
- const output = await formatter.format(results, resultsMeta);
-
- if (outputFile) {
- const filePath = path.resolve(process.cwd(), outputFile);
-
- if (await isDirectory(filePath)) {
- log.error(
- "Cannot write to output file path, it is a directory: %s",
- outputFile,
- );
- return false;
- }
-
- try {
- await mkdir(path.dirname(filePath), { recursive: true });
- await writeFile(filePath, output);
- } catch (ex) {
- log.error("There was a problem writing the output file:\n%s", ex);
- return false;
- }
- } else if (output) {
- log.info(output);
- }
-
- return true;
-}
-
-/**
- * Validates the `--concurrency` flag value.
- * @param {string} concurrency The `--concurrency` flag value to validate.
- * @returns {void}
- * @throws {Error} If the `--concurrency` flag value is invalid.
- */
-function validateConcurrency(concurrency) {
- if (
- concurrency === void 0 ||
- concurrency === "auto" ||
- concurrency === "off"
- ) {
- return;
- }
-
- const concurrencyValue = Number(concurrency);
-
- if (!Number.isInteger(concurrencyValue) || concurrencyValue < 1) {
- throw new Error(
- `Option concurrency: '${concurrency}' is not a positive integer, 'auto' or 'off'.`,
- );
- }
+ let formatter;
+
+ try {
+ formatter = await engine.loadFormatter(format);
+ } catch (e) {
+ log.error(e.message);
+ return false;
+ }
+
+ const output = await formatter.format(results, resultsMeta);
+
+ if (output) {
+ if (outputFile) {
+ const filePath = path.resolve(process.cwd(), outputFile);
+
+ if (await isDirectory(filePath)) {
+ log.error("Cannot write to output file path, it is a directory: %s", outputFile);
+ return false;
+ }
+
+ try {
+ await mkdir(path.dirname(filePath), { recursive: true });
+ await writeFile(filePath, output);
+ } catch (ex) {
+ log.error("There was a problem writing the output file:\n%s", ex);
+ return false;
+ }
+ } else {
+ log.info(output);
+ }
+ }
+
+ return true;
}
//------------------------------------------------------------------------------
@@ -180,374 +299,173 @@ function validateConcurrency(concurrency) {
* for other Node.js programs to effectively run the CLI.
*/
const cli = {
- /**
- * Calculates the command string for the --inspect-config operation.
- * @param {string} configFile The path to the config file to inspect.
- * @returns {Promise} The command string to execute.
- */
- async calculateInspectConfigFlags(configFile) {
- // find the config file
- const { configFilePath, basePath } = await locateConfigFileToUse({
- cwd: process.cwd(),
- configFile,
- });
-
- return ["--config", configFilePath, "--basePath", basePath];
- },
-
- /**
- * Executes the CLI based on an array of arguments that is passed in.
- * @param {string|Array|Object} args The arguments to process.
- * @param {string} [text] The text to lint (used for TTY).
- * @param {boolean} [allowFlatConfig=true] Whether or not to allow flat config.
- * @returns {Promise} The exit code for the operation.
- */
- async execute(args, text, allowFlatConfig = true) {
- if (Array.isArray(args)) {
- debug("CLI args: %o", args.slice(2));
- }
-
- /*
- * Before doing anything, we need to see if we are using a
- * flat config file. If so, then we need to change the way command
- * line args are parsed. This is temporary, and when we fully
- * switch to flat config we can remove this logic.
- */
-
- const usingFlatConfig =
- allowFlatConfig && (await shouldUseFlatConfig());
-
- debug("Using flat config?", usingFlatConfig);
-
- if (allowFlatConfig && !usingFlatConfig) {
- const { WarningService } = require("./services/warning-service");
- new WarningService().emitESLintRCWarning();
- }
-
- const CLIOptions = createCLIOptions(usingFlatConfig);
-
- /** @type {ParsedCLIOptions} */
- let options;
-
- try {
- options = CLIOptions.parse(args);
- validateConcurrency(options.concurrency);
- } catch (error) {
- debug("Error parsing CLI options:", error.message);
-
- let errorMessage = error.message;
-
- if (usingFlatConfig) {
- errorMessage +=
- "\nYou're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.";
- }
-
- log.error(errorMessage);
- return 2;
- }
-
- const files = options._;
- const useStdin = typeof text === "string";
-
- if (options.help) {
- log.info(CLIOptions.generateHelp());
- return 0;
- }
- if (options.version) {
- log.info(RuntimeInfo.version());
- return 0;
- }
- if (options.envInfo) {
- try {
- log.info(RuntimeInfo.environment());
- return 0;
- } catch (err) {
- debug("Error retrieving environment info");
- log.error(err.message);
- return 2;
- }
- }
-
- if (options.printConfig) {
- if (files.length) {
- log.error(
- "The --print-config option must be used with exactly one file name.",
- );
- return 2;
- }
- if (useStdin) {
- log.error(
- "The --print-config option is not available for piped-in code.",
- );
- return 2;
- }
-
- const engine = usingFlatConfig
- ? new ESLint(await translateOptions(options, "flat"))
- : new LegacyESLint(await translateOptions(options));
- const fileConfig = await engine.calculateConfigForFile(
- options.printConfig,
- );
-
- log.info(JSON.stringify(fileConfig, null, " "));
- return 0;
- }
-
- if (options.inspectConfig) {
- log.info(
- "You can also run this command directly using 'npx @eslint/config-inspector@latest' in the same directory as your configuration file.",
- );
-
- try {
- const flatOptions = await translateOptions(options, "flat");
- const spawn = require("cross-spawn");
- const flags = await cli.calculateInspectConfigFlags(
- flatOptions.overrideConfigFile,
- );
-
- spawn.sync(
- "npx",
- ["@eslint/config-inspector@latest", ...flags],
- { encoding: "utf8", stdio: "inherit" },
- );
- } catch (error) {
- log.error(error);
- return 2;
- }
-
- return 0;
- }
-
- debug(`Running on ${useStdin ? "text" : "files"}`);
-
- if (options.fix && options.fixDryRun) {
- log.error(
- "The --fix option and the --fix-dry-run option cannot be used together.",
- );
- return 2;
- }
- if (useStdin && options.fix) {
- log.error(
- "The --fix option is not available for piped-in code; use --fix-dry-run instead.",
- );
- return 2;
- }
- if (options.fixType && !options.fix && !options.fixDryRun) {
- log.error(
- "The --fix-type option requires either --fix or --fix-dry-run.",
- );
- return 2;
- }
-
- if (
- options.reportUnusedDisableDirectives &&
- options.reportUnusedDisableDirectivesSeverity !== void 0
- ) {
- log.error(
- "The --report-unused-disable-directives option and the --report-unused-disable-directives-severity option cannot be used together.",
- );
- return 2;
- }
-
- if (usingFlatConfig && options.ext) {
- // Passing `--ext ""` results in `options.ext` being an empty array.
- if (options.ext.length === 0) {
- log.error("The --ext option value cannot be empty.");
- return 2;
- }
-
- // Passing `--ext ,ts` results in an empty string at index 0. Passing `--ext ts,,tsx` results in an empty string at index 1.
- const emptyStringIndex = options.ext.indexOf("");
-
- if (emptyStringIndex >= 0) {
- log.error(
- `The --ext option arguments cannot be empty strings. Found an empty string at index ${emptyStringIndex}.`,
- );
- return 2;
- }
- }
-
- if (options.suppressAll && options.suppressRule) {
- log.error(
- "The --suppress-all option and the --suppress-rule option cannot be used together.",
- );
- return 2;
- }
-
- if (options.suppressAll && options.pruneSuppressions) {
- log.error(
- "The --suppress-all option and the --prune-suppressions option cannot be used together.",
- );
- return 2;
- }
-
- if (options.suppressRule && options.pruneSuppressions) {
- log.error(
- "The --suppress-rule option and the --prune-suppressions option cannot be used together.",
- );
- return 2;
- }
-
- if (
- useStdin &&
- (options.suppressAll ||
- options.suppressRule ||
- options.pruneSuppressions)
- ) {
- log.error(
- "The --suppress-all, --suppress-rule, and --prune-suppressions options cannot be used with piped-in code.",
- );
- return 2;
- }
-
- const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint;
-
- /** @type {ESLint|LegacyESLint} */
- let engine;
-
- if (options.concurrency && options.concurrency !== "off") {
- const optionsURL = createOptionsModule(options);
- engine = await ESLint.fromOptionsModule(optionsURL);
- } else {
- const eslintOptions = await translateOptions(
- options,
- usingFlatConfig ? "flat" : "eslintrc",
- );
- engine = new ActiveESLint(eslintOptions);
- }
- let results;
-
- if (useStdin) {
- results = await engine.lintText(text, {
- filePath: options.stdinFilename,
-
- // flatConfig respects CLI flag and constructor warnIgnored, eslintrc forces true for backwards compatibility
- warnIgnored: usingFlatConfig ? void 0 : true,
- });
- } else {
- results = await engine.lintFiles(files);
- }
-
- if (options.fix) {
- debug("Fix mode enabled - applying fixes");
- await ActiveESLint.outputFixes(results);
- }
-
- let unusedSuppressions = {};
-
- if (!useStdin) {
- const suppressionsFileLocation = getCacheFile(
- options.suppressionsLocation || "eslint-suppressions.json",
- process.cwd(),
- {
- prefix: "suppressions_",
- },
- );
-
- if (
- options.suppressionsLocation &&
- !fs.existsSync(suppressionsFileLocation) &&
- !options.suppressAll &&
- !options.suppressRule
- ) {
- log.error(
- "The suppressions file does not exist. Please run the command with `--suppress-all` or `--suppress-rule` to create it.",
- );
- return 2;
- }
-
- if (
- options.suppressAll ||
- options.suppressRule ||
- options.pruneSuppressions ||
- fs.existsSync(suppressionsFileLocation)
- ) {
- const suppressions = new SuppressionsService({
- filePath: suppressionsFileLocation,
- cwd: process.cwd(),
- });
-
- if (options.suppressAll || options.suppressRule) {
- await suppressions.suppress(results, options.suppressRule);
- }
-
- if (options.pruneSuppressions) {
- await suppressions.prune(results);
- }
-
- const suppressionResults = suppressions.applySuppressions(
- results,
- await suppressions.load(),
- );
-
- results = suppressionResults.results;
- unusedSuppressions = suppressionResults.unused;
- }
- }
-
- let resultsToPrint = results;
-
- if (options.quiet) {
- debug("Quiet mode enabled - filtering out warnings");
- resultsToPrint = ActiveESLint.getErrorResults(resultsToPrint);
- }
-
- const resultCounts = countErrors(results);
- const tooManyWarnings =
- options.maxWarnings >= 0 &&
- resultCounts.warningCount > options.maxWarnings;
- const resultsMeta = tooManyWarnings
- ? {
- maxWarningsExceeded: {
- maxWarnings: options.maxWarnings,
- foundWarnings: resultCounts.warningCount,
- },
- }
- : {};
-
- if (
- await printResults(
- engine,
- resultsToPrint,
- options.format,
- options.outputFile,
- resultsMeta,
- )
- ) {
- // Errors and warnings from the original unfiltered results should determine the exit code
- const shouldExitForFatalErrors =
- options.exitOnFatalError && resultCounts.fatalErrorCount > 0;
-
- if (!resultCounts.errorCount && tooManyWarnings) {
- log.error(
- "ESLint found too many warnings (maximum: %s).",
- options.maxWarnings,
- );
- }
-
- if (!options.passOnUnprunedSuppressions) {
- const unusedSuppressionsCount =
- Object.keys(unusedSuppressions).length;
-
- if (unusedSuppressionsCount > 0) {
- log.error(
- "There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.",
- );
- debug(JSON.stringify(unusedSuppressions, null, 2));
-
- return 2;
- }
- }
-
- if (shouldExitForFatalErrors) {
- return 2;
- }
-
- return resultCounts.errorCount || tooManyWarnings ? 1 : 0;
- }
-
- return 2;
- },
+
+ /**
+ * Executes the CLI based on an array of arguments that is passed in.
+ * @param {string|Array|Object} args The arguments to process.
+ * @param {string} [text] The text to lint (used for TTY).
+ * @param {boolean} [allowFlatConfig] Whether or not to allow flat config.
+ * @returns {Promise} The exit code for the operation.
+ */
+ async execute(args, text, allowFlatConfig) {
+ if (Array.isArray(args)) {
+ debug("CLI args: %o", args.slice(2));
+ }
+
+ /*
+ * Before doing anything, we need to see if we are using a
+ * flat config file. If so, then we need to change the way command
+ * line args are parsed. This is temporary, and when we fully
+ * switch to flat config we can remove this logic.
+ */
+
+ const usingFlatConfig = allowFlatConfig && await shouldUseFlatConfig();
+
+ debug("Using flat config?", usingFlatConfig);
+
+ const CLIOptions = createCLIOptions(usingFlatConfig);
+
+ /** @type {ParsedCLIOptions} */
+ let options;
+
+ try {
+ options = CLIOptions.parse(args);
+ } catch (error) {
+ debug("Error parsing CLI options:", error.message);
+
+ let errorMessage = error.message;
+
+ if (usingFlatConfig) {
+ errorMessage += "\nYou're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.";
+ }
+
+ log.error(errorMessage);
+ return 2;
+ }
+
+ const files = options._;
+ const useStdin = typeof text === "string";
+
+ if (options.help) {
+ log.info(CLIOptions.generateHelp());
+ return 0;
+ }
+ if (options.version) {
+ log.info(RuntimeInfo.version());
+ return 0;
+ }
+ if (options.envInfo) {
+ try {
+ log.info(RuntimeInfo.environment());
+ return 0;
+ } catch (err) {
+ debug("Error retrieving environment info");
+ log.error(err.message);
+ return 2;
+ }
+ }
+
+ if (options.printConfig) {
+ if (files.length) {
+ log.error("The --print-config option must be used with exactly one file name.");
+ return 2;
+ }
+ if (useStdin) {
+ log.error("The --print-config option is not available for piped-in code.");
+ return 2;
+ }
+
+ const engine = usingFlatConfig
+ ? new FlatESLint(await translateOptions(options, "flat"))
+ : new ESLint(await translateOptions(options));
+ const fileConfig =
+ await engine.calculateConfigForFile(options.printConfig);
+
+ log.info(JSON.stringify(fileConfig, null, " "));
+ return 0;
+ }
+
+ debug(`Running on ${useStdin ? "text" : "files"}`);
+
+ if (options.fix && options.fixDryRun) {
+ log.error("The --fix option and the --fix-dry-run option cannot be used together.");
+ return 2;
+ }
+ if (useStdin && options.fix) {
+ log.error("The --fix option is not available for piped-in code; use --fix-dry-run instead.");
+ return 2;
+ }
+ if (options.fixType && !options.fix && !options.fixDryRun) {
+ log.error("The --fix-type option requires either --fix or --fix-dry-run.");
+ return 2;
+ }
+
+ if (options.reportUnusedDisableDirectives && options.reportUnusedDisableDirectivesSeverity !== void 0) {
+ log.error("The --report-unused-disable-directives option and the --report-unused-disable-directives-severity option cannot be used together.");
+ return 2;
+ }
+
+ const ActiveESLint = usingFlatConfig ? FlatESLint : ESLint;
+
+ const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"));
+ let results;
+
+ if (useStdin) {
+ results = await engine.lintText(text, {
+ filePath: options.stdinFilename,
+
+ // flatConfig respects CLI flag and constructor warnIgnored, eslintrc forces true for backwards compatibility
+ warnIgnored: usingFlatConfig ? void 0 : true
+ });
+ } else {
+ results = await engine.lintFiles(files);
+ }
+
+ if (options.fix) {
+ debug("Fix mode enabled - applying fixes");
+ await ActiveESLint.outputFixes(results);
+ }
+
+ let resultsToPrint = results;
+
+ if (options.quiet) {
+ debug("Quiet mode enabled - filtering out warnings");
+ resultsToPrint = ActiveESLint.getErrorResults(resultsToPrint);
+ }
+
+ const resultCounts = countErrors(results);
+ const tooManyWarnings = options.maxWarnings >= 0 && resultCounts.warningCount > options.maxWarnings;
+ const resultsMeta = tooManyWarnings
+ ? {
+ maxWarningsExceeded: {
+ maxWarnings: options.maxWarnings,
+ foundWarnings: resultCounts.warningCount
+ }
+ }
+ : {};
+
+ if (await printResults(engine, resultsToPrint, options.format, options.outputFile, resultsMeta)) {
+
+ // Errors and warnings from the original unfiltered results should determine the exit code
+ const shouldExitForFatalErrors =
+ options.exitOnFatalError && resultCounts.fatalErrorCount > 0;
+
+ if (!resultCounts.errorCount && tooManyWarnings) {
+ log.error(
+ "ESLint found too many warnings (maximum: %s).",
+ options.maxWarnings
+ );
+ }
+
+ if (shouldExitForFatalErrors) {
+ return 2;
+ }
+
+ return (resultCounts.errorCount || tooManyWarnings) ? 1 : 0;
+ }
+
+ return 2;
+ }
};
module.exports = cli;
diff --git a/node_modules/eslint/lib/config-api.js b/node_modules/eslint/lib/config-api.js
deleted file mode 100644
index 5050a631c..000000000
--- a/node_modules/eslint/lib/config-api.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @fileoverview exports for config helpers
- * @author Nicholas C. Zakas
- */
-
-"use strict";
-const { defineConfig, globalIgnores } = require("@eslint/config-helpers");
-
-module.exports = {
- defineConfig,
- globalIgnores,
-};
diff --git a/node_modules/eslint/lib/config/config-loader.js b/node_modules/eslint/lib/config/config-loader.js
deleted file mode 100644
index 80dfaeb43..000000000
--- a/node_modules/eslint/lib/config/config-loader.js
+++ /dev/null
@@ -1,816 +0,0 @@
-/**
- * @fileoverview Utility to load config files
- * @author Nicholas C. Zakas
- */
-
-"use strict";
-
-//------------------------------------------------------------------------------
-// Requirements
-//------------------------------------------------------------------------------
-
-const path = require("node:path");
-const fs = require("node:fs/promises");
-const findUp = require("find-up");
-const { pathToFileURL } = require("node:url");
-const debug = require("debug")("eslint:config-loader");
-const { FlatConfigArray } = require("./flat-config-array");
-const { WarningService } = require("../services/warning-service");
-
-//-----------------------------------------------------------------------------
-// Types
-//-----------------------------------------------------------------------------
-
-/** @typedef {import("../types").Linter.Config} Config */
-
-/**
- * @typedef {Object} ConfigLoaderOptions
- * @property {string|false|undefined} configFile The path to the config file to use.
- * @property {string} cwd The current working directory.
- * @property {boolean} ignoreEnabled Indicates if ignore patterns should be honored.
- * @property {Config|Array} [baseConfig] The base config to use.
- * @property {Array} [defaultConfigs] The default configs to use.
- * @property {Array} [ignorePatterns] The ignore patterns to use.
- * @property {Config|Array} [overrideConfig] The override config to use.
- * @property {boolean} [hasUnstableNativeNodeJsTSConfigFlag] The flag to indicate whether the `unstable_native_nodejs_ts_config` flag is enabled.
- * @property {WarningService} [warningService] The warning service to use.
- */
-
-//------------------------------------------------------------------------------
-// Helpers
-//------------------------------------------------------------------------------
-
-const FLAT_CONFIG_FILENAMES = [
- "eslint.config.js",
- "eslint.config.mjs",
- "eslint.config.cjs",
- "eslint.config.ts",
- "eslint.config.mts",
- "eslint.config.cts",
-];
-
-const importedConfigFileModificationTime = new Map();
-
-/**
- * Asserts that the given file path is valid.
- * @param {string} filePath The file path to check.
- * @returns {void}
- * @throws {Error} If `filePath` is not a non-empty string.
- */
-function assertValidFilePath(filePath) {
- if (!filePath || typeof filePath !== "string") {
- throw new Error("'filePath' must be a non-empty string");
- }
-}
-
-/**
- * Asserts that a configuration exists. A configuration exists if any
- * of the following are true:
- * - `configFilePath` is defined.
- * - `useConfigFile` is `false`.
- * @param {string|undefined} configFilePath The path to the config file.
- * @param {ConfigLoaderOptions} loaderOptions The options to use when loading configuration files.
- * @returns {void}
- * @throws {Error} If no configuration exists.
- */
-function assertConfigurationExists(configFilePath, loaderOptions) {
- const { configFile: useConfigFile } = loaderOptions;
-
- if (!configFilePath && useConfigFile !== false) {
- const error = new Error("Could not find config file.");
-
- error.messageTemplate = "config-file-missing";
- throw error;
- }
-}
-
-/**
- * Check if the file is a TypeScript file.
- * @param {string} filePath The file path to check.
- * @returns {boolean} `true` if the file is a TypeScript file, `false` if it's not.
- */
-function isFileTS(filePath) {
- const fileExtension = path.extname(filePath);
-
- return /^\.[mc]?ts$/u.test(fileExtension);
-}
-
-/**
- * Check if ESLint is running in Bun.
- * @returns {boolean} `true` if the ESLint is running Bun, `false` if it's not.
- */
-function isRunningInBun() {
- return !!globalThis.Bun;
-}
-
-/**
- * Check if ESLint is running in Deno.
- * @returns {boolean} `true` if the ESLint is running in Deno, `false` if it's not.
- */
-function isRunningInDeno() {
- return !!globalThis.Deno;
-}
-
-/**
- * Checks if native TypeScript support is
- * enabled in the current Node.js process.
- *
- * This function determines if the
- * {@linkcode NodeJS.ProcessFeatures.typescript | typescript}
- * feature is present in the
- * {@linkcode process.features} object
- * and if its value is either "strip" or "transform".
- * @returns {boolean} `true` if native TypeScript support is enabled, otherwise `false`.
- * @since 9.24.0
- */
-function isNativeTypeScriptSupportEnabled() {
- return (
- // eslint-disable-next-line n/no-unsupported-features/node-builtins -- it's still an experimental feature.
- ["strip", "transform"].includes(process.features.typescript)
- );
-}
-
-/**
- * Load the TypeScript configuration file.
- * @param {string} filePath The absolute file path to load.
- * @param {URL} fileURL The file URL to load.
- * @param {number} mtime The last modified timestamp of the file.
- * @returns {Promise} The configuration loaded from the file.
- * @since 9.24.0
- */
-async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
- const { createJiti, version: jitiVersion } =
- // eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing
- await ConfigLoader.loadJiti().catch(() => {
- throw new Error(
- "The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.",
- );
- });
-
- // `createJiti` was added in jiti v2.
- if (typeof createJiti !== "function") {
- throw new Error(
- "You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.",
- );
- }
-
- /*
- * Disabling `moduleCache` allows us to reload a
- * config file when the last modified timestamp changes.
- */
- const jitiOptions = {
- moduleCache: false,
- };
-
- if (jitiVersion.startsWith("2.1.")) {
- jitiOptions.interopDefault = false;
- }
-
- const jiti = createJiti(__filename, jitiOptions);
- const config = await jiti.import(fileURL.href);
-
- importedConfigFileModificationTime.set(filePath, mtime);
-
- return config?.default ?? config;
-}
-
-/**
- * Dynamically imports a module from the given file path.
- * @param {string} filePath The absolute file path of the module to import.
- * @param {URL} fileURL The file URL to load.
- * @param {number} mtime The last modified timestamp of the file.
- * @returns {Promise} - A {@linkcode Promise | promise} that resolves to the imported ESLint config.
- * @since 9.24.0
- */
-async function dynamicImportConfig(filePath, fileURL, mtime) {
- const module = await import(fileURL.href);
-
- importedConfigFileModificationTime.set(filePath, mtime);
-
- return module.default;
-}
-
-/**
- * Load the config array from the given filename.
- * @param {string} filePath The filename to load from.
- * @param {boolean} hasUnstableNativeNodeJsTSConfigFlag The flag to indicate whether the `unstable_native_nodejs_ts_config` flag is enabled.
- * @returns {Promise} The config loaded from the config file.
- */
-async function loadConfigFile(filePath, hasUnstableNativeNodeJsTSConfigFlag) {
- debug(`Loading config from ${filePath}`);
-
- const fileURL = pathToFileURL(filePath);
-
- debug(`Config file URL is ${fileURL}`);
-
- const mtime = (await fs.stat(filePath)).mtime.getTime();
-
- /*
- * Append a query with the config file's modification time (`mtime`) in order
- * to import the current version of the config file. Without the query, `import()` would
- * cache the config file module by the pathname only, and then always return
- * the same version (the one that was actual when the module was imported for the first time).
- *
- * This ensures that the config file module is loaded and executed again
- * if it has been changed since the last time it was imported.
- * If it hasn't been changed, `import()` will just return the cached version.
- *
- * Note that we should not overuse queries (e.g., by appending the current time
- * to always reload the config file module) as that could cause memory leaks
- * because entries are never removed from the import cache.
- */
- fileURL.searchParams.append("mtime", mtime);
-
- /*
- * With queries, we can bypass the import cache. However, when import-ing a CJS module,
- * Node.js uses the require infrastructure under the hood. That includes the require cache,
- * which caches the config file module by its file path (queries have no effect).
- * Therefore, we also need to clear the require cache before importing the config file module.
- * In order to get the same behavior with ESM and CJS config files, in particular - to reload
- * the config file only if it has been changed, we track file modification times and clear
- * the require cache only if the file has been changed.
- */
- if (importedConfigFileModificationTime.get(filePath) !== mtime) {
- delete require.cache[filePath];
- }
-
- const isTS = isFileTS(filePath);
- const isBun = isRunningInBun();
- const isDeno = isRunningInDeno();
-
- /*
- * If we are dealing with a TypeScript file, then we need to use `jiti` to load it
- * in Node.js. Deno and Bun both allow native importing of TypeScript files.
- *
- * When Node.js supports native TypeScript imports, we can remove this check.
- */
-
- if (isTS) {
- if (hasUnstableNativeNodeJsTSConfigFlag) {
- if (isNativeTypeScriptSupportEnabled()) {
- return await dynamicImportConfig(filePath, fileURL, mtime);
- }
-
- if (!("typescript" in process.features)) {
- throw new Error(
- "The unstable_native_nodejs_ts_config flag is not supported in older versions of Node.js.",
- );
- }
-
- throw new Error(
- "The unstable_native_nodejs_ts_config flag is enabled, but native TypeScript support is not enabled in the current Node.js process. You need to either enable native TypeScript support by passing --experimental-strip-types or remove the unstable_native_nodejs_ts_config flag.",
- );
- }
-
- if (!isDeno && !isBun) {
- return await loadTypeScriptConfigFileWithJiti(
- filePath,
- fileURL,
- mtime,
- );
- }
- }
-
- // fallback to normal runtime behavior
-
- return await dynamicImportConfig(filePath, fileURL, mtime);
-}
-
-//-----------------------------------------------------------------------------
-// Exports
-//-----------------------------------------------------------------------------
-
-/**
- * Encapsulates the loading and caching of configuration files when looking up
- * from the file being linted.
- */
-class ConfigLoader {
- /**
- * Map of config file paths to the config arrays for those directories.
- * @type {Map>}
- */
- #configArrays = new Map();
-
- /**
- * Map of absolute directory names to the config file paths for those directories.
- * @type {Map>}
- */
- #configFilePaths = new Map();
-
- /**
- * The options to use when loading configuration files.
- * @type {ConfigLoaderOptions}
- */
- #options;
-
- /**
- * Creates a new instance.
- * @param {ConfigLoaderOptions} options The options to use when loading configuration files.
- */
- constructor(options) {
- this.#options = options.warningService
- ? options
- : { ...options, warningService: new WarningService() };
- }
-
- /**
- * Determines which config file to use. This is determined by seeing if an
- * override config file was specified, and if so, using it; otherwise, as long
- * as override config file is not explicitly set to `false`, it will search
- * upwards from `fromDirectory` for a file named `eslint.config.js`.
- * @param {string} fromDirectory The directory from which to start searching.
- * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for
- * the config file.
- */
- async #locateConfigFileToUse(fromDirectory) {
- // check cache first
- if (this.#configFilePaths.has(fromDirectory)) {
- return this.#configFilePaths.get(fromDirectory);
- }
-
- const resultPromise = ConfigLoader.locateConfigFileToUse({
- useConfigFile: this.#options.configFile,
- cwd: this.#options.cwd,
- fromDirectory,
- });
-
- // ensure `ConfigLoader.locateConfigFileToUse` is called only once for `fromDirectory`
- this.#configFilePaths.set(fromDirectory, resultPromise);
-
- // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method.
- const result = await resultPromise;
-
- this.#configFilePaths.set(fromDirectory, result);
-
- return result;
- }
-
- /**
- * Calculates the config array for this run based on inputs.
- * @param {string} configFilePath The absolute path to the config file to use if not overridden.
- * @param {string} basePath The base path to use for relative paths in the config file.
- * @returns {Promise} The config array for `eslint`.
- */
- async #calculateConfigArray(configFilePath, basePath) {
- // check for cached version first
- if (this.#configArrays.has(configFilePath)) {
- return this.#configArrays.get(configFilePath);
- }
-
- const configsPromise = ConfigLoader.calculateConfigArray(
- configFilePath,
- basePath,
- this.#options,
- );
-
- // ensure `ConfigLoader.calculateConfigArray` is called only once for `configFilePath`
- this.#configArrays.set(configFilePath, configsPromise);
-
- // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method.
- const configs = await configsPromise;
-
- this.#configArrays.set(configFilePath, configs);
-
- return configs;
- }
-
- /**
- * Returns the config file path for the given directory or file. This will either use
- * the override config file that was specified in the constructor options or
- * search for a config file from the directory.
- * @param {string} fileOrDirPath The file or directory path to get the config file path for.
- * @returns {Promise} The config file path or `undefined` if not found.
- * @throws {Error} If `fileOrDirPath` is not a non-empty string.
- * @throws {Error} If `fileOrDirPath` is not an absolute path.
- */
- async findConfigFileForPath(fileOrDirPath) {
- assertValidFilePath(fileOrDirPath);
-
- const absoluteDirPath = path.resolve(
- this.#options.cwd,
- path.dirname(fileOrDirPath),
- );
- const { configFilePath } =
- await this.#locateConfigFileToUse(absoluteDirPath);
-
- return configFilePath;
- }
-
- /**
- * Returns a configuration object for the given file based on the CLI options.
- * This is the same logic used by the ESLint CLI executable to determine
- * configuration for each file it processes.
- * @param {string} filePath The path of the file or directory to retrieve config for.
- * @returns {Promise} A configuration object for the file.
- * @throws {Error} If no configuration for `filePath` exists.
- */
- async loadConfigArrayForFile(filePath) {
- assertValidFilePath(filePath);
-
- debug(`Calculating config for file ${filePath}`);
-
- const configFilePath = await this.findConfigFileForPath(filePath);
-
- assertConfigurationExists(configFilePath, this.#options);
-
- return this.loadConfigArrayForDirectory(filePath);
- }
-
- /**
- * Returns a configuration object for the given directory based on the CLI options.
- * This is the same logic used by the ESLint CLI executable to determine
- * configuration for each file it processes.
- * @param {string} dirPath The path of the directory to retrieve config for.
- * @returns {Promise} A configuration object for the directory.
- */
- async loadConfigArrayForDirectory(dirPath) {
- assertValidFilePath(dirPath);
-
- debug(`Calculating config for directory ${dirPath}`);
-
- const absoluteDirPath = path.resolve(
- this.#options.cwd,
- path.dirname(dirPath),
- );
- const { configFilePath, basePath } =
- await this.#locateConfigFileToUse(absoluteDirPath);
-
- debug(`Using config file ${configFilePath} and base path ${basePath}`);
- return this.#calculateConfigArray(configFilePath, basePath);
- }
-
- /**
- * Returns a configuration array for the given file based on the CLI options.
- * This is a synchronous operation and does not read any files from disk. It's
- * intended to be used in locations where we know the config file has already
- * been loaded and we just need to get the configuration for a file.
- * @param {string} filePath The path of the file to retrieve a config object for.
- * @returns {FlatConfigArray} A configuration object for the file.
- * @throws {Error} If `filePath` is not a non-empty string.
- * @throws {Error} If `filePath` is not an absolute path.
- * @throws {Error} If the config file was not already loaded.
- */
- getCachedConfigArrayForFile(filePath) {
- assertValidFilePath(filePath);
-
- debug(`Looking up cached config for ${filePath}`);
-
- return this.getCachedConfigArrayForPath(path.dirname(filePath));
- }
-
- /**
- * Returns a configuration array for the given directory based on the CLI options.
- * This is a synchronous operation and does not read any files from disk. It's
- * intended to be used in locations where we know the config file has already
- * been loaded and we just need to get the configuration for a file.
- * @param {string} fileOrDirPath The path of the directory to retrieve a config object for.
- * @returns {FlatConfigArray} A configuration object for the directory.
- * @throws {Error} If `dirPath` is not a non-empty string.
- * @throws {Error} If `dirPath` is not an absolute path.
- * @throws {Error} If the config file was not already loaded.
- */
- getCachedConfigArrayForPath(fileOrDirPath) {
- assertValidFilePath(fileOrDirPath);
-
- debug(`Looking up cached config for ${fileOrDirPath}`);
-
- const absoluteDirPath = path.resolve(this.#options.cwd, fileOrDirPath);
-
- if (!this.#configFilePaths.has(absoluteDirPath)) {
- throw new Error(`Could not find config file for ${fileOrDirPath}`);
- }
-
- const configFilePathInfo = this.#configFilePaths.get(absoluteDirPath);
-
- if (typeof configFilePathInfo.then === "function") {
- throw new Error(
- `Config file path for ${fileOrDirPath} has not yet been calculated or an error occurred during the calculation`,
- );
- }
-
- const { configFilePath } = configFilePathInfo;
-
- const configArray = this.#configArrays.get(configFilePath);
-
- if (!configArray || typeof configArray.then === "function") {
- throw new Error(
- `Config array for ${fileOrDirPath} has not yet been calculated or an error occurred during the calculation`,
- );
- }
-
- return configArray;
- }
-
- /**
- * Used to import the jiti dependency. This method is exposed internally for testing purposes.
- * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
- */
- static async loadJiti() {
- const { createJiti } = await import("jiti");
- const version = require("jiti/package.json").version;
- return { createJiti, version };
- }
-
- /**
- * Determines which config file to use. This is determined by seeing if an
- * override config file was specified, and if so, using it; otherwise, as long
- * as override config file is not explicitly set to `false`, it will search
- * upwards from `fromDirectory` for a file named `eslint.config.js`.
- * This method is exposed internally for testing purposes.
- * @param {Object} [options] the options object
- * @param {string|false|undefined} options.useConfigFile The path to the config file to use.
- * @param {string} options.cwd Path to a directory that should be considered as the current working directory.
- * @param {string} [options.fromDirectory] The directory from which to start searching. Defaults to `cwd`.
- * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for
- * the config file.
- */
- static async locateConfigFileToUse({
- useConfigFile,
- cwd,
- fromDirectory = cwd,
- }) {
- // determine where to load config file from
- let configFilePath;
- let basePath = cwd;
-
- if (typeof useConfigFile === "string") {
- debug(`Override config file path is ${useConfigFile}`);
- configFilePath = path.resolve(cwd, useConfigFile);
- basePath = cwd;
- } else if (useConfigFile !== false) {
- debug("Searching for eslint.config.js");
- configFilePath = await findUp(FLAT_CONFIG_FILENAMES, {
- cwd: fromDirectory,
- });
-
- if (configFilePath) {
- basePath = path.dirname(configFilePath);
- }
- }
-
- return {
- configFilePath,
- basePath,
- };
- }
-
- /**
- * Calculates the config array for this run based on inputs.
- * This method is exposed internally for testing purposes.
- * @param {string} configFilePath The absolute path to the config file to use if not overridden.
- * @param {string} basePath The base path to use for relative paths in the config file.
- * @param {ConfigLoaderOptions} options The options to use when loading configuration files.
- * @returns {Promise} The config array for `eslint`.
- */
- static async calculateConfigArray(configFilePath, basePath, options) {
- const {
- cwd,
- baseConfig,
- ignoreEnabled,
- ignorePatterns,
- overrideConfig,
- hasUnstableNativeNodeJsTSConfigFlag = false,
- defaultConfigs = [],
- warningService,
- } = options;
-
- debug(
- `Calculating config array from config file ${configFilePath} and base path ${basePath}`,
- );
-
- const configs = new FlatConfigArray(baseConfig || [], {
- basePath,
- shouldIgnore: ignoreEnabled,
- });
-
- // load config file
- if (configFilePath) {
- debug(`Loading config file ${configFilePath}`);
- const fileConfig = await loadConfigFile(
- configFilePath,
- hasUnstableNativeNodeJsTSConfigFlag,
- );
-
- /*
- * It's possible that a config file could be empty or else
- * have an empty object or array. In this case, we want to
- * warn the user that they have an empty config.
- *
- * An empty CommonJS file exports an empty object while
- * an empty ESM file exports undefined.
- */
-
- let emptyConfig = typeof fileConfig === "undefined";
-
- debug(
- `Config file ${configFilePath} is ${emptyConfig ? "empty" : "not empty"}`,
- );
-
- if (!emptyConfig) {
- if (Array.isArray(fileConfig)) {
- if (fileConfig.length === 0) {
- debug(
- `Config file ${configFilePath} is an empty array`,
- );
- emptyConfig = true;
- } else {
- configs.push(...fileConfig);
- }
- } else {
- if (
- typeof fileConfig === "object" &&
- fileConfig !== null &&
- Object.keys(fileConfig).length === 0
- ) {
- debug(
- `Config file ${configFilePath} is an empty object`,
- );
- emptyConfig = true;
- } else {
- configs.push(fileConfig);
- }
- }
- }
-
- if (emptyConfig) {
- warningService.emitEmptyConfigWarning(configFilePath);
- }
- }
-
- // add in any configured defaults
- configs.push(...defaultConfigs);
-
- // append command line ignore patterns
- if (ignorePatterns && ignorePatterns.length > 0) {
- /*
- * Ignore patterns are added to the end of the config array
- * so they can override default ignores.
- */
- configs.push({
- basePath: cwd,
- ignores: ignorePatterns,
- });
- }
-
- if (overrideConfig) {
- if (Array.isArray(overrideConfig)) {
- configs.push(...overrideConfig);
- } else {
- configs.push(overrideConfig);
- }
- }
-
- await configs.normalize();
-
- return configs;
- }
-}
-
-/**
- * Encapsulates the loading and caching of configuration files when looking up
- * from the current working directory.
- */
-class LegacyConfigLoader extends ConfigLoader {
- /**
- * The options to use when loading configuration files.
- * @type {ConfigLoaderOptions}
- */
- #options;
-
- /**
- * The cached config file path for this instance.
- * @type {Promise<{configFilePath:string,basePath:string}|undefined>}
- */
- #configFilePath;
-
- /**
- * The cached config array for this instance.
- * @type {FlatConfigArray|Promise}
- */
- #configArray;
-
- /**
- * Creates a new instance.
- * @param {ConfigLoaderOptions} options The options to use when loading configuration files.
- */
- constructor(options) {
- const normalizedOptions = options.warningService
- ? options
- : { ...options, warningService: new WarningService() };
- super(normalizedOptions);
- this.#options = normalizedOptions;
- }
-
- /**
- * Determines which config file to use. This is determined by seeing if an
- * override config file was specified, and if so, using it; otherwise, as long
- * as override config file is not explicitly set to `false`, it will search
- * upwards from the cwd for a file named `eslint.config.js`.
- * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for
- * the config file.
- */
- #locateConfigFileToUse() {
- if (!this.#configFilePath) {
- this.#configFilePath = ConfigLoader.locateConfigFileToUse({
- useConfigFile: this.#options.configFile,
- cwd: this.#options.cwd,
- });
- }
-
- return this.#configFilePath;
- }
-
- /**
- * Calculates the config array for this run based on inputs.
- * @param {string} configFilePath The absolute path to the config file to use if not overridden.
- * @param {string} basePath The base path to use for relative paths in the config file.
- * @returns {Promise} The config array for `eslint`.
- */
- async #calculateConfigArray(configFilePath, basePath) {
- // check for cached version first
- if (this.#configArray) {
- return this.#configArray;
- }
-
- // ensure `ConfigLoader.calculateConfigArray` is called only once
- this.#configArray = ConfigLoader.calculateConfigArray(
- configFilePath,
- basePath,
- this.#options,
- );
-
- // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method.
- this.#configArray = await this.#configArray;
-
- return this.#configArray;
- }
-
- /**
- * Returns the config file path for the given directory. This will either use
- * the override config file that was specified in the constructor options or
- * search for a config file from the directory of the file being linted.
- * @param {string} dirPath The directory path to get the config file path for.
- * @returns {Promise} The config file path or `undefined` if not found.
- * @throws {Error} If `fileOrDirPath` is not a non-empty string.
- * @throws {Error} If `fileOrDirPath` is not an absolute path.
- */
- async findConfigFileForPath(dirPath) {
- assertValidFilePath(dirPath);
-
- const { configFilePath } = await this.#locateConfigFileToUse();
-
- return configFilePath;
- }
-
- /**
- * Returns a configuration object for the given file based on the CLI options.
- * This is the same logic used by the ESLint CLI executable to determine
- * configuration for each file it processes.
- * @param {string} dirPath The path of the directory to retrieve config for.
- * @returns {Promise} A configuration object for the file.
- */
- async loadConfigArrayForDirectory(dirPath) {
- assertValidFilePath(dirPath);
-
- debug(`[Legacy]: Calculating config for ${dirPath}`);
-
- const { configFilePath, basePath } =
- await this.#locateConfigFileToUse();
-
- debug(
- `[Legacy]: Using config file ${configFilePath} and base path ${basePath}`,
- );
- return this.#calculateConfigArray(configFilePath, basePath);
- }
-
- /**
- * Returns a configuration array for the given directory based on the CLI options.
- * This is a synchronous operation and does not read any files from disk. It's
- * intended to be used in locations where we know the config file has already
- * been loaded and we just need to get the configuration for a file.
- * @param {string} dirPath The path of the directory to retrieve a config object for.
- * @returns {FlatConfigArray} A configuration object for the file.
- * @throws {Error} If `dirPath` is not a non-empty string.
- * @throws {Error} If `dirPath` is not an absolute path.
- * @throws {Error} If the config file was not already loaded.
- */
- getCachedConfigArrayForPath(dirPath) {
- assertValidFilePath(dirPath);
-
- debug(`[Legacy]: Looking up cached config for ${dirPath}`);
-
- if (!this.#configArray) {
- throw new Error(`Could not find config file for ${dirPath}`);
- }
-
- if (typeof this.#configArray.then === "function") {
- throw new Error(
- `Config array for ${dirPath} has not yet been calculated or an error occurred during the calculation`,
- );
- }
-
- return this.#configArray;
- }
-}
-
-module.exports = { ConfigLoader, LegacyConfigLoader };
diff --git a/node_modules/eslint/lib/config/config.js b/node_modules/eslint/lib/config/config.js
deleted file mode 100644
index 22fd5cc4e..000000000
--- a/node_modules/eslint/lib/config/config.js
+++ /dev/null
@@ -1,674 +0,0 @@
-/**
- * @fileoverview The `Config` class
- * @author Nicholas C. Zakas
- */
-
-"use strict";
-
-//-----------------------------------------------------------------------------
-// Requirements
-//-----------------------------------------------------------------------------
-
-const { deepMergeArrays } = require("../shared/deep-merge-arrays");
-const { flatConfigSchema, hasMethod } = require("./flat-config-schema");
-const { ObjectSchema } = require("@eslint/config-array");
-const ajvImport = require("../shared/ajv");
-const ajv = ajvImport();
-const ruleReplacements = require("../../conf/replacements.json");
-
-//-----------------------------------------------------------------------------
-// Typedefs
-//-----------------------------------------------------------------------------
-
-/**
- * @import { RuleDefinition } from "@eslint/core";
- * @import { Linter } from "eslint";
- */
-
-//-----------------------------------------------------------------------------
-// Private Members
-//------------------------------------------------------------------------------
-
-// JSON schema that disallows passing any options
-const noOptionsSchema = Object.freeze({
- type: "array",
- minItems: 0,
- maxItems: 0,
-});
-
-const severities = new Map([
- [0, 0],
- [1, 1],
- [2, 2],
- ["off", 0],
- ["warn", 1],
- ["error", 2],
-]);
-
-/**
- * A collection of compiled validators for rules that have already
- * been validated.
- * @type {WeakMap}
- */
-const validators = new WeakMap();
-
-//-----------------------------------------------------------------------------
-// Helpers
-//-----------------------------------------------------------------------------
-
-/**
- * Throws a helpful error when a rule cannot be found.
- * @param {Object} ruleId The rule identifier.
- * @param {string} ruleId.pluginName The ID of the rule to find.
- * @param {string} ruleId.ruleName The ID of the rule to find.
- * @param {Object} config The config to search in.
- * @throws {TypeError} For missing plugin or rule.
- * @returns {void}
- */
-function throwRuleNotFoundError({ pluginName, ruleName }, config) {
- const ruleId = pluginName === "@" ? ruleName : `${pluginName}/${ruleName}`;
-
- const errorMessageHeader = `Key "rules": Key "${ruleId}"`;
-
- let errorMessage = `${errorMessageHeader}: Could not find plugin "${pluginName}" in configuration.`;
-
- const missingPluginErrorMessage = errorMessage;
-
- // if the plugin exists then we need to check if the rule exists
- if (config.plugins && config.plugins[pluginName]) {
- const replacementRuleName = ruleReplacements.rules[ruleName];
-
- if (pluginName === "@" && replacementRuleName) {
- errorMessage = `${errorMessageHeader}: Rule "${ruleName}" was removed and replaced by "${replacementRuleName}".`;
- } else {
- errorMessage = `${errorMessageHeader}: Could not find "${ruleName}" in plugin "${pluginName}".`;
-
- // otherwise, let's see if we can find the rule name elsewhere
- for (const [otherPluginName, otherPlugin] of Object.entries(
- config.plugins,
- )) {
- if (otherPlugin.rules && otherPlugin.rules[ruleName]) {
- errorMessage += ` Did you mean "${otherPluginName}/${ruleName}"?`;
- break;
- }
- }
- }
-
- // falls through to throw error
- }
-
- const error = new TypeError(errorMessage);
-
- if (errorMessage === missingPluginErrorMessage) {
- error.messageTemplate = "config-plugin-missing";
- error.messageData = { pluginName, ruleId };
- }
-
- throw error;
-}
-
-/**
- * The error type when a rule has an invalid `meta.schema`.
- */
-class InvalidRuleOptionsSchemaError extends Error {
- /**
- * Creates a new instance.
- * @param {string} ruleId Id of the rule that has an invalid `meta.schema`.
- * @param {Error} processingError Error caught while processing the `meta.schema`.
- */
- constructor(ruleId, processingError) {
- super(
- `Error while processing options validation schema of rule '${ruleId}': ${processingError.message}`,
- { cause: processingError },
- );
- this.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA";
- }
-}
-
-/**
- * Parses a ruleId into its plugin and rule parts.
- * @param {string} ruleId The rule ID to parse.
- * @returns {{pluginName:string,ruleName:string}} The plugin and rule
- * parts of the ruleId;
- */
-function parseRuleId(ruleId) {
- let pluginName, ruleName;
-
- // distinguish between core rules and plugin rules
- if (ruleId.includes("/")) {
- // mimic scoped npm packages
- if (ruleId.startsWith("@")) {
- pluginName = ruleId.slice(0, ruleId.lastIndexOf("/"));
- } else {
- pluginName = ruleId.slice(0, ruleId.indexOf("/"));
- }
-
- ruleName = ruleId.slice(pluginName.length + 1);
- } else {
- pluginName = "@";
- ruleName = ruleId;
- }
-
- return {
- pluginName,
- ruleName,
- };
-}
-
-/**
- * Retrieves a rule instance from a given config based on the ruleId.
- * @param {string} ruleId The rule ID to look for.
- * @param {Linter.Config} config The config to search.
- * @returns {RuleDefinition|undefined} The rule if found
- * or undefined if not.
- */
-function getRuleFromConfig(ruleId, config) {
- const { pluginName, ruleName } = parseRuleId(ruleId);
-
- return config.plugins?.[pluginName]?.rules?.[ruleName];
-}
-
-/**
- * Gets a complete options schema for a rule.
- * @param {RuleDefinition} rule A rule object
- * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.
- * @returns {Object|null} JSON Schema for the rule's options. `null` if `meta.schema` is `false`.
- */
-function getRuleOptionsSchema(rule) {
- if (!rule.meta) {
- return { ...noOptionsSchema }; // default if `meta.schema` is not specified
- }
-
- const schema = rule.meta.schema;
-
- if (typeof schema === "undefined") {
- return { ...noOptionsSchema }; // default if `meta.schema` is not specified
- }
-
- // `schema:false` is an allowed explicit opt-out of options validation for the rule
- if (schema === false) {
- return null;
- }
-
- if (typeof schema !== "object" || schema === null) {
- throw new TypeError("Rule's `meta.schema` must be an array or object");
- }
-
- // ESLint-specific array form needs to be converted into a valid JSON Schema definition
- if (Array.isArray(schema)) {
- if (schema.length) {
- return {
- type: "array",
- items: schema,
- minItems: 0,
- maxItems: schema.length,
- };
- }
-
- // `schema:[]` is an explicit way to specify that the rule does not accept any options
- return { ...noOptionsSchema };
- }
-
- // `schema: | |