oxlint-plugin-eslint 1.62.0 → 1.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/ast-utils.cjs +545 -155
- package/common/fix-tracker.cjs +1 -1
- package/common/keywords.cjs +1 -1
- package/common/regular-expressions.cjs +1 -1
- package/common/string-utils.cjs +1 -1
- package/index.js +27 -16
- package/package.json +1 -1
- package/rules/accessor-pairs.cjs +1 -1
- package/rules/array-bracket-newline.cjs +1 -1
- package/rules/array-bracket-spacing.cjs +2 -2
- package/rules/array-callback-return.cjs +11 -3
- package/rules/array-element-newline.cjs +1 -1
- package/rules/arrow-body-style.cjs +1 -1
- package/rules/arrow-parens.cjs +1 -1
- package/rules/arrow-spacing.cjs +1 -1
- package/rules/block-scoped-var.cjs +5 -3
- package/rules/block-spacing.cjs +2 -2
- package/rules/brace-style.cjs +1 -1
- package/rules/callback-return.cjs +1 -1
- package/rules/camelcase.cjs +1 -1
- package/rules/capitalized-comments.cjs +1 -1
- package/rules/class-methods-use-this.cjs +1 -1
- package/rules/comma-dangle.cjs +1 -1
- package/rules/comma-spacing.cjs +2 -2
- package/rules/comma-style.cjs +1 -1
- package/rules/complexity.cjs +1 -1
- package/rules/computed-property-spacing.cjs +2 -2
- package/rules/consistent-return.cjs +1 -1
- package/rules/consistent-this.cjs +1 -1
- package/rules/constructor-super.cjs +1 -1
- package/rules/curly.cjs +1 -1
- package/rules/default-case-last.cjs +1 -1
- package/rules/default-case.cjs +1 -1
- package/rules/default-param-last.cjs +1 -1
- package/rules/dot-location.cjs +1 -1
- package/rules/dot-notation.cjs +3 -3
- package/rules/eol-last.cjs +1 -1
- package/rules/eqeqeq.cjs +1 -1
- package/rules/for-direction.cjs +1 -1
- package/rules/func-call-spacing.cjs +1 -1
- package/rules/func-name-matching.cjs +1 -1
- package/rules/func-names.cjs +6 -3
- package/rules/func-style.cjs +1 -1
- package/rules/function-call-argument-newline.cjs +1 -1
- package/rules/function-paren-newline.cjs +1 -1
- package/rules/generator-star-spacing.cjs +1 -1
- package/rules/getter-return.cjs +1 -1
- package/rules/global-require.cjs +1 -1
- package/rules/grouped-accessor-pairs.cjs +1 -1
- package/rules/guard-for-in.cjs +1 -1
- package/rules/handle-callback-err.cjs +1 -1
- package/rules/id-blacklist.cjs +1 -1
- package/rules/id-denylist.cjs +1 -1
- package/rules/id-length.cjs +1 -1
- package/rules/id-match.cjs +1 -1
- package/rules/implicit-arrow-linebreak.cjs +1 -1
- package/rules/indent-legacy.cjs +1 -1
- package/rules/indent.cjs +1 -1
- package/rules/init-declarations.cjs +1 -1
- package/rules/jsx-quotes.cjs +1 -1
- package/rules/key-spacing.cjs +1 -1
- package/rules/keyword-spacing.cjs +5 -5
- package/rules/line-comment-position.cjs +1 -1
- package/rules/linebreak-style.cjs +1 -1
- package/rules/lines-around-comment.cjs +1 -1
- package/rules/lines-around-directive.cjs +1 -1
- package/rules/lines-between-class-members.cjs +1 -1
- package/rules/logical-assignment-operators.cjs +1 -1
- package/rules/max-classes-per-file.cjs +1 -1
- package/rules/max-depth.cjs +1 -1
- package/rules/max-len.cjs +1 -1
- package/rules/max-lines-per-function.cjs +1 -1
- package/rules/max-lines.cjs +1 -1
- package/rules/max-nested-callbacks.cjs +1 -1
- package/rules/max-params.cjs +15 -6
- package/rules/max-statements-per-line.cjs +1 -1
- package/rules/max-statements.cjs +1 -1
- package/rules/multiline-comment-style.cjs +1 -1
- package/rules/multiline-ternary.cjs +1 -1
- package/rules/new-cap.cjs +1 -1
- package/rules/new-parens.cjs +1 -1
- package/rules/newline-after-var.cjs +1 -1
- package/rules/newline-before-return.cjs +1 -1
- package/rules/newline-per-chained-call.cjs +1 -1
- package/rules/no-alert.cjs +1 -1
- package/rules/no-array-constructor.cjs +1 -1
- package/rules/no-async-promise-executor.cjs +4 -3
- package/rules/no-await-in-loop.cjs +1 -1
- package/rules/no-bitwise.cjs +1 -1
- package/rules/no-buffer-constructor.cjs +1 -1
- package/rules/no-caller.cjs +1 -1
- package/rules/no-case-declarations.cjs +1 -1
- package/rules/no-catch-shadow.cjs +1 -1
- package/rules/no-class-assign.cjs +1 -1
- package/rules/no-compare-neg-zero.cjs +1 -1
- package/rules/no-cond-assign.cjs +1 -1
- package/rules/no-confusing-arrow.cjs +1 -1
- package/rules/no-console.cjs +5 -4
- package/rules/no-const-assign.cjs +1 -1
- package/rules/no-constant-binary-expression.cjs +1 -1
- package/rules/no-constant-condition.cjs +1 -1
- package/rules/no-constructor-return.cjs +1 -1
- package/rules/no-continue.cjs +1 -1
- package/rules/no-control-regex.cjs +1 -1
- package/rules/no-debugger.cjs +1 -1
- package/rules/no-delete-var.cjs +1 -1
- package/rules/no-div-regex.cjs +1 -1
- package/rules/no-dupe-args.cjs +3 -2
- package/rules/no-dupe-class-members.cjs +1 -1
- package/rules/no-dupe-else-if.cjs +1 -1
- package/rules/no-dupe-keys.cjs +1 -1
- package/rules/no-duplicate-case.cjs +1 -1
- package/rules/no-duplicate-imports.cjs +1 -1
- package/rules/no-else-return.cjs +4 -3
- package/rules/no-empty-character-class.cjs +1 -1
- package/rules/no-empty-function.cjs +1 -1
- package/rules/no-empty-pattern.cjs +1 -1
- package/rules/no-empty-static-block.cjs +1 -1
- package/rules/no-empty.cjs +1 -1
- package/rules/no-eq-null.cjs +1 -1
- package/rules/no-eval.cjs +4 -4
- package/rules/no-ex-assign.cjs +1 -1
- package/rules/no-extend-native.cjs +1 -1
- package/rules/no-extra-bind.cjs +1 -1
- package/rules/no-extra-boolean-cast.cjs +1 -1
- package/rules/no-extra-label.cjs +1 -1
- package/rules/no-extra-parens.cjs +2 -2
- package/rules/no-extra-semi.cjs +1 -1
- package/rules/no-fallthrough.cjs +1 -1
- package/rules/no-floating-decimal.cjs +1 -1
- package/rules/no-func-assign.cjs +1 -1
- package/rules/no-global-assign.cjs +1 -1
- package/rules/no-implicit-coercion.cjs +1 -1
- package/rules/no-implicit-globals.cjs +1 -1
- package/rules/no-implied-eval.cjs +3 -2
- package/rules/no-import-assign.cjs +1 -1
- package/rules/no-inline-comments.cjs +1 -1
- package/rules/no-inner-declarations.cjs +1 -1
- package/rules/no-invalid-regexp.cjs +3 -2
- package/rules/no-invalid-this.cjs +1 -1
- package/rules/no-irregular-whitespace.cjs +1 -1
- package/rules/no-iterator.cjs +1 -1
- package/rules/no-label-var.cjs +1 -1
- package/rules/no-labels.cjs +1 -1
- package/rules/no-lone-blocks.cjs +1 -1
- package/rules/no-lonely-if.cjs +1 -1
- package/rules/no-loop-func.cjs +4 -3
- package/rules/no-loss-of-precision.cjs +1 -1
- package/rules/no-magic-numbers.cjs +1 -1
- package/rules/no-misleading-character-class.cjs +3 -3
- package/rules/no-mixed-operators.cjs +1 -1
- package/rules/no-mixed-requires.cjs +1 -1
- package/rules/no-mixed-spaces-and-tabs.cjs +1 -1
- package/rules/no-multi-assign.cjs +1 -1
- package/rules/no-multi-spaces.cjs +1 -1
- package/rules/no-multi-str.cjs +1 -1
- package/rules/no-multiple-empty-lines.cjs +1 -1
- package/rules/no-native-reassign.cjs +1 -1
- package/rules/no-negated-condition.cjs +1 -1
- package/rules/no-negated-in-lhs.cjs +1 -1
- package/rules/no-nested-ternary.cjs +1 -1
- package/rules/no-new-func.cjs +1 -1
- package/rules/no-new-native-nonconstructor.cjs +1 -1
- package/rules/no-new-object.cjs +1 -1
- package/rules/no-new-require.cjs +1 -1
- package/rules/no-new-symbol.cjs +1 -1
- package/rules/no-new-wrappers.cjs +1 -1
- package/rules/no-new.cjs +1 -1
- package/rules/no-nonoctal-decimal-escape.cjs +1 -1
- package/rules/no-obj-calls.cjs +3 -2
- package/rules/no-object-constructor.cjs +1 -1
- package/rules/no-octal-escape.cjs +1 -1
- package/rules/no-octal.cjs +1 -1
- package/rules/no-param-reassign.cjs +1 -1
- package/rules/no-path-concat.cjs +1 -1
- package/rules/no-plusplus.cjs +1 -1
- package/rules/no-process-env.cjs +1 -1
- package/rules/no-process-exit.cjs +1 -1
- package/rules/no-promise-executor-return.cjs +1 -1
- package/rules/no-proto.cjs +1 -1
- package/rules/no-prototype-builtins.cjs +1 -1
- package/rules/no-redeclare.cjs +1 -1
- package/rules/no-regex-spaces.cjs +1 -1
- package/rules/no-restricted-exports.cjs +1 -1
- package/rules/no-restricted-globals.cjs +1 -1
- package/rules/no-restricted-imports.cjs +39 -16
- package/rules/no-restricted-modules.cjs +1 -1
- package/rules/no-restricted-properties.cjs +1 -1
- package/rules/no-restricted-syntax.cjs +1 -1
- package/rules/no-return-assign.cjs +1 -1
- package/rules/no-return-await.cjs +1 -1
- package/rules/no-script-url.cjs +1 -1
- package/rules/no-self-assign.cjs +1 -1
- package/rules/no-self-compare.cjs +1 -1
- package/rules/no-sequences.cjs +1 -1
- package/rules/no-setter-return.cjs +1 -1
- package/rules/no-shadow-restricted-names.cjs +2 -2
- package/rules/no-shadow.cjs +45 -13
- package/rules/no-spaced-func.cjs +2 -2
- package/rules/no-sparse-arrays.cjs +1 -1
- package/rules/no-sync.cjs +1 -1
- package/rules/no-tabs.cjs +1 -1
- package/rules/no-template-curly-in-string.cjs +1 -1
- package/rules/no-ternary.cjs +1 -1
- package/rules/no-this-before-super.cjs +1 -1
- package/rules/no-throw-literal.cjs +1 -1
- package/rules/no-trailing-spaces.cjs +1 -1
- package/rules/no-unassigned-vars.cjs +2 -2
- package/rules/no-undef-init.cjs +1 -1
- package/rules/no-undef.cjs +1 -1
- package/rules/no-undefined.cjs +3 -2
- package/rules/no-underscore-dangle.cjs +1 -1
- package/rules/no-unexpected-multiline.cjs +1 -1
- package/rules/no-unmodified-loop-condition.cjs +28 -65
- package/rules/no-unneeded-ternary.cjs +1 -1
- package/rules/no-unreachable-loop.cjs +1 -1
- package/rules/no-unreachable.cjs +1 -1
- package/rules/no-unsafe-finally.cjs +1 -1
- package/rules/no-unsafe-negation.cjs +1 -1
- package/rules/no-unsafe-optional-chaining.cjs +1 -1
- package/rules/no-unused-expressions.cjs +1 -1
- package/rules/no-unused-labels.cjs +1 -1
- package/rules/no-unused-private-class-members.cjs +1 -1
- package/rules/no-unused-vars.cjs +6 -4
- package/rules/no-use-before-define.cjs +7 -5
- package/rules/no-useless-assignment.cjs +11 -7
- package/rules/no-useless-backreference.cjs +1 -1
- package/rules/no-useless-call.cjs +1 -1
- package/rules/no-useless-catch.cjs +1 -1
- package/rules/no-useless-computed-key.cjs +1 -1
- package/rules/no-useless-concat.cjs +1 -1
- package/rules/no-useless-constructor.cjs +9 -5
- package/rules/no-useless-escape.cjs +1 -1
- package/rules/no-useless-rename.cjs +1 -1
- package/rules/no-useless-return.cjs +1 -1
- package/rules/no-var.cjs +27 -10
- package/rules/no-void.cjs +1 -1
- package/rules/no-warning-comments.cjs +1 -1
- package/rules/no-whitespace-before-property.cjs +2 -2
- package/rules/no-with.cjs +1 -1
- package/rules/nonblock-statement-body-position.cjs +1 -1
- package/rules/object-curly-newline.cjs +1 -1
- package/rules/object-curly-spacing.cjs +3 -3
- package/rules/object-property-newline.cjs +1 -1
- package/rules/object-shorthand.cjs +1 -1
- package/rules/one-var-declaration-per-line.cjs +1 -1
- package/rules/one-var.cjs +1 -1
- package/rules/operator-assignment.cjs +1 -1
- package/rules/operator-linebreak.cjs +1 -1
- package/rules/padded-blocks.cjs +1 -1
- package/rules/padding-line-between-statements.cjs +1 -1
- package/rules/prefer-arrow-callback.cjs +6 -4
- package/rules/prefer-const.cjs +6 -6
- package/rules/prefer-destructuring.cjs +1 -1
- package/rules/prefer-exponentiation-operator.cjs +1 -1
- package/rules/prefer-named-capture-group.cjs +1 -1
- package/rules/prefer-numeric-literals.cjs +1 -1
- package/rules/prefer-object-has-own.cjs +1 -1
- package/rules/prefer-object-spread.cjs +1 -1
- package/rules/prefer-promise-reject-errors.cjs +1 -1
- package/rules/prefer-reflect.cjs +1 -1
- package/rules/prefer-regex-literals.cjs +1 -1
- package/rules/prefer-rest-params.cjs +8 -5
- package/rules/prefer-spread.cjs +1 -1
- package/rules/prefer-template.cjs +1 -1
- package/rules/preserve-caught-error.cjs +2 -2
- package/rules/quote-props.cjs +1 -1
- package/rules/quotes.cjs +1 -1
- package/rules/radix.cjs +7 -20
- package/rules/require-atomic-updates.cjs +1 -1
- package/rules/require-await.cjs +1 -1
- package/rules/require-unicode-regexp.cjs +1 -1
- package/rules/require-yield.cjs +6 -4
- package/rules/rest-spread-spacing.cjs +2 -2
- package/rules/semi-spacing.cjs +3 -3
- package/rules/semi-style.cjs +1 -1
- package/rules/semi.cjs +1 -1
- package/rules/sort-imports.cjs +1 -1
- package/rules/sort-vars.cjs +1 -1
- package/rules/space-before-blocks.cjs +2 -2
- package/rules/space-before-function-paren.cjs +2 -2
- package/rules/space-in-parens.cjs +5 -5
- package/rules/space-infix-ops.cjs +3 -3
- package/rules/space-unary-ops.cjs +1 -1
- package/rules/spaced-comment.cjs +1 -1
- package/rules/strict.cjs +6 -2
- package/rules/switch-colon-spacing.cjs +2 -2
- package/rules/symbol-description.cjs +1 -1
- package/rules/template-curly-spacing.cjs +1 -1
- package/rules/template-tag-spacing.cjs +2 -2
- package/rules/unicode-bom.cjs +1 -1
- package/rules/use-isnan.cjs +1 -1
- package/rules/valid-typeof.cjs +1 -1
- package/rules/vars-on-top.cjs +1 -1
- package/rules/wrap-iife.cjs +1 -1
- package/rules/wrap-regex.cjs +1 -1
- package/rules/yield-star-spacing.cjs +2 -2
- package/rules/yoda.cjs +1 -1
package/common/ast-utils.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk.cjs");
|
|
2
|
-
//#region ../../node_modules/.pnpm/eslint-visitor-keys@
|
|
2
|
+
//#region ../../node_modules/.pnpm/eslint-visitor-keys@5.0.1/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
|
|
3
3
|
var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) => {
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
|
|
@@ -494,8 +494,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
494
494
|
4,
|
|
495
495
|
318,
|
|
496
496
|
1,
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
78,
|
|
498
|
+
5,
|
|
499
499
|
71,
|
|
500
500
|
10,
|
|
501
501
|
50,
|
|
@@ -640,7 +640,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
640
640
|
10,
|
|
641
641
|
47,
|
|
642
642
|
15,
|
|
643
|
-
|
|
643
|
+
199,
|
|
644
|
+
7,
|
|
645
|
+
137,
|
|
644
646
|
9,
|
|
645
647
|
54,
|
|
646
648
|
7,
|
|
@@ -672,7 +674,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
672
674
|
4,
|
|
673
675
|
9,
|
|
674
676
|
9,
|
|
675
|
-
|
|
677
|
+
55,
|
|
678
|
+
9,
|
|
679
|
+
266,
|
|
676
680
|
3,
|
|
677
681
|
10,
|
|
678
682
|
1,
|
|
@@ -772,7 +776,15 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
772
776
|
1,
|
|
773
777
|
2,
|
|
774
778
|
9,
|
|
775
|
-
|
|
779
|
+
233,
|
|
780
|
+
0,
|
|
781
|
+
3,
|
|
782
|
+
0,
|
|
783
|
+
8,
|
|
784
|
+
1,
|
|
785
|
+
6,
|
|
786
|
+
0,
|
|
787
|
+
475,
|
|
776
788
|
6,
|
|
777
789
|
110,
|
|
778
790
|
6,
|
|
@@ -881,7 +893,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
881
893
|
21,
|
|
882
894
|
11,
|
|
883
895
|
25,
|
|
884
|
-
|
|
896
|
+
7,
|
|
897
|
+
25,
|
|
898
|
+
39,
|
|
885
899
|
55,
|
|
886
900
|
7,
|
|
887
901
|
1,
|
|
@@ -926,8 +940,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
926
940
|
7,
|
|
927
941
|
1,
|
|
928
942
|
17,
|
|
929
|
-
|
|
930
|
-
|
|
943
|
+
5,
|
|
944
|
+
57,
|
|
931
945
|
28,
|
|
932
946
|
11,
|
|
933
947
|
0,
|
|
@@ -1111,7 +1125,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1111
1125
|
31,
|
|
1112
1126
|
15,
|
|
1113
1127
|
0,
|
|
1114
|
-
|
|
1128
|
+
24,
|
|
1129
|
+
43,
|
|
1130
|
+
261,
|
|
1115
1131
|
18,
|
|
1116
1132
|
16,
|
|
1117
1133
|
0,
|
|
@@ -1159,7 +1175,11 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1159
1175
|
44,
|
|
1160
1176
|
212,
|
|
1161
1177
|
63,
|
|
1162
|
-
|
|
1178
|
+
33,
|
|
1179
|
+
24,
|
|
1180
|
+
3,
|
|
1181
|
+
24,
|
|
1182
|
+
45,
|
|
1163
1183
|
74,
|
|
1164
1184
|
6,
|
|
1165
1185
|
0,
|
|
@@ -1169,13 +1189,15 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1169
1189
|
1,
|
|
1170
1190
|
2,
|
|
1171
1191
|
0,
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1192
|
+
15,
|
|
1193
|
+
4,
|
|
1194
|
+
10,
|
|
1195
|
+
7381,
|
|
1176
1196
|
42,
|
|
1177
|
-
|
|
1178
|
-
|
|
1197
|
+
31,
|
|
1198
|
+
98,
|
|
1199
|
+
114,
|
|
1200
|
+
8702,
|
|
1179
1201
|
3,
|
|
1180
1202
|
2,
|
|
1181
1203
|
6,
|
|
@@ -1283,7 +1305,19 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1283
1305
|
29,
|
|
1284
1306
|
3,
|
|
1285
1307
|
0,
|
|
1286
|
-
|
|
1308
|
+
208,
|
|
1309
|
+
30,
|
|
1310
|
+
2,
|
|
1311
|
+
2,
|
|
1312
|
+
2,
|
|
1313
|
+
1,
|
|
1314
|
+
2,
|
|
1315
|
+
6,
|
|
1316
|
+
3,
|
|
1317
|
+
4,
|
|
1318
|
+
10,
|
|
1319
|
+
1,
|
|
1320
|
+
225,
|
|
1287
1321
|
6,
|
|
1288
1322
|
2,
|
|
1289
1323
|
3,
|
|
@@ -1366,12 +1400,10 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1366
1400
|
4421,
|
|
1367
1401
|
42719,
|
|
1368
1402
|
33,
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1403
|
+
4381,
|
|
1404
|
+
3,
|
|
1405
|
+
5773,
|
|
1372
1406
|
3,
|
|
1373
|
-
5761,
|
|
1374
|
-
15,
|
|
1375
1407
|
7472,
|
|
1376
1408
|
16,
|
|
1377
1409
|
621,
|
|
@@ -1380,8 +1412,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1380
1412
|
1507,
|
|
1381
1413
|
4938,
|
|
1382
1414
|
6,
|
|
1383
|
-
|
|
1384
|
-
], nonASCIIidentifierChars = "
|
|
1415
|
+
8489
|
|
1416
|
+
], nonASCIIidentifierChars = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・", nonASCIIidentifierStartChars = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", reservedWords = {
|
|
1385
1417
|
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
1386
1418
|
5: "class enum extends super const export import",
|
|
1387
1419
|
6: "enum",
|
|
@@ -1620,7 +1652,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1620
1652
|
return tokens.push(token);
|
|
1621
1653
|
};
|
|
1622
1654
|
}
|
|
1623
|
-
|
|
1655
|
+
if (isArray(options.onComment) && (options.onComment = pushComment(options, options.onComment)), options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
1656
|
+
return options;
|
|
1624
1657
|
}
|
|
1625
1658
|
function pushComment(options, array) {
|
|
1626
1659
|
return function(block, text, start, end, startLoc, endLoc) {
|
|
@@ -1633,7 +1666,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1633
1666
|
options.locations && (comment.loc = new SourceLocation(this, startLoc, endLoc)), options.ranges && (comment.range = [start, end]), array.push(comment);
|
|
1634
1667
|
};
|
|
1635
1668
|
}
|
|
1636
|
-
var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
1669
|
+
var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, 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;
|
|
1637
1670
|
function functionFlags(async, generator) {
|
|
1638
1671
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
1639
1672
|
}
|
|
@@ -1642,16 +1675,18 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1642
1675
|
var reserved = "";
|
|
1643
1676
|
options.allowReserved !== !0 && (reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3], options.sourceType === "module" && (reserved += " await")), this.reservedWords = wordsRegexp(reserved);
|
|
1644
1677
|
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
|
|
1645
|
-
this.reservedWordsStrict = wordsRegexp(reservedStrict), this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind), this.input = String(input), this.containsEsc = !1, startPos ? (this.pos = startPos, this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = types$1.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = options.sourceType === "module", this.strict = this.inModule || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(SCOPE_TOP), this.regexpState = null, this.privateNameStack = [];
|
|
1678
|
+
this.reservedWordsStrict = wordsRegexp(reservedStrict), this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind), this.input = String(input), this.containsEsc = !1, startPos ? (this.pos = startPos, this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = types$1.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = options.sourceType === "module", this.strict = this.inModule || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ? SCOPE_FUNCTION : SCOPE_TOP), this.regexpState = null, this.privateNameStack = [];
|
|
1646
1679
|
}, prototypeAccessors = {
|
|
1647
1680
|
inFunction: { configurable: !0 },
|
|
1648
1681
|
inGenerator: { configurable: !0 },
|
|
1649
1682
|
inAsync: { configurable: !0 },
|
|
1650
1683
|
canAwait: { configurable: !0 },
|
|
1684
|
+
allowReturn: { configurable: !0 },
|
|
1651
1685
|
allowSuper: { configurable: !0 },
|
|
1652
1686
|
allowDirectSuper: { configurable: !0 },
|
|
1653
1687
|
treatFunctionsAsVar: { configurable: !0 },
|
|
1654
1688
|
allowNewDotTarget: { configurable: !0 },
|
|
1689
|
+
allowUsing: { configurable: !0 },
|
|
1655
1690
|
inClassStaticBlock: { configurable: !0 }
|
|
1656
1691
|
};
|
|
1657
1692
|
Parser.prototype.parse = function parse() {
|
|
@@ -1670,6 +1705,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1670
1705
|
if (flags & SCOPE_FUNCTION) return (flags & SCOPE_ASYNC) > 0;
|
|
1671
1706
|
}
|
|
1672
1707
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
1708
|
+
}, prototypeAccessors.allowReturn.get = function() {
|
|
1709
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP);
|
|
1673
1710
|
}, prototypeAccessors.allowSuper.get = function() {
|
|
1674
1711
|
return (this.currentThisScope().flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
|
|
1675
1712
|
}, prototypeAccessors.allowDirectSuper.get = function() {
|
|
@@ -1682,6 +1719,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1682
1719
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW)) return !0;
|
|
1683
1720
|
}
|
|
1684
1721
|
return !1;
|
|
1722
|
+
}, prototypeAccessors.allowUsing.get = function() {
|
|
1723
|
+
var flags = this.currentScope().flags;
|
|
1724
|
+
return !(flags & SCOPE_SWITCH || !this.inModule && flags & SCOPE_TOP);
|
|
1685
1725
|
}, prototypeAccessors.inClassStaticBlock.get = function() {
|
|
1686
1726
|
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
|
|
1687
1727
|
}, Parser.extend = function extend() {
|
|
@@ -1761,20 +1801,23 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1761
1801
|
var name = list[i];
|
|
1762
1802
|
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
1763
1803
|
}
|
|
1764
|
-
return this.adaptDirectivePrologue(node.body), this.next(), node.sourceType = this.options.sourceType, this.finishNode(node, "Program");
|
|
1804
|
+
return this.adaptDirectivePrologue(node.body), this.next(), node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(node, "Program");
|
|
1765
1805
|
};
|
|
1766
1806
|
var loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
|
|
1767
1807
|
pp$8.isLet = function(context) {
|
|
1768
1808
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
1769
1809
|
skipWhiteSpace.lastIndex = this.pos;
|
|
1770
|
-
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, nextCh = this.
|
|
1810
|
+
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
|
|
1771
1811
|
if (nextCh === 91 || nextCh === 92) return !0;
|
|
1772
1812
|
if (context) return !1;
|
|
1773
|
-
if (nextCh === 123
|
|
1774
|
-
if (isIdentifierStart(nextCh
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1813
|
+
if (nextCh === 123) return !0;
|
|
1814
|
+
if (isIdentifierStart(nextCh)) {
|
|
1815
|
+
var start = next;
|
|
1816
|
+
do
|
|
1817
|
+
next += nextCh <= 65535 ? 1 : 2;
|
|
1818
|
+
while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)));
|
|
1819
|
+
if (nextCh === 92) return !0;
|
|
1820
|
+
var ident = this.input.slice(start, next);
|
|
1778
1821
|
if (!keywordRelationalOperator.test(ident)) return !0;
|
|
1779
1822
|
}
|
|
1780
1823
|
return !1;
|
|
@@ -1782,25 +1825,28 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1782
1825
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
1783
1826
|
skipWhiteSpace.lastIndex = this.pos;
|
|
1784
1827
|
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, after;
|
|
1785
|
-
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.
|
|
1828
|
+
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92));
|
|
1786
1829
|
}, pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
1787
1830
|
if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) return !1;
|
|
1788
1831
|
skipWhiteSpace.lastIndex = this.pos;
|
|
1789
1832
|
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length;
|
|
1790
1833
|
if (lineBreak.test(this.input.slice(this.pos, next))) return !1;
|
|
1791
1834
|
if (isAwaitUsing) {
|
|
1792
|
-
var
|
|
1793
|
-
if (this.input.slice(next,
|
|
1794
|
-
skipWhiteSpace.lastIndex =
|
|
1835
|
+
var usingEndPos = next + 5, after;
|
|
1836
|
+
if (this.input.slice(next, usingEndPos) !== "using" || usingEndPos === this.input.length || isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) || after === 92) return !1;
|
|
1837
|
+
skipWhiteSpace.lastIndex = usingEndPos;
|
|
1795
1838
|
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
1796
|
-
if (skipAfterUsing && lineBreak.test(this.input.slice(
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1839
|
+
if (next = usingEndPos + skipAfterUsing[0].length, skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) return !1;
|
|
1840
|
+
}
|
|
1841
|
+
var ch = this.fullCharCodeAt(next);
|
|
1842
|
+
if (!isIdentifierStart(ch) && ch !== 92) return !1;
|
|
1843
|
+
var idStart = next;
|
|
1844
|
+
do
|
|
1845
|
+
next += ch <= 65535 ? 1 : 2;
|
|
1846
|
+
while (isIdentifierChar(ch = this.fullCharCodeAt(next)));
|
|
1847
|
+
if (ch === 92) return !0;
|
|
1848
|
+
var id = this.input.slice(idStart, next);
|
|
1849
|
+
return !(keywordRelationalOperator.test(id) || isFor && id === "of");
|
|
1804
1850
|
}, pp$8.isAwaitUsing = function(isFor) {
|
|
1805
1851
|
return this.isUsingKeyword(!0, isFor);
|
|
1806
1852
|
}, pp$8.isUsing = function(isFor) {
|
|
@@ -1837,7 +1883,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1837
1883
|
default:
|
|
1838
1884
|
if (this.isAsyncFunction()) return context && this.unexpected(), this.next(), this.parseFunctionStatement(node, !0, !context);
|
|
1839
1885
|
var usingKind = this.isAwaitUsing(!1) ? "await using" : this.isUsing(!1) ? "using" : null;
|
|
1840
|
-
if (usingKind) return
|
|
1886
|
+
if (usingKind) return 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"), usingKind === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.next(), this.parseVar(node, !1, usingKind), this.semicolon(), this.finishNode(node, "VariableDeclaration");
|
|
1841
1887
|
var maybeName = this.value, expr = this.parseExpression();
|
|
1842
1888
|
return starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon) ? this.parseLabeledStatement(node, maybeName, expr, context) : this.parseExpressionStatement(node, expr);
|
|
1843
1889
|
}
|
|
@@ -1865,7 +1911,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1865
1911
|
var startsWithLet = this.isContextual("let"), isForOf = !1, usingKind = this.isUsing(!0) ? "using" : this.isAwaitUsing(!0) ? "await using" : null;
|
|
1866
1912
|
if (usingKind) {
|
|
1867
1913
|
var init$2 = this.startNode();
|
|
1868
|
-
return this.next(), usingKind === "await using" && this.next(), this.parseVar(init$2, !0, usingKind), this.finishNode(init$2, "VariableDeclaration"), this.parseForAfterInit(node, init$2, awaitAt);
|
|
1914
|
+
return this.next(), usingKind === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.parseVar(init$2, !0, usingKind), this.finishNode(init$2, "VariableDeclaration"), this.parseForAfterInit(node, init$2, awaitAt);
|
|
1869
1915
|
}
|
|
1870
1916
|
var containsEsc = this.containsEsc, refDestructuringErrors = new DestructuringErrors(), initPos = this.start, init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(!0, refDestructuringErrors);
|
|
1871
1917
|
return this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (awaitAt > -1 ? (this.type === types$1._in && this.unexpected(awaitAt), node.await = !0) : isForOf && this.options.ecmaVersion >= 8 && (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (node.await = !1)), startsWithLet && isForOf && this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(init, !1, refDestructuringErrors), this.checkLValPattern(init), this.parseForIn(node, init)) : (this.checkExpressionErrors(refDestructuringErrors, !0), awaitAt > -1 && this.unexpected(awaitAt), this.parseFor(node, init));
|
|
@@ -1876,9 +1922,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
1876
1922
|
}, pp$8.parseIfStatement = function(node) {
|
|
1877
1923
|
return this.next(), node.test = this.parseParenExpression(), node.consequent = this.parseStatement("if"), node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null, this.finishNode(node, "IfStatement");
|
|
1878
1924
|
}, pp$8.parseReturnStatement = function(node) {
|
|
1879
|
-
return
|
|
1925
|
+
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(types$1.semi) || this.insertSemicolon() ? node.argument = null : (node.argument = this.parseExpression(), this.semicolon()), this.finishNode(node, "ReturnStatement");
|
|
1880
1926
|
}, pp$8.parseSwitchStatement = function(node) {
|
|
1881
|
-
this.next(), node.discriminant = this.parseParenExpression(), node.cases = [], this.expect(types$1.braceL), this.labels.push(switchLabel), this.enterScope(
|
|
1927
|
+
this.next(), node.discriminant = this.parseParenExpression(), node.cases = [], this.expect(types$1.braceL), this.labels.push(switchLabel), this.enterScope(SCOPE_SWITCH);
|
|
1882
1928
|
for (var cur, sawDefault = !1; this.type !== types$1.braceR;) if (this.type === types$1._case || this.type === types$1._default) {
|
|
1883
1929
|
var isCase = this.type === types$1._case;
|
|
1884
1930
|
cur && this.finishNode(cur, "SwitchCase"), node.cases.push(cur = this.startNode()), cur.consequent = [], this.next(), isCase ? cur.test = this.parseExpression() : (sawDefault && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), sawDefault = !0, cur.test = null), this.expect(types$1.colon);
|
|
@@ -2739,7 +2785,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
2739
2785
|
for (var prop in node) newNode[prop] = node[prop];
|
|
2740
2786
|
return newNode;
|
|
2741
2787
|
};
|
|
2742
|
-
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", ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic", ecma11BinaryProperties = ecma10BinaryProperties, ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict", ecma13BinaryProperties = ecma12BinaryProperties, unicodeBinaryProperties = {
|
|
2788
|
+
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", ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic", ecma11BinaryProperties = ecma10BinaryProperties, ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict", ecma13BinaryProperties = ecma12BinaryProperties, unicodeBinaryProperties = {
|
|
2743
2789
|
9: ecma9BinaryProperties,
|
|
2744
2790
|
10: ecma10BinaryProperties,
|
|
2745
2791
|
11: ecma11BinaryProperties,
|
|
@@ -3316,11 +3362,13 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
3316
3362
|
this.readToken(this.fullCharCodeAtPos());
|
|
3317
3363
|
}, pp.readToken = function(code) {
|
|
3318
3364
|
return isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 ? this.readWord() : this.getTokenFromCode(code);
|
|
3319
|
-
}, pp.
|
|
3320
|
-
var code = this.input.charCodeAt(
|
|
3365
|
+
}, pp.fullCharCodeAt = function(pos) {
|
|
3366
|
+
var code = this.input.charCodeAt(pos);
|
|
3321
3367
|
if (code <= 55295 || code >= 56320) return code;
|
|
3322
|
-
var next = this.input.charCodeAt(
|
|
3368
|
+
var next = this.input.charCodeAt(pos + 1);
|
|
3323
3369
|
return next <= 56319 || next >= 57344 ? code : (code << 10) + next - 56613888;
|
|
3370
|
+
}, pp.fullCharCodeAtPos = function() {
|
|
3371
|
+
return this.fullCharCodeAt(this.pos);
|
|
3324
3372
|
}, pp.skipBlockComment = function() {
|
|
3325
3373
|
var startLoc = this.options.onComment && this.curPosition(), start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
3326
3374
|
if (end === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = end + 2, this.options.locations) for (var nextBreak = void 0, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) ++this.curLine, pos = this.lineStart = nextBreak;
|
|
@@ -3629,7 +3677,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
3629
3677
|
var word = this.readWord1(), type = types$1.name;
|
|
3630
3678
|
return this.keywords.test(word) && (type = keywords[word]), this.finishToken(type, word);
|
|
3631
3679
|
};
|
|
3632
|
-
var version = "8.
|
|
3680
|
+
var version = "8.16.0";
|
|
3633
3681
|
Parser.acorn = {
|
|
3634
3682
|
Parser,
|
|
3635
3683
|
version,
|
|
@@ -4130,13 +4178,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4130
4178
|
};
|
|
4131
4179
|
}
|
|
4132
4180
|
})), require_espree = /* @__PURE__ */ require_chunk.t(((exports) => {
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
function _interopDefaultLegacy(e) {
|
|
4136
|
-
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
4137
|
-
}
|
|
4138
|
-
function _interopNamespace(e) {
|
|
4139
|
-
if (e && e.__esModule) return e;
|
|
4181
|
+
var acorn = require_acorn(), jsx = require_acorn_jsx(), eslintVisitorKeys = require_eslint_visitor_keys();
|
|
4182
|
+
function _interopNamespaceDefault(e) {
|
|
4140
4183
|
var n = Object.create(null);
|
|
4141
4184
|
return e && Object.keys(e).forEach(function(k) {
|
|
4142
4185
|
if (k !== "default") {
|
|
@@ -4150,11 +4193,40 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4150
4193
|
}
|
|
4151
4194
|
}), n.default = e, Object.freeze(n);
|
|
4152
4195
|
}
|
|
4153
|
-
var acorn__namespace = /* @__PURE__ */
|
|
4196
|
+
var acorn__namespace = /* @__PURE__ */ _interopNamespaceDefault(acorn);
|
|
4154
4197
|
/**
|
|
4155
4198
|
* @fileoverview Translates tokens between Acorn format and Esprima format.
|
|
4156
4199
|
* @author Nicholas C. Zakas
|
|
4157
4200
|
*/
|
|
4201
|
+
/**
|
|
4202
|
+
* @import * as acorn from "acorn";
|
|
4203
|
+
* @import { EnhancedTokTypes } from "./espree.js"
|
|
4204
|
+
* @import { NormalizedEcmaVersion } from "./options.js";
|
|
4205
|
+
* @import { EspreeToken as EsprimaToken } from "../espree.js";
|
|
4206
|
+
*/
|
|
4207
|
+
/**
|
|
4208
|
+
* Based on the `acorn.Token` class, but without a fixed `type` (since we need
|
|
4209
|
+
* it to be a string). Avoiding `type` lets us make one extending interface
|
|
4210
|
+
* more strict and another more lax.
|
|
4211
|
+
*
|
|
4212
|
+
* We could make `value` more strict to `string` even though the original is
|
|
4213
|
+
* `any`.
|
|
4214
|
+
*
|
|
4215
|
+
* `start` and `end` are required in `acorn.Token`
|
|
4216
|
+
*
|
|
4217
|
+
* `loc` and `range` are from `acorn.Token`
|
|
4218
|
+
*
|
|
4219
|
+
* Adds `regex`.
|
|
4220
|
+
*/
|
|
4221
|
+
/**
|
|
4222
|
+
* @typedef {{
|
|
4223
|
+
* jsxAttrValueToken: boolean;
|
|
4224
|
+
* ecmaVersion: NormalizedEcmaVersion;
|
|
4225
|
+
* }} ExtraNoTokens
|
|
4226
|
+
* @typedef {{
|
|
4227
|
+
* tokens: EsprimaToken[]
|
|
4228
|
+
* } & ExtraNoTokens} Extra
|
|
4229
|
+
*/
|
|
4158
4230
|
let Token = {
|
|
4159
4231
|
Boolean: "Boolean",
|
|
4160
4232
|
EOF: "<end>",
|
|
@@ -4172,7 +4244,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4172
4244
|
};
|
|
4173
4245
|
/**
|
|
4174
4246
|
* Converts part of a template into an Esprima token.
|
|
4175
|
-
* @param {
|
|
4247
|
+
* @param {acorn.Token[]} tokens The Acorn tokens representing the template.
|
|
4176
4248
|
* @param {string} code The source code.
|
|
4177
4249
|
* @returns {EsprimaToken} The Esprima equivalent of the template token.
|
|
4178
4250
|
* @private
|
|
@@ -4189,48 +4261,49 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4189
4261
|
}
|
|
4190
4262
|
/**
|
|
4191
4263
|
* Contains logic to translate Acorn tokens into Esprima tokens.
|
|
4192
|
-
* @param {Object} acornTokTypes The Acorn token types.
|
|
4193
|
-
* @param {string} code The source code Acorn is parsing. This is necessary
|
|
4194
|
-
* to correct the "value" property of some tokens.
|
|
4195
|
-
* @constructor
|
|
4196
4264
|
*/
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4265
|
+
var TokenTranslator = class {
|
|
4266
|
+
/**
|
|
4267
|
+
* Contains logic to translate Acorn tokens into Esprima tokens.
|
|
4268
|
+
* @param {EnhancedTokTypes} acornTokTypes The Acorn token types.
|
|
4269
|
+
* @param {string|String} code The source code Acorn is parsing. This is necessary
|
|
4270
|
+
* to correct the "value" property of some tokens.
|
|
4271
|
+
*/
|
|
4272
|
+
constructor(acornTokTypes, code) {
|
|
4273
|
+
this._acornTokTypes = acornTokTypes, this._tokens = [], this._curlyBrace = null, this._code = code;
|
|
4274
|
+
}
|
|
4202
4275
|
/**
|
|
4203
4276
|
* Translates a single Esprima token to a single Acorn token. This may be
|
|
4204
4277
|
* inaccurate due to how templates are handled differently in Esprima and
|
|
4205
4278
|
* Acorn, but should be accurate for all other tokens.
|
|
4206
|
-
* @param {
|
|
4207
|
-
* @param {
|
|
4279
|
+
* @param {acorn.Token} token The Acorn token to translate.
|
|
4280
|
+
* @param {ExtraNoTokens} extra Espree extra object.
|
|
4208
4281
|
* @returns {EsprimaToken} The Esprima version of the token.
|
|
4209
4282
|
*/
|
|
4210
4283
|
translate(token, extra) {
|
|
4211
|
-
let type = token.type, tt = this._acornTokTypes;
|
|
4212
|
-
if (type === tt.name)
|
|
4213
|
-
else if (type === tt.privateId)
|
|
4214
|
-
else if (type === tt.semi || type === tt.comma || type === tt.parenL || type === tt.parenR || type === tt.braceL || type === tt.braceR || type === tt.dot || type === tt.bracketL || type === tt.colon || type === tt.question || type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || type === tt.jsxTagStart || type === tt.incDec || type === tt.starstar || type === tt.jsxTagEnd || type === tt.prefix || type === tt.questionDot || type.binop && !type.keyword || type.isAssign)
|
|
4215
|
-
else if (type === tt.jsxName)
|
|
4216
|
-
else if (type.label === "jsxText" || type === tt.jsxAttrValueToken)
|
|
4217
|
-
else if (type.keyword) type.keyword === "true" || type.keyword === "false" ?
|
|
4218
|
-
else if (type === tt.num)
|
|
4219
|
-
else if (type === tt.string) extra.jsxAttrValueToken ? (extra.jsxAttrValueToken = !1,
|
|
4284
|
+
let type = token.type, tt = this._acornTokTypes, newToken = token;
|
|
4285
|
+
if (type === tt.name) newToken.type = Token.Identifier, "value" in token && token.value === "static" && (newToken.type = Token.Keyword), extra.ecmaVersion > 5 && "value" in token && (token.value === "yield" || token.value === "let") && (newToken.type = Token.Keyword);
|
|
4286
|
+
else if (type === tt.privateId) newToken.type = Token.PrivateIdentifier;
|
|
4287
|
+
else if (type === tt.semi || type === tt.comma || type === tt.parenL || type === tt.parenR || type === tt.braceL || type === tt.braceR || type === tt.dot || type === tt.bracketL || type === tt.colon || type === tt.question || type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || type === tt.jsxTagStart || type === tt.incDec || type === tt.starstar || type === tt.jsxTagEnd || type === tt.prefix || type === tt.questionDot || "binop" in type && type.binop && !type.keyword || "isAssign" in type && type.isAssign) newToken.type = Token.Punctuator, newToken.value = this._code.slice(token.start, token.end);
|
|
4288
|
+
else if (type === tt.jsxName) newToken.type = Token.JSXIdentifier;
|
|
4289
|
+
else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) newToken.type = Token.JSXText;
|
|
4290
|
+
else if (type.keyword) type.keyword === "true" || type.keyword === "false" ? newToken.type = Token.Boolean : type.keyword === "null" ? newToken.type = Token.Null : newToken.type = Token.Keyword;
|
|
4291
|
+
else if (type === tt.num) newToken.type = Token.Numeric, newToken.value = this._code.slice(token.start, token.end);
|
|
4292
|
+
else if (type === tt.string) extra.jsxAttrValueToken ? (extra.jsxAttrValueToken = !1, newToken.type = Token.JSXText) : newToken.type = Token.String, newToken.value = this._code.slice(token.start, token.end);
|
|
4220
4293
|
else if (type === tt.regexp) {
|
|
4221
|
-
|
|
4222
|
-
let value = token.value;
|
|
4223
|
-
|
|
4294
|
+
newToken.type = Token.RegularExpression;
|
|
4295
|
+
let value = "value" in token && token.value;
|
|
4296
|
+
newToken.regex = {
|
|
4224
4297
|
flags: value.flags,
|
|
4225
4298
|
pattern: value.pattern
|
|
4226
|
-
},
|
|
4299
|
+
}, newToken.value = `/${value.pattern}/${value.flags}`;
|
|
4227
4300
|
}
|
|
4228
|
-
return
|
|
4229
|
-
}
|
|
4301
|
+
return newToken;
|
|
4302
|
+
}
|
|
4230
4303
|
/**
|
|
4231
4304
|
* Function to call during Acorn's onToken handler.
|
|
4232
|
-
* @param {
|
|
4233
|
-
* @param {
|
|
4305
|
+
* @param {acorn.Token} token The Acorn token.
|
|
4306
|
+
* @param {Extra} extra The Espree extra object.
|
|
4234
4307
|
* @returns {void}
|
|
4235
4308
|
*/
|
|
4236
4309
|
onToken(token, extra) {
|
|
@@ -4264,6 +4337,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4264
4337
|
* @fileoverview A collection of methods for processing Espree's options.
|
|
4265
4338
|
* @author Kai Cataldo
|
|
4266
4339
|
*/
|
|
4340
|
+
/**
|
|
4341
|
+
* @import { EcmaVersion, Options } from "../espree.js";
|
|
4342
|
+
*/
|
|
4267
4343
|
let SUPPORTED_VERSIONS = [
|
|
4268
4344
|
3,
|
|
4269
4345
|
5,
|
|
@@ -4279,26 +4355,26 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4279
4355
|
15,
|
|
4280
4356
|
16,
|
|
4281
4357
|
17
|
|
4282
|
-
];
|
|
4358
|
+
], LATEST_ECMA_VERSION = SUPPORTED_VERSIONS.at(-1);
|
|
4283
4359
|
/**
|
|
4284
4360
|
* Get the latest ECMAScript version supported by Espree.
|
|
4285
|
-
* @returns {
|
|
4361
|
+
* @returns {typeof LATEST_ECMA_VERSION} The latest ECMAScript version.
|
|
4286
4362
|
*/
|
|
4287
4363
|
function getLatestEcmaVersion() {
|
|
4288
|
-
return
|
|
4364
|
+
return LATEST_ECMA_VERSION;
|
|
4289
4365
|
}
|
|
4290
4366
|
/**
|
|
4291
4367
|
* Get the list of ECMAScript versions supported by Espree.
|
|
4292
|
-
* @returns {
|
|
4368
|
+
* @returns {[...typeof SUPPORTED_VERSIONS]} An array containing the supported ECMAScript versions.
|
|
4293
4369
|
*/
|
|
4294
4370
|
function getSupportedEcmaVersions() {
|
|
4295
4371
|
return [...SUPPORTED_VERSIONS];
|
|
4296
4372
|
}
|
|
4297
4373
|
/**
|
|
4298
4374
|
* Normalize ECMAScript version from the initial config
|
|
4299
|
-
* @param {
|
|
4375
|
+
* @param {EcmaVersion} ecmaVersion ECMAScript version from the initial config
|
|
4300
4376
|
* @throws {Error} throws an error if the ecmaVersion is invalid.
|
|
4301
|
-
* @returns {
|
|
4377
|
+
* @returns {NormalizedEcmaVersion} normalized ECMAScript version
|
|
4302
4378
|
*/
|
|
4303
4379
|
function normalizeEcmaVersion(ecmaVersion = 5) {
|
|
4304
4380
|
let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion;
|
|
@@ -4310,18 +4386,36 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4310
4386
|
* Normalize sourceType from the initial config
|
|
4311
4387
|
* @param {string} sourceType to normalize
|
|
4312
4388
|
* @throws {Error} throw an error if sourceType is invalid
|
|
4313
|
-
* @returns {
|
|
4389
|
+
* @returns {"script"|"module"|"commonjs"} normalized sourceType
|
|
4314
4390
|
*/
|
|
4315
4391
|
function normalizeSourceType(sourceType = "script") {
|
|
4316
|
-
if (sourceType === "script" || sourceType === "module") return sourceType;
|
|
4317
|
-
if (sourceType === "commonjs") return "script";
|
|
4392
|
+
if (sourceType === "script" || sourceType === "module" || sourceType === "commonjs") return sourceType;
|
|
4318
4393
|
throw Error("Invalid sourceType.");
|
|
4319
4394
|
}
|
|
4320
4395
|
/**
|
|
4396
|
+
* @typedef {{
|
|
4397
|
+
* ecmaVersion: NormalizedEcmaVersion,
|
|
4398
|
+
* sourceType: "script"|"module"|"commonjs",
|
|
4399
|
+
* range?: boolean,
|
|
4400
|
+
* loc?: boolean,
|
|
4401
|
+
* allowReserved: boolean | "never",
|
|
4402
|
+
* ecmaFeatures?: {
|
|
4403
|
+
* jsx?: boolean,
|
|
4404
|
+
* globalReturn?: boolean,
|
|
4405
|
+
* impliedStrict?: boolean
|
|
4406
|
+
* },
|
|
4407
|
+
* ranges: boolean,
|
|
4408
|
+
* locations: boolean,
|
|
4409
|
+
* allowReturnOutsideFunction: boolean,
|
|
4410
|
+
* tokens?: boolean,
|
|
4411
|
+
* comment?: boolean
|
|
4412
|
+
* }} NormalizedParserOptions
|
|
4413
|
+
*/
|
|
4414
|
+
/**
|
|
4321
4415
|
* Normalize parserOptions
|
|
4322
|
-
* @param {
|
|
4416
|
+
* @param {Options} options the parser options to normalize
|
|
4323
4417
|
* @throws {Error} throw an error if found invalid option.
|
|
4324
|
-
* @returns {
|
|
4418
|
+
* @returns {NormalizedParserOptions} normalized options
|
|
4325
4419
|
*/
|
|
4326
4420
|
function normalizeOptions(options) {
|
|
4327
4421
|
let ecmaVersion = normalizeEcmaVersion(options.ecmaVersion), sourceType = normalizeSourceType(options.sourceType), ranges = options.range === !0, locations = options.loc === !0;
|
|
@@ -4338,22 +4432,85 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4338
4432
|
allowReturnOutsideFunction
|
|
4339
4433
|
});
|
|
4340
4434
|
}
|
|
4435
|
+
/**
|
|
4436
|
+
* @import {
|
|
4437
|
+
* CommentType,
|
|
4438
|
+
* EspreeParserCtor,
|
|
4439
|
+
* EsprimaNode,
|
|
4440
|
+
* AcornJsxParserCtorEnhanced,
|
|
4441
|
+
* TokTypes
|
|
4442
|
+
* } from "./types.js";
|
|
4443
|
+
* @import {
|
|
4444
|
+
* Options,
|
|
4445
|
+
* EspreeToken as EsprimaToken,
|
|
4446
|
+
* EspreeTokens as EsprimaTokens,
|
|
4447
|
+
* EspreeComment as EsprimaComment
|
|
4448
|
+
* } from "../espree.js";
|
|
4449
|
+
* @import { NormalizedEcmaVersion } from "./options.js";
|
|
4450
|
+
* @import * as acorn from "acorn";
|
|
4451
|
+
*/
|
|
4452
|
+
/**
|
|
4453
|
+
* @typedef {{
|
|
4454
|
+
* originalSourceType: "script" | "module" | "commonjs" | undefined
|
|
4455
|
+
* tokens: EsprimaToken[] | null,
|
|
4456
|
+
* comments: EsprimaComment[] | null,
|
|
4457
|
+
* impliedStrict: boolean,
|
|
4458
|
+
* ecmaVersion: NormalizedEcmaVersion,
|
|
4459
|
+
* jsxAttrValueToken: boolean,
|
|
4460
|
+
* lastToken: acorn.Token | null,
|
|
4461
|
+
* templateElements: acorn.TemplateElement[]
|
|
4462
|
+
* }} State
|
|
4463
|
+
*/
|
|
4464
|
+
/**
|
|
4465
|
+
* @typedef {{
|
|
4466
|
+
* sourceType?: "script"|"module"|"commonjs";
|
|
4467
|
+
* comments?: EsprimaComment[];
|
|
4468
|
+
* tokens?: EsprimaToken[];
|
|
4469
|
+
* body: acorn.Node[];
|
|
4470
|
+
* } & acorn.Program} EsprimaProgramNode
|
|
4471
|
+
*/
|
|
4472
|
+
/**
|
|
4473
|
+
* @typedef {{
|
|
4474
|
+
* index?: number;
|
|
4475
|
+
* lineNumber?: number;
|
|
4476
|
+
* column?: number;
|
|
4477
|
+
* } & SyntaxError} EnhancedSyntaxError
|
|
4478
|
+
*/
|
|
4479
|
+
/**
|
|
4480
|
+
* @typedef {{
|
|
4481
|
+
* jsxAttrValueToken?: acorn.TokenType;
|
|
4482
|
+
* } & TokTypes} EnhancedTokTypes
|
|
4483
|
+
*/
|
|
4341
4484
|
let STATE = Symbol("espree's internal state"), ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode");
|
|
4342
4485
|
/**
|
|
4343
4486
|
* Converts an Acorn comment to a Esprima comment.
|
|
4344
4487
|
* @param {boolean} block True if it's a block comment, false if not.
|
|
4345
4488
|
* @param {string} text The text of the comment.
|
|
4346
|
-
* @param {
|
|
4347
|
-
* @param {
|
|
4348
|
-
* @param {
|
|
4349
|
-
* @param {
|
|
4489
|
+
* @param {number} start The index at which the comment starts.
|
|
4490
|
+
* @param {number} end The index at which the comment ends.
|
|
4491
|
+
* @param {acorn.Position | undefined} startLoc The location at which the comment starts.
|
|
4492
|
+
* @param {acorn.Position | undefined} endLoc The location at which the comment ends.
|
|
4350
4493
|
* @param {string} code The source code being parsed.
|
|
4351
|
-
* @returns {
|
|
4494
|
+
* @returns {EsprimaComment} The comment object.
|
|
4352
4495
|
* @private
|
|
4353
4496
|
*/
|
|
4354
4497
|
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) {
|
|
4498
|
+
/** @type {CommentType} */
|
|
4355
4499
|
let type;
|
|
4356
4500
|
type = block ? "Block" : code.slice(start, start + 2) === "#!" ? "Hashbang" : "Line";
|
|
4501
|
+
/**
|
|
4502
|
+
* @type {{
|
|
4503
|
+
* type: CommentType,
|
|
4504
|
+
* value: string,
|
|
4505
|
+
* start?: number,
|
|
4506
|
+
* end?: number,
|
|
4507
|
+
* range?: [number, number],
|
|
4508
|
+
* loc?: {
|
|
4509
|
+
* start: acorn.Position | undefined,
|
|
4510
|
+
* end: acorn.Position | undefined
|
|
4511
|
+
* }
|
|
4512
|
+
* }}
|
|
4513
|
+
*/
|
|
4357
4514
|
let comment = {
|
|
4358
4515
|
type,
|
|
4359
4516
|
value: text
|
|
@@ -4366,6 +4523,10 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4366
4523
|
var espree = () => (Parser) => {
|
|
4367
4524
|
let tokTypes = Object.assign({}, Parser.acorn.tokTypes);
|
|
4368
4525
|
return Parser.acornJsx && Object.assign(tokTypes, Parser.acornJsx.tokTypes), class Espree extends Parser {
|
|
4526
|
+
/**
|
|
4527
|
+
* @param {Options | null | undefined} opts The parser options
|
|
4528
|
+
* @param {string | object} code The code which will be converted to a string.
|
|
4529
|
+
*/
|
|
4369
4530
|
constructor(opts, code) {
|
|
4370
4531
|
(typeof opts != "object" || !opts) && (opts = {}), typeof code != "string" && !(code instanceof String) && (code = String(code));
|
|
4371
4532
|
let originalSourceType = opts.sourceType, options = normalizeOptions(opts), ecmaFeatures = options.ecmaFeatures || {}, tokenTranslator = options.tokens === !0 ? new TokenTranslator(tokTypes, code) : null, state = {
|
|
@@ -4396,6 +4557,10 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4396
4557
|
}
|
|
4397
4558
|
}, code), this[STATE] = state;
|
|
4398
4559
|
}
|
|
4560
|
+
/**
|
|
4561
|
+
* Returns Espree tokens.
|
|
4562
|
+
* @returns {EsprimaTokens} The Esprima-compatible tokens
|
|
4563
|
+
*/
|
|
4399
4564
|
tokenize() {
|
|
4400
4565
|
do
|
|
4401
4566
|
this.next();
|
|
@@ -4404,33 +4569,52 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4404
4569
|
let extra = this[STATE], tokens = extra.tokens;
|
|
4405
4570
|
return extra.comments && (tokens.comments = extra.comments), tokens;
|
|
4406
4571
|
}
|
|
4407
|
-
|
|
4408
|
-
|
|
4572
|
+
/**
|
|
4573
|
+
* Calls parent.
|
|
4574
|
+
* @param {acorn.Node} node The node
|
|
4575
|
+
* @param {string} type The type
|
|
4576
|
+
* @returns {acorn.Node} The altered Node
|
|
4577
|
+
*/
|
|
4578
|
+
finishNode(node, type) {
|
|
4579
|
+
let result = super.finishNode(node, type);
|
|
4409
4580
|
return this[ESPRIMA_FINISH_NODE](result);
|
|
4410
4581
|
}
|
|
4411
|
-
|
|
4412
|
-
|
|
4582
|
+
/**
|
|
4583
|
+
* Calls parent.
|
|
4584
|
+
* @param {acorn.Node} node The node
|
|
4585
|
+
* @param {string} type The type
|
|
4586
|
+
* @param {number} pos The position
|
|
4587
|
+
* @param {acorn.Position} loc The location
|
|
4588
|
+
* @returns {acorn.Node} The altered Node
|
|
4589
|
+
*/
|
|
4590
|
+
finishNodeAt(node, type, pos, loc) {
|
|
4591
|
+
let result = super.finishNodeAt(node, type, pos, loc);
|
|
4413
4592
|
return this[ESPRIMA_FINISH_NODE](result);
|
|
4414
4593
|
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Parses.
|
|
4596
|
+
* @returns {EsprimaProgramNode} The program Node
|
|
4597
|
+
*/
|
|
4415
4598
|
parse() {
|
|
4416
4599
|
let extra = this[STATE], program = super.parse();
|
|
4417
|
-
|
|
4418
|
-
let [firstNode] = program.body;
|
|
4419
|
-
program.range && (program.range[0] = firstNode.range[0]), program.loc && (program.loc.start = firstNode.loc.start), program.start = firstNode.start;
|
|
4420
|
-
}
|
|
4421
|
-
return extra.lastToken && (program.range && (program.range[1] = extra.lastToken.range[1]), program.loc && (program.loc.end = extra.lastToken.loc.end), program.end = extra.lastToken.end), this[STATE].templateElements.forEach((templateElement) => {
|
|
4600
|
+
return program.sourceType = extra.originalSourceType, extra.comments && (program.comments = extra.comments), extra.tokens && (program.tokens = extra.tokens), this[STATE].templateElements.forEach((templateElement) => {
|
|
4422
4601
|
let endOffset = templateElement.tail ? 1 : 2;
|
|
4423
4602
|
templateElement.start += -1, templateElement.end += endOffset, templateElement.range && (templateElement.range[0] += -1, templateElement.range[1] += endOffset), templateElement.loc && (templateElement.loc.start.column += -1, templateElement.loc.end.column += endOffset);
|
|
4424
4603
|
}), program;
|
|
4425
4604
|
}
|
|
4605
|
+
/**
|
|
4606
|
+
* Parses top level.
|
|
4607
|
+
* @param {acorn.Node} node AST Node
|
|
4608
|
+
* @returns {acorn.Node} The changed node
|
|
4609
|
+
*/
|
|
4426
4610
|
parseTopLevel(node) {
|
|
4427
4611
|
return this[STATE].impliedStrict && (this.strict = !0), super.parseTopLevel(node);
|
|
4428
4612
|
}
|
|
4429
4613
|
/**
|
|
4430
4614
|
* Overwrites the default raise method to throw Esprima-style errors.
|
|
4431
|
-
* @param {
|
|
4615
|
+
* @param {number} pos The position of the error.
|
|
4432
4616
|
* @param {string} message The error message.
|
|
4433
|
-
* @throws {
|
|
4617
|
+
* @throws {EnhancedSyntaxError} A syntax error.
|
|
4434
4618
|
* @returns {void}
|
|
4435
4619
|
*/
|
|
4436
4620
|
raise(pos, message) {
|
|
@@ -4439,7 +4623,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4439
4623
|
}
|
|
4440
4624
|
/**
|
|
4441
4625
|
* Overwrites the default raise method to throw Esprima-style errors.
|
|
4442
|
-
* @param {
|
|
4626
|
+
* @param {number} pos The position of the error.
|
|
4443
4627
|
* @param {string} message The error message.
|
|
4444
4628
|
* @throws {SyntaxError} A syntax error.
|
|
4445
4629
|
* @returns {void}
|
|
@@ -4449,7 +4633,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4449
4633
|
}
|
|
4450
4634
|
/**
|
|
4451
4635
|
* Overwrites the default unexpected method to throw Esprima-style errors.
|
|
4452
|
-
* @param {
|
|
4636
|
+
* @param {number} pos The position of the error.
|
|
4453
4637
|
* @throws {SyntaxError} A syntax error.
|
|
4454
4638
|
* @returns {void}
|
|
4455
4639
|
*/
|
|
@@ -4461,29 +4645,178 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4461
4645
|
}
|
|
4462
4646
|
this.end > this.start && (message += ` ${this.input.slice(this.start, this.end)}`), this.raise(this.start, message);
|
|
4463
4647
|
}
|
|
4464
|
-
|
|
4648
|
+
/**
|
|
4649
|
+
* Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX
|
|
4650
|
+
* uses regular tt.string without any distinction between this and regular JS
|
|
4651
|
+
* strings. As such, we intercept an attempt to read a JSX string and set a flag
|
|
4652
|
+
* on extra so that when tokens are converted, the next token will be switched
|
|
4653
|
+
* to JSXText via onToken.
|
|
4654
|
+
* @param {number} quote A character code
|
|
4655
|
+
* @returns {void}
|
|
4656
|
+
*/ jsx_readString(quote) {
|
|
4465
4657
|
let result = super.jsx_readString(quote);
|
|
4466
4658
|
return this.type === tokTypes.string && (this[STATE].jsxAttrValueToken = !0), result;
|
|
4467
4659
|
}
|
|
4468
4660
|
/**
|
|
4469
4661
|
* Performs last-minute Esprima-specific compatibility checks and fixes.
|
|
4470
|
-
* @param {
|
|
4471
|
-
* @returns {
|
|
4662
|
+
* @param {acorn.Node} result The node to check.
|
|
4663
|
+
* @returns {EsprimaNode} The finished node.
|
|
4472
4664
|
*/
|
|
4473
4665
|
[ESPRIMA_FINISH_NODE](result) {
|
|
4474
|
-
return result.type === "TemplateElement" && this[STATE].templateElements.push(result), result.type.includes("Function") && !
|
|
4666
|
+
return result.type === "TemplateElement" && this[STATE].templateElements.push(result), result.type.includes("Function") && !("generator" in result) && (result.generator = !1), result;
|
|
4475
4667
|
}
|
|
4476
4668
|
};
|
|
4477
4669
|
};
|
|
4670
|
+
/**
|
|
4671
|
+
* @fileoverview Main Espree file that converts Acorn into Esprima output.
|
|
4672
|
+
*
|
|
4673
|
+
* This file contains code from the following MIT-licensed projects:
|
|
4674
|
+
* 1. Acorn
|
|
4675
|
+
* 2. Babylon
|
|
4676
|
+
* 3. Babel-ESLint
|
|
4677
|
+
*
|
|
4678
|
+
* This file also contains code from Esprima, which is BSD licensed.
|
|
4679
|
+
*
|
|
4680
|
+
* Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)
|
|
4681
|
+
* Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)
|
|
4682
|
+
* Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie <sebmck@gmail.com>
|
|
4683
|
+
*
|
|
4684
|
+
* Redistribution and use in source and binary forms, with or without
|
|
4685
|
+
* modification, are permitted provided that the following conditions are met:
|
|
4686
|
+
*
|
|
4687
|
+
* * Redistributions of source code must retain the above copyright
|
|
4688
|
+
* notice, this list of conditions and the following disclaimer.
|
|
4689
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
4690
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
4691
|
+
* documentation and/or other materials provided with the distribution.
|
|
4692
|
+
*
|
|
4693
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
4694
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
4695
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
4696
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
4697
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
4698
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
4699
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
4700
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
4701
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
4702
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4703
|
+
*
|
|
4704
|
+
* Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
|
4705
|
+
*
|
|
4706
|
+
* Redistribution and use in source and binary forms, with or without
|
|
4707
|
+
* modification, are permitted provided that the following conditions are met:
|
|
4708
|
+
*
|
|
4709
|
+
* * Redistributions of source code must retain the above copyright
|
|
4710
|
+
* notice, this list of conditions and the following disclaimer.
|
|
4711
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
4712
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
4713
|
+
* documentation and/or other materials provided with the distribution.
|
|
4714
|
+
*
|
|
4715
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
4716
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
4717
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
4718
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
4719
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
4720
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
4721
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
4722
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
4723
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
4724
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4725
|
+
*/
|
|
4726
|
+
/**
|
|
4727
|
+
* @import { EspreeParserCtor, EspreeParserJsxCtor } from "./lib/types.js";
|
|
4728
|
+
*/
|
|
4729
|
+
/**
|
|
4730
|
+
* @typedef {3|5|6|7|8|9|10|11|12|13|14|15|16|17|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024|2025|2026|'latest'} EcmaVersion
|
|
4731
|
+
*/
|
|
4732
|
+
/**
|
|
4733
|
+
* @typedef {{
|
|
4734
|
+
* type: string;
|
|
4735
|
+
* value: any;
|
|
4736
|
+
* start?: number;
|
|
4737
|
+
* end?: number;
|
|
4738
|
+
* loc?: acorn.SourceLocation;
|
|
4739
|
+
* range?: [number, number];
|
|
4740
|
+
* regex?: {flags: string, pattern: string};
|
|
4741
|
+
* }} EspreeToken
|
|
4742
|
+
*/
|
|
4743
|
+
/**
|
|
4744
|
+
* @typedef {{
|
|
4745
|
+
* type: "Block" | "Hashbang" | "Line",
|
|
4746
|
+
* value: string,
|
|
4747
|
+
* range?: [number, number],
|
|
4748
|
+
* start?: number,
|
|
4749
|
+
* end?: number,
|
|
4750
|
+
* loc?: {
|
|
4751
|
+
* start: acorn.Position | undefined,
|
|
4752
|
+
* end: acorn.Position | undefined
|
|
4753
|
+
* }
|
|
4754
|
+
* }} EspreeComment
|
|
4755
|
+
*/
|
|
4756
|
+
/**
|
|
4757
|
+
* @typedef {{
|
|
4758
|
+
* comments?: EspreeComment[]
|
|
4759
|
+
* } & EspreeToken[]} EspreeTokens
|
|
4760
|
+
*/
|
|
4761
|
+
/**
|
|
4762
|
+
* `allowReserved` is as in `acorn.Options`
|
|
4763
|
+
*
|
|
4764
|
+
* `ecmaVersion` currently as in `acorn.Options` though optional
|
|
4765
|
+
*
|
|
4766
|
+
* `sourceType` as in `acorn.Options` but also allows `commonjs`
|
|
4767
|
+
*
|
|
4768
|
+
* `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`
|
|
4769
|
+
*
|
|
4770
|
+
* `comment` is not in `acorn.Options` and doesn't err without it, but is used
|
|
4771
|
+
*/
|
|
4772
|
+
/**
|
|
4773
|
+
* @typedef {{
|
|
4774
|
+
* allowReserved?: boolean,
|
|
4775
|
+
* ecmaVersion?: EcmaVersion,
|
|
4776
|
+
* sourceType?: "script"|"module"|"commonjs",
|
|
4777
|
+
* ecmaFeatures?: {
|
|
4778
|
+
* jsx?: boolean,
|
|
4779
|
+
* globalReturn?: boolean,
|
|
4780
|
+
* impliedStrict?: boolean
|
|
4781
|
+
* },
|
|
4782
|
+
* range?: boolean,
|
|
4783
|
+
* loc?: boolean,
|
|
4784
|
+
* tokens?: boolean,
|
|
4785
|
+
* comment?: boolean,
|
|
4786
|
+
* }} Options
|
|
4787
|
+
*/
|
|
4478
4788
|
let parsers = {
|
|
4789
|
+
/** @type {EspreeParserCtor|null} */
|
|
4479
4790
|
_regular: null,
|
|
4791
|
+
/** @type {EspreeParserJsxCtor|null} */
|
|
4480
4792
|
_jsx: null,
|
|
4793
|
+
/**
|
|
4794
|
+
* Returns regular Parser
|
|
4795
|
+
* @returns {EspreeParserCtor} Regular Acorn parser
|
|
4796
|
+
*/
|
|
4481
4797
|
get regular() {
|
|
4482
|
-
|
|
4798
|
+
if (this._regular === null) {
|
|
4799
|
+
let espreeParserFactory = espree();
|
|
4800
|
+
this._regular = acorn__namespace.Parser.extend(espreeParserFactory);
|
|
4801
|
+
}
|
|
4802
|
+
return this._regular;
|
|
4483
4803
|
},
|
|
4804
|
+
/**
|
|
4805
|
+
* Returns JSX Parser
|
|
4806
|
+
* @returns {EspreeParserJsxCtor} JSX Acorn parser
|
|
4807
|
+
*/
|
|
4484
4808
|
get jsx() {
|
|
4485
|
-
|
|
4809
|
+
if (this._jsx === null) {
|
|
4810
|
+
let espreeParserFactory = espree(), jsxFactory = jsx();
|
|
4811
|
+
this._jsx = acorn__namespace.Parser.extend(jsxFactory, espreeParserFactory);
|
|
4812
|
+
}
|
|
4813
|
+
return this._jsx;
|
|
4486
4814
|
},
|
|
4815
|
+
/**
|
|
4816
|
+
* Gets the parser object based on the supplied options.
|
|
4817
|
+
* @param {Options} [options] The parser options.
|
|
4818
|
+
* @returns {EspreeParserJsxCtor|EspreeParserCtor} Regular or JSX Acorn parser
|
|
4819
|
+
*/
|
|
4487
4820
|
get(options) {
|
|
4488
4821
|
return options && options.ecmaFeatures && options.ecmaFeatures.jsx ? this.jsx : this.regular;
|
|
4489
4822
|
}
|
|
@@ -4491,9 +4824,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4491
4824
|
/**
|
|
4492
4825
|
* Tokenizes the given code.
|
|
4493
4826
|
* @param {string} code The code to tokenize.
|
|
4494
|
-
* @param {
|
|
4495
|
-
* @returns {
|
|
4496
|
-
* @throws {
|
|
4827
|
+
* @param {Options} [options] Options defining how to tokenize.
|
|
4828
|
+
* @returns {EspreeTokens} An array of tokens.
|
|
4829
|
+
* @throws {EnhancedSyntaxError} If the input code is invalid.
|
|
4497
4830
|
* @private
|
|
4498
4831
|
*/
|
|
4499
4832
|
function tokenize(code, options) {
|
|
@@ -4503,21 +4836,25 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4503
4836
|
/**
|
|
4504
4837
|
* Parses the given code.
|
|
4505
4838
|
* @param {string} code The code to tokenize.
|
|
4506
|
-
* @param {
|
|
4507
|
-
* @returns {
|
|
4508
|
-
* @throws {
|
|
4839
|
+
* @param {Options} [options] Options defining how to tokenize.
|
|
4840
|
+
* @returns {acorn.Program} The "Program" AST node.
|
|
4841
|
+
* @throws {EnhancedSyntaxError} If the input code is invalid.
|
|
4509
4842
|
*/
|
|
4510
4843
|
function parse(code, options) {
|
|
4511
4844
|
return new (parsers.get(options))(options, code).parse();
|
|
4512
4845
|
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
}(), Syntax = function() {
|
|
4846
|
+
/** @type {string} */
|
|
4847
|
+
let Syntax = /* @__PURE__ */ (function() {
|
|
4516
4848
|
let key, types = {};
|
|
4517
|
-
for (key in typeof Object.create == "function" && (types = Object.create(null)),
|
|
4849
|
+
for (key in typeof Object.create == "function" && (types = Object.create(null)), eslintVisitorKeys.KEYS) Object.hasOwn(eslintVisitorKeys.KEYS, key) && (types[key] = key);
|
|
4518
4850
|
return typeof Object.freeze == "function" && Object.freeze(types), types;
|
|
4519
|
-
}(), latestEcmaVersion = getLatestEcmaVersion(), supportedEcmaVersions = getSupportedEcmaVersions();
|
|
4520
|
-
|
|
4851
|
+
})(), latestEcmaVersion = /* @__PURE__ */ getLatestEcmaVersion(), supportedEcmaVersions = /* @__PURE__ */ getSupportedEcmaVersions();
|
|
4852
|
+
Object.defineProperty(exports, "VisitorKeys", {
|
|
4853
|
+
enumerable: !0,
|
|
4854
|
+
get: function() {
|
|
4855
|
+
return eslintVisitorKeys.KEYS;
|
|
4856
|
+
}
|
|
4857
|
+
}), exports.Syntax = Syntax, exports.latestEcmaVersion = latestEcmaVersion, exports.name = "espree", exports.parse = parse, exports.supportedEcmaVersions = supportedEcmaVersions, exports.tokenize = tokenize, exports.version = "11.2.0";
|
|
4521
4858
|
})), require_escape_string_regexp = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
4522
4859
|
module.exports = (string) => {
|
|
4523
4860
|
if (typeof string != "string") throw TypeError("Expected a string");
|
|
@@ -4647,7 +4984,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4647
4984
|
...es2025,
|
|
4648
4985
|
AsyncDisposableStack: !1,
|
|
4649
4986
|
DisposableStack: !1,
|
|
4650
|
-
SuppressedError: !1
|
|
4987
|
+
SuppressedError: !1,
|
|
4988
|
+
Temporal: !1
|
|
4651
4989
|
}
|
|
4652
4990
|
};
|
|
4653
4991
|
})), require_ecma_version = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
@@ -4943,6 +5281,14 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4943
5281
|
return isSpecificMemberAccess(node, arrayOrTypedArrayPattern, "from");
|
|
4944
5282
|
}
|
|
4945
5283
|
/**
|
|
5284
|
+
* Checks whether or not a node is `Array.fromAsync`.
|
|
5285
|
+
* @param {ASTNode} node A node to check.
|
|
5286
|
+
* @returns {boolean} Whether or not the node is a `Array.fromAsync`.
|
|
5287
|
+
*/
|
|
5288
|
+
function isArrayFromAsyncMethod(node) {
|
|
5289
|
+
return isSpecificMemberAccess(node, "Array", "fromAsync");
|
|
5290
|
+
}
|
|
5291
|
+
/**
|
|
4946
5292
|
* Checks whether or not a node is a method which expects a function as a first argument, and `thisArg` as a second argument.
|
|
4947
5293
|
* @param {ASTNode} node A node to check.
|
|
4948
5294
|
* @returns {boolean} Whether or not the node is a method which expects a function as a first argument, and `thisArg` as a second argument.
|
|
@@ -4959,16 +5305,6 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4959
5305
|
return (token) => !f(token);
|
|
4960
5306
|
}
|
|
4961
5307
|
/**
|
|
4962
|
-
* Checks whether or not a node has a `@this` tag in its comments.
|
|
4963
|
-
* @param {ASTNode} node A node to check.
|
|
4964
|
-
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
4965
|
-
* @returns {boolean} Whether or not the node has a `@this` tag in its comments.
|
|
4966
|
-
*/
|
|
4967
|
-
function hasJSDocThisTag(node, sourceCode) {
|
|
4968
|
-
let jsdocComment = sourceCode.getJSDocComment(node);
|
|
4969
|
-
return jsdocComment && thisTagPattern.test(jsdocComment.value) ? !0 : sourceCode.getCommentsBefore(node).some((comment) => thisTagPattern.test(comment.value));
|
|
4970
|
-
}
|
|
4971
|
-
/**
|
|
4972
5308
|
* Determines if a node is surrounded by parentheses.
|
|
4973
5309
|
* @param {SourceCode} sourceCode The ESLint source code object
|
|
4974
5310
|
* @param {ASTNode} node The node to be checked.
|
|
@@ -5100,6 +5436,59 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5100
5436
|
return token.type === "Keyword";
|
|
5101
5437
|
}
|
|
5102
5438
|
/**
|
|
5439
|
+
* Checks whether the given node represents an ES6 export declaration.
|
|
5440
|
+
* @param {ASTNode} node A node to check.
|
|
5441
|
+
* @returns {boolean} `true` if the node is an export declaration.
|
|
5442
|
+
* @private
|
|
5443
|
+
*/
|
|
5444
|
+
function isExportDeclaration(node) {
|
|
5445
|
+
return node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration";
|
|
5446
|
+
}
|
|
5447
|
+
/**
|
|
5448
|
+
* Checks for the presence of a JSDoc comment for the given node and returns it.
|
|
5449
|
+
* @param {ASTNode} node The node to get the comment for.
|
|
5450
|
+
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
5451
|
+
* @returns {Token|null} The Block comment token containing the JSDoc comment for the given node or null if not found.
|
|
5452
|
+
* @private
|
|
5453
|
+
*/
|
|
5454
|
+
function findJSDocComment(node, sourceCode) {
|
|
5455
|
+
let tokenBefore = sourceCode.getTokenBefore(node, { includeComments: !0 });
|
|
5456
|
+
return tokenBefore && tokenBefore.type === "Block" && tokenBefore.value.charAt(0) === "*" && node.loc.start.line - tokenBefore.loc.end.line <= 1 ? tokenBefore : null;
|
|
5457
|
+
}
|
|
5458
|
+
/**
|
|
5459
|
+
* Retrieves the JSDoc comment for a given node.
|
|
5460
|
+
* @param {ASTNode} node The node to get the comment for.
|
|
5461
|
+
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
5462
|
+
* @returns {Token|null} The Block comment token containing the JSDoc comment for the given node or null if not found.
|
|
5463
|
+
* @private
|
|
5464
|
+
*/
|
|
5465
|
+
function getJSDocComment(node, sourceCode) {
|
|
5466
|
+
let parent = node.parent;
|
|
5467
|
+
switch (node.type) {
|
|
5468
|
+
case "ClassDeclaration":
|
|
5469
|
+
case "FunctionDeclaration": return findJSDocComment(isExportDeclaration(parent) ? parent : node, sourceCode);
|
|
5470
|
+
case "ClassExpression": return findJSDocComment(parent.parent, sourceCode);
|
|
5471
|
+
case "ArrowFunctionExpression":
|
|
5472
|
+
case "FunctionExpression":
|
|
5473
|
+
if (parent.type !== "CallExpression" && parent.type !== "NewExpression") {
|
|
5474
|
+
for (; !sourceCode.getCommentsBefore(parent).length && !/Function/u.test(parent.type) && parent.type !== "MethodDefinition" && parent.type !== "Property" && (parent = parent.parent, parent););
|
|
5475
|
+
if (parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program") return findJSDocComment(parent, sourceCode);
|
|
5476
|
+
}
|
|
5477
|
+
return findJSDocComment(node, sourceCode);
|
|
5478
|
+
default: return null;
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
/**
|
|
5482
|
+
* Checks whether or not a node has a `@this` tag in its comments.
|
|
5483
|
+
* @param {ASTNode} node A node to check.
|
|
5484
|
+
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
5485
|
+
* @returns {boolean} Whether or not the node has a `@this` tag in its comments.
|
|
5486
|
+
*/
|
|
5487
|
+
function hasJSDocThisTag(node, sourceCode) {
|
|
5488
|
+
let jsdocComment = getJSDocComment(node, sourceCode);
|
|
5489
|
+
return jsdocComment && thisTagPattern.test(jsdocComment.value) ? !0 : sourceCode.getCommentsBefore(node).some((comment) => thisTagPattern.test(comment.value));
|
|
5490
|
+
}
|
|
5491
|
+
/**
|
|
5103
5492
|
* Gets the `(` token of the given function node.
|
|
5104
5493
|
* @param {ASTNode} node The function node to get.
|
|
5105
5494
|
* @param {SourceCode} sourceCode The source code object to get tokens.
|
|
@@ -5424,6 +5813,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5424
5813
|
isLoop,
|
|
5425
5814
|
isInLoop,
|
|
5426
5815
|
isArrayFromMethod,
|
|
5816
|
+
isArrayFromAsyncMethod,
|
|
5427
5817
|
isParenthesised,
|
|
5428
5818
|
createGlobalLinebreakMatcher,
|
|
5429
5819
|
equalTokens,
|
|
@@ -5518,9 +5908,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5518
5908
|
getTrailingStatement: esutils.ast.trailingStatement,
|
|
5519
5909
|
/**
|
|
5520
5910
|
* Finds the variable by a given name in a given scope and its upper scopes.
|
|
5521
|
-
* @param {
|
|
5911
|
+
* @param {Scope} initScope A scope to start find.
|
|
5522
5912
|
* @param {string} name A variable name to find.
|
|
5523
|
-
* @returns {
|
|
5913
|
+
* @returns {Variable|null} A found variable or `null`.
|
|
5524
5914
|
*/
|
|
5525
5915
|
getVariableByName(initScope, name) {
|
|
5526
5916
|
let scope = initScope;
|
|
@@ -5540,7 +5930,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5540
5930
|
* - The given node is not `StaticBlock`.
|
|
5541
5931
|
* - The function name does not start with uppercase. It's a convention to capitalize the names
|
|
5542
5932
|
* of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
|
|
5543
|
-
* - The function does not have a JSDoc comment that has a
|
|
5933
|
+
* - The function does not have a JSDoc comment that has a `@this` tag.
|
|
5544
5934
|
*
|
|
5545
5935
|
* Next, this checks the location of the node.
|
|
5546
5936
|
* If the location is below, this judges `this` is valid.
|
|
@@ -5592,7 +5982,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5592
5982
|
return !(isCallee(maybeCalleeNode) && maybeCalleeNode.parent.arguments.length >= 1 && !isNullOrUndefined(maybeCalleeNode.parent.arguments[0]));
|
|
5593
5983
|
}
|
|
5594
5984
|
return !0;
|
|
5595
|
-
case "CallExpression": return isReflectApply(parent.callee) ? parent.arguments.length !== 3 || parent.arguments[0] !== currentNode || isNullOrUndefined(parent.arguments[1]) : isArrayFromMethod(parent.callee) ? parent.arguments.length !== 3 || parent.arguments[1] !== currentNode || isNullOrUndefined(parent.arguments[2]) : isMethodWhichHasThisArg(parent.callee) ? parent.arguments.length !== 2 || parent.arguments[0] !== currentNode || isNullOrUndefined(parent.arguments[1]) : !0;
|
|
5985
|
+
case "CallExpression": return isReflectApply(parent.callee) ? parent.arguments.length !== 3 || parent.arguments[0] !== currentNode || isNullOrUndefined(parent.arguments[1]) : isArrayFromMethod(parent.callee) || isArrayFromAsyncMethod(parent.callee) ? parent.arguments.length !== 3 || parent.arguments[1] !== currentNode || isNullOrUndefined(parent.arguments[2]) : isMethodWhichHasThisArg(parent.callee) ? parent.arguments.length !== 2 || parent.arguments[0] !== currentNode || isNullOrUndefined(parent.arguments[1]) : !0;
|
|
5596
5986
|
default: return !0;
|
|
5597
5987
|
}
|
|
5598
5988
|
}
|