oxlint-plugin-eslint 1.61.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 +972 -148
- package/common/eslint-utils.cjs +40 -0
- 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 +39 -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 +16 -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 +48 -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 +24 -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 +21 -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,36 +4261,51 @@ 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
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* Translates a single Esprima token to a single Acorn token. This may be
|
|
4277
|
+
* inaccurate due to how templates are handled differently in Esprima and
|
|
4278
|
+
* Acorn, but should be accurate for all other tokens.
|
|
4279
|
+
* @param {acorn.Token} token The Acorn token to translate.
|
|
4280
|
+
* @param {ExtraNoTokens} extra Espree extra object.
|
|
4281
|
+
* @returns {EsprimaToken} The Esprima version of the token.
|
|
4282
|
+
*/
|
|
4202
4283
|
translate(token, extra) {
|
|
4203
|
-
let type = token.type, tt = this._acornTokTypes;
|
|
4204
|
-
if (type === tt.name)
|
|
4205
|
-
else if (type === tt.privateId)
|
|
4206
|
-
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)
|
|
4207
|
-
else if (type === tt.jsxName)
|
|
4208
|
-
else if (type.label === "jsxText" || type === tt.jsxAttrValueToken)
|
|
4209
|
-
else if (type.keyword) type.keyword === "true" || type.keyword === "false" ?
|
|
4210
|
-
else if (type === tt.num)
|
|
4211
|
-
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);
|
|
4212
4293
|
else if (type === tt.regexp) {
|
|
4213
|
-
|
|
4214
|
-
let value = token.value;
|
|
4215
|
-
|
|
4294
|
+
newToken.type = Token.RegularExpression;
|
|
4295
|
+
let value = "value" in token && token.value;
|
|
4296
|
+
newToken.regex = {
|
|
4216
4297
|
flags: value.flags,
|
|
4217
4298
|
pattern: value.pattern
|
|
4218
|
-
},
|
|
4299
|
+
}, newToken.value = `/${value.pattern}/${value.flags}`;
|
|
4219
4300
|
}
|
|
4220
|
-
return
|
|
4221
|
-
}
|
|
4301
|
+
return newToken;
|
|
4302
|
+
}
|
|
4303
|
+
/**
|
|
4304
|
+
* Function to call during Acorn's onToken handler.
|
|
4305
|
+
* @param {acorn.Token} token The Acorn token.
|
|
4306
|
+
* @param {Extra} extra The Espree extra object.
|
|
4307
|
+
* @returns {void}
|
|
4308
|
+
*/
|
|
4222
4309
|
onToken(token, extra) {
|
|
4223
4310
|
let tt = this._acornTokTypes, tokens = extra.tokens, templateTokens = this._tokens, translateTemplateTokens = () => {
|
|
4224
4311
|
tokens.push(convertTemplatePart(this._tokens, this._code)), this._tokens = [];
|
|
@@ -4250,6 +4337,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4250
4337
|
* @fileoverview A collection of methods for processing Espree's options.
|
|
4251
4338
|
* @author Kai Cataldo
|
|
4252
4339
|
*/
|
|
4340
|
+
/**
|
|
4341
|
+
* @import { EcmaVersion, Options } from "../espree.js";
|
|
4342
|
+
*/
|
|
4253
4343
|
let SUPPORTED_VERSIONS = [
|
|
4254
4344
|
3,
|
|
4255
4345
|
5,
|
|
@@ -4265,26 +4355,26 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4265
4355
|
15,
|
|
4266
4356
|
16,
|
|
4267
4357
|
17
|
|
4268
|
-
];
|
|
4358
|
+
], LATEST_ECMA_VERSION = SUPPORTED_VERSIONS.at(-1);
|
|
4269
4359
|
/**
|
|
4270
4360
|
* Get the latest ECMAScript version supported by Espree.
|
|
4271
|
-
* @returns {
|
|
4361
|
+
* @returns {typeof LATEST_ECMA_VERSION} The latest ECMAScript version.
|
|
4272
4362
|
*/
|
|
4273
4363
|
function getLatestEcmaVersion() {
|
|
4274
|
-
return
|
|
4364
|
+
return LATEST_ECMA_VERSION;
|
|
4275
4365
|
}
|
|
4276
4366
|
/**
|
|
4277
4367
|
* Get the list of ECMAScript versions supported by Espree.
|
|
4278
|
-
* @returns {
|
|
4368
|
+
* @returns {[...typeof SUPPORTED_VERSIONS]} An array containing the supported ECMAScript versions.
|
|
4279
4369
|
*/
|
|
4280
4370
|
function getSupportedEcmaVersions() {
|
|
4281
4371
|
return [...SUPPORTED_VERSIONS];
|
|
4282
4372
|
}
|
|
4283
4373
|
/**
|
|
4284
4374
|
* Normalize ECMAScript version from the initial config
|
|
4285
|
-
* @param {
|
|
4375
|
+
* @param {EcmaVersion} ecmaVersion ECMAScript version from the initial config
|
|
4286
4376
|
* @throws {Error} throws an error if the ecmaVersion is invalid.
|
|
4287
|
-
* @returns {
|
|
4377
|
+
* @returns {NormalizedEcmaVersion} normalized ECMAScript version
|
|
4288
4378
|
*/
|
|
4289
4379
|
function normalizeEcmaVersion(ecmaVersion = 5) {
|
|
4290
4380
|
let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion;
|
|
@@ -4296,18 +4386,36 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4296
4386
|
* Normalize sourceType from the initial config
|
|
4297
4387
|
* @param {string} sourceType to normalize
|
|
4298
4388
|
* @throws {Error} throw an error if sourceType is invalid
|
|
4299
|
-
* @returns {
|
|
4389
|
+
* @returns {"script"|"module"|"commonjs"} normalized sourceType
|
|
4300
4390
|
*/
|
|
4301
4391
|
function normalizeSourceType(sourceType = "script") {
|
|
4302
|
-
if (sourceType === "script" || sourceType === "module") return sourceType;
|
|
4303
|
-
if (sourceType === "commonjs") return "script";
|
|
4392
|
+
if (sourceType === "script" || sourceType === "module" || sourceType === "commonjs") return sourceType;
|
|
4304
4393
|
throw Error("Invalid sourceType.");
|
|
4305
4394
|
}
|
|
4306
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
|
+
/**
|
|
4307
4415
|
* Normalize parserOptions
|
|
4308
|
-
* @param {
|
|
4416
|
+
* @param {Options} options the parser options to normalize
|
|
4309
4417
|
* @throws {Error} throw an error if found invalid option.
|
|
4310
|
-
* @returns {
|
|
4418
|
+
* @returns {NormalizedParserOptions} normalized options
|
|
4311
4419
|
*/
|
|
4312
4420
|
function normalizeOptions(options) {
|
|
4313
4421
|
let ecmaVersion = normalizeEcmaVersion(options.ecmaVersion), sourceType = normalizeSourceType(options.sourceType), ranges = options.range === !0, locations = options.loc === !0;
|
|
@@ -4324,22 +4432,85 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4324
4432
|
allowReturnOutsideFunction
|
|
4325
4433
|
});
|
|
4326
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
|
+
*/
|
|
4327
4484
|
let STATE = Symbol("espree's internal state"), ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode");
|
|
4328
4485
|
/**
|
|
4329
4486
|
* Converts an Acorn comment to a Esprima comment.
|
|
4330
4487
|
* @param {boolean} block True if it's a block comment, false if not.
|
|
4331
4488
|
* @param {string} text The text of the comment.
|
|
4332
|
-
* @param {
|
|
4333
|
-
* @param {
|
|
4334
|
-
* @param {
|
|
4335
|
-
* @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.
|
|
4336
4493
|
* @param {string} code The source code being parsed.
|
|
4337
|
-
* @returns {
|
|
4494
|
+
* @returns {EsprimaComment} The comment object.
|
|
4338
4495
|
* @private
|
|
4339
4496
|
*/
|
|
4340
4497
|
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) {
|
|
4498
|
+
/** @type {CommentType} */
|
|
4341
4499
|
let type;
|
|
4342
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
|
+
*/
|
|
4343
4514
|
let comment = {
|
|
4344
4515
|
type,
|
|
4345
4516
|
value: text
|
|
@@ -4352,6 +4523,10 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4352
4523
|
var espree = () => (Parser) => {
|
|
4353
4524
|
let tokTypes = Object.assign({}, Parser.acorn.tokTypes);
|
|
4354
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
|
+
*/
|
|
4355
4530
|
constructor(opts, code) {
|
|
4356
4531
|
(typeof opts != "object" || !opts) && (opts = {}), typeof code != "string" && !(code instanceof String) && (code = String(code));
|
|
4357
4532
|
let originalSourceType = opts.sourceType, options = normalizeOptions(opts), ecmaFeatures = options.ecmaFeatures || {}, tokenTranslator = options.tokens === !0 ? new TokenTranslator(tokTypes, code) : null, state = {
|
|
@@ -4382,6 +4557,10 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4382
4557
|
}
|
|
4383
4558
|
}, code), this[STATE] = state;
|
|
4384
4559
|
}
|
|
4560
|
+
/**
|
|
4561
|
+
* Returns Espree tokens.
|
|
4562
|
+
* @returns {EsprimaTokens} The Esprima-compatible tokens
|
|
4563
|
+
*/
|
|
4385
4564
|
tokenize() {
|
|
4386
4565
|
do
|
|
4387
4566
|
this.next();
|
|
@@ -4390,33 +4569,52 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4390
4569
|
let extra = this[STATE], tokens = extra.tokens;
|
|
4391
4570
|
return extra.comments && (tokens.comments = extra.comments), tokens;
|
|
4392
4571
|
}
|
|
4393
|
-
|
|
4394
|
-
|
|
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);
|
|
4395
4580
|
return this[ESPRIMA_FINISH_NODE](result);
|
|
4396
4581
|
}
|
|
4397
|
-
|
|
4398
|
-
|
|
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);
|
|
4399
4592
|
return this[ESPRIMA_FINISH_NODE](result);
|
|
4400
4593
|
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Parses.
|
|
4596
|
+
* @returns {EsprimaProgramNode} The program Node
|
|
4597
|
+
*/
|
|
4401
4598
|
parse() {
|
|
4402
4599
|
let extra = this[STATE], program = super.parse();
|
|
4403
|
-
|
|
4404
|
-
let [firstNode] = program.body;
|
|
4405
|
-
program.range && (program.range[0] = firstNode.range[0]), program.loc && (program.loc.start = firstNode.loc.start), program.start = firstNode.start;
|
|
4406
|
-
}
|
|
4407
|
-
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) => {
|
|
4408
4601
|
let endOffset = templateElement.tail ? 1 : 2;
|
|
4409
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);
|
|
4410
4603
|
}), program;
|
|
4411
4604
|
}
|
|
4605
|
+
/**
|
|
4606
|
+
* Parses top level.
|
|
4607
|
+
* @param {acorn.Node} node AST Node
|
|
4608
|
+
* @returns {acorn.Node} The changed node
|
|
4609
|
+
*/
|
|
4412
4610
|
parseTopLevel(node) {
|
|
4413
4611
|
return this[STATE].impliedStrict && (this.strict = !0), super.parseTopLevel(node);
|
|
4414
4612
|
}
|
|
4415
4613
|
/**
|
|
4416
4614
|
* Overwrites the default raise method to throw Esprima-style errors.
|
|
4417
|
-
* @param {
|
|
4615
|
+
* @param {number} pos The position of the error.
|
|
4418
4616
|
* @param {string} message The error message.
|
|
4419
|
-
* @throws {
|
|
4617
|
+
* @throws {EnhancedSyntaxError} A syntax error.
|
|
4420
4618
|
* @returns {void}
|
|
4421
4619
|
*/
|
|
4422
4620
|
raise(pos, message) {
|
|
@@ -4425,7 +4623,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4425
4623
|
}
|
|
4426
4624
|
/**
|
|
4427
4625
|
* Overwrites the default raise method to throw Esprima-style errors.
|
|
4428
|
-
* @param {
|
|
4626
|
+
* @param {number} pos The position of the error.
|
|
4429
4627
|
* @param {string} message The error message.
|
|
4430
4628
|
* @throws {SyntaxError} A syntax error.
|
|
4431
4629
|
* @returns {void}
|
|
@@ -4435,7 +4633,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4435
4633
|
}
|
|
4436
4634
|
/**
|
|
4437
4635
|
* Overwrites the default unexpected method to throw Esprima-style errors.
|
|
4438
|
-
* @param {
|
|
4636
|
+
* @param {number} pos The position of the error.
|
|
4439
4637
|
* @throws {SyntaxError} A syntax error.
|
|
4440
4638
|
* @returns {void}
|
|
4441
4639
|
*/
|
|
@@ -4447,29 +4645,178 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4447
4645
|
}
|
|
4448
4646
|
this.end > this.start && (message += ` ${this.input.slice(this.start, this.end)}`), this.raise(this.start, message);
|
|
4449
4647
|
}
|
|
4450
|
-
|
|
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) {
|
|
4451
4657
|
let result = super.jsx_readString(quote);
|
|
4452
4658
|
return this.type === tokTypes.string && (this[STATE].jsxAttrValueToken = !0), result;
|
|
4453
4659
|
}
|
|
4454
4660
|
/**
|
|
4455
4661
|
* Performs last-minute Esprima-specific compatibility checks and fixes.
|
|
4456
|
-
* @param {
|
|
4457
|
-
* @returns {
|
|
4662
|
+
* @param {acorn.Node} result The node to check.
|
|
4663
|
+
* @returns {EsprimaNode} The finished node.
|
|
4458
4664
|
*/
|
|
4459
4665
|
[ESPRIMA_FINISH_NODE](result) {
|
|
4460
|
-
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;
|
|
4461
4667
|
}
|
|
4462
4668
|
};
|
|
4463
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
|
+
*/
|
|
4464
4788
|
let parsers = {
|
|
4789
|
+
/** @type {EspreeParserCtor|null} */
|
|
4465
4790
|
_regular: null,
|
|
4791
|
+
/** @type {EspreeParserJsxCtor|null} */
|
|
4466
4792
|
_jsx: null,
|
|
4793
|
+
/**
|
|
4794
|
+
* Returns regular Parser
|
|
4795
|
+
* @returns {EspreeParserCtor} Regular Acorn parser
|
|
4796
|
+
*/
|
|
4467
4797
|
get regular() {
|
|
4468
|
-
|
|
4798
|
+
if (this._regular === null) {
|
|
4799
|
+
let espreeParserFactory = espree();
|
|
4800
|
+
this._regular = acorn__namespace.Parser.extend(espreeParserFactory);
|
|
4801
|
+
}
|
|
4802
|
+
return this._regular;
|
|
4469
4803
|
},
|
|
4804
|
+
/**
|
|
4805
|
+
* Returns JSX Parser
|
|
4806
|
+
* @returns {EspreeParserJsxCtor} JSX Acorn parser
|
|
4807
|
+
*/
|
|
4470
4808
|
get jsx() {
|
|
4471
|
-
|
|
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;
|
|
4472
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
|
+
*/
|
|
4473
4820
|
get(options) {
|
|
4474
4821
|
return options && options.ecmaFeatures && options.ecmaFeatures.jsx ? this.jsx : this.regular;
|
|
4475
4822
|
}
|
|
@@ -4477,9 +4824,9 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4477
4824
|
/**
|
|
4478
4825
|
* Tokenizes the given code.
|
|
4479
4826
|
* @param {string} code The code to tokenize.
|
|
4480
|
-
* @param {
|
|
4481
|
-
* @returns {
|
|
4482
|
-
* @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.
|
|
4483
4830
|
* @private
|
|
4484
4831
|
*/
|
|
4485
4832
|
function tokenize(code, options) {
|
|
@@ -4489,21 +4836,25 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4489
4836
|
/**
|
|
4490
4837
|
* Parses the given code.
|
|
4491
4838
|
* @param {string} code The code to tokenize.
|
|
4492
|
-
* @param {
|
|
4493
|
-
* @returns {
|
|
4494
|
-
* @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.
|
|
4495
4842
|
*/
|
|
4496
4843
|
function parse(code, options) {
|
|
4497
4844
|
return new (parsers.get(options))(options, code).parse();
|
|
4498
4845
|
}
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
}(), Syntax = function() {
|
|
4846
|
+
/** @type {string} */
|
|
4847
|
+
let Syntax = /* @__PURE__ */ (function() {
|
|
4502
4848
|
let key, types = {};
|
|
4503
|
-
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);
|
|
4504
4850
|
return typeof Object.freeze == "function" && Object.freeze(types), types;
|
|
4505
|
-
}(), latestEcmaVersion = getLatestEcmaVersion(), supportedEcmaVersions = getSupportedEcmaVersions();
|
|
4506
|
-
|
|
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";
|
|
4507
4858
|
})), require_escape_string_regexp = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
4508
4859
|
module.exports = (string) => {
|
|
4509
4860
|
if (typeof string != "string") throw TypeError("Expected a string");
|
|
@@ -4633,7 +4984,8 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4633
4984
|
...es2025,
|
|
4634
4985
|
AsyncDisposableStack: !1,
|
|
4635
4986
|
DisposableStack: !1,
|
|
4636
|
-
SuppressedError: !1
|
|
4987
|
+
SuppressedError: !1,
|
|
4988
|
+
Temporal: !1
|
|
4637
4989
|
}
|
|
4638
4990
|
};
|
|
4639
4991
|
})), require_ecma_version = /* @__PURE__ */ require_chunk.t(((exports, module) => {
|
|
@@ -4929,6 +5281,14 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4929
5281
|
return isSpecificMemberAccess(node, arrayOrTypedArrayPattern, "from");
|
|
4930
5282
|
}
|
|
4931
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
|
+
/**
|
|
4932
5292
|
* Checks whether or not a node is a method which expects a function as a first argument, and `thisArg` as a second argument.
|
|
4933
5293
|
* @param {ASTNode} node A node to check.
|
|
4934
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.
|
|
@@ -4945,16 +5305,6 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
4945
5305
|
return (token) => !f(token);
|
|
4946
5306
|
}
|
|
4947
5307
|
/**
|
|
4948
|
-
* Checks whether or not a node has a `@this` tag in its comments.
|
|
4949
|
-
* @param {ASTNode} node A node to check.
|
|
4950
|
-
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
4951
|
-
* @returns {boolean} Whether or not the node has a `@this` tag in its comments.
|
|
4952
|
-
*/
|
|
4953
|
-
function hasJSDocThisTag(node, sourceCode) {
|
|
4954
|
-
let jsdocComment = sourceCode.getJSDocComment(node);
|
|
4955
|
-
return jsdocComment && thisTagPattern.test(jsdocComment.value) ? !0 : sourceCode.getCommentsBefore(node).some((comment) => thisTagPattern.test(comment.value));
|
|
4956
|
-
}
|
|
4957
|
-
/**
|
|
4958
5308
|
* Determines if a node is surrounded by parentheses.
|
|
4959
5309
|
* @param {SourceCode} sourceCode The ESLint source code object
|
|
4960
5310
|
* @param {ASTNode} node The node to be checked.
|
|
@@ -5086,6 +5436,59 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5086
5436
|
return token.type === "Keyword";
|
|
5087
5437
|
}
|
|
5088
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
|
+
/**
|
|
5089
5492
|
* Gets the `(` token of the given function node.
|
|
5090
5493
|
* @param {ASTNode} node The function node to get.
|
|
5091
5494
|
* @param {SourceCode} sourceCode The source code object to get tokens.
|
|
@@ -5392,6 +5795,13 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5392
5795
|
SHEBANG_MATCHER: shebangPattern,
|
|
5393
5796
|
STATEMENT_LIST_PARENTS,
|
|
5394
5797
|
ECMASCRIPT_GLOBALS,
|
|
5798
|
+
/**
|
|
5799
|
+
* Determines whether two adjacent tokens are on the same line.
|
|
5800
|
+
* @param {Object} left The left token object.
|
|
5801
|
+
* @param {Object} right The right token object.
|
|
5802
|
+
* @returns {boolean} Whether or not the tokens are on the same line.
|
|
5803
|
+
* @public
|
|
5804
|
+
*/
|
|
5395
5805
|
isTokenOnSameLine(left, right) {
|
|
5396
5806
|
return left.loc.end.line === right.loc.start.line;
|
|
5397
5807
|
},
|
|
@@ -5403,6 +5813,7 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5403
5813
|
isLoop,
|
|
5404
5814
|
isInLoop,
|
|
5405
5815
|
isArrayFromMethod,
|
|
5816
|
+
isArrayFromAsyncMethod,
|
|
5406
5817
|
isParenthesised,
|
|
5407
5818
|
createGlobalLinebreakMatcher,
|
|
5408
5819
|
equalTokens,
|
|
@@ -5432,23 +5843,75 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5432
5843
|
isOpeningParenToken,
|
|
5433
5844
|
isSemicolonToken,
|
|
5434
5845
|
isEqToken,
|
|
5846
|
+
/**
|
|
5847
|
+
* Checks whether or not a given node is a string literal.
|
|
5848
|
+
* @param {ASTNode} node A node to check.
|
|
5849
|
+
* @returns {boolean} `true` if the node is a string literal.
|
|
5850
|
+
*/
|
|
5435
5851
|
isStringLiteral(node) {
|
|
5436
5852
|
return node.type === "Literal" && typeof node.value == "string" || node.type === "TemplateLiteral";
|
|
5437
5853
|
},
|
|
5854
|
+
/**
|
|
5855
|
+
* Checks whether a given node is a breakable statement or not.
|
|
5856
|
+
* The node is breakable if the node is one of the following type:
|
|
5857
|
+
*
|
|
5858
|
+
* - DoWhileStatement
|
|
5859
|
+
* - ForInStatement
|
|
5860
|
+
* - ForOfStatement
|
|
5861
|
+
* - ForStatement
|
|
5862
|
+
* - SwitchStatement
|
|
5863
|
+
* - WhileStatement
|
|
5864
|
+
* @param {ASTNode} node A node to check.
|
|
5865
|
+
* @returns {boolean} `true` if the node is breakable.
|
|
5866
|
+
*/
|
|
5438
5867
|
isBreakableStatement(node) {
|
|
5439
5868
|
return breakableTypePattern.test(node.type);
|
|
5440
5869
|
},
|
|
5870
|
+
/**
|
|
5871
|
+
* Gets references which are non initializer and writable.
|
|
5872
|
+
* @param {Reference[]} references An array of references.
|
|
5873
|
+
* @returns {Reference[]} An array of only references which are non initializer and writable.
|
|
5874
|
+
* @public
|
|
5875
|
+
*/
|
|
5441
5876
|
getModifyingReferences(references) {
|
|
5442
5877
|
return references.filter(isModifyingReference);
|
|
5443
5878
|
},
|
|
5879
|
+
/**
|
|
5880
|
+
* Validate that a string passed in is surrounded by the specified character
|
|
5881
|
+
* @param {string} val The text to check.
|
|
5882
|
+
* @param {string} character The character to see if it's surrounded by.
|
|
5883
|
+
* @returns {boolean} True if the text is surrounded by the character, false if not.
|
|
5884
|
+
* @private
|
|
5885
|
+
*/
|
|
5444
5886
|
isSurroundedBy(val, character) {
|
|
5445
5887
|
return val[0] === character && val.at(-1) === character;
|
|
5446
5888
|
},
|
|
5889
|
+
/**
|
|
5890
|
+
* Returns whether the provided node is an ESLint directive comment or not
|
|
5891
|
+
* @param {Line|Block} node The comment token to be checked
|
|
5892
|
+
* @returns {boolean} `true` if the node is an ESLint directive comment
|
|
5893
|
+
*/
|
|
5447
5894
|
isDirectiveComment(node) {
|
|
5448
5895
|
let comment = node.value.trim();
|
|
5449
5896
|
return node.type === "Line" && comment.startsWith("eslint-") || node.type === "Block" && ESLINT_DIRECTIVE_PATTERN.test(comment);
|
|
5450
5897
|
},
|
|
5898
|
+
/**
|
|
5899
|
+
* Gets the trailing statement of a given node.
|
|
5900
|
+
*
|
|
5901
|
+
* if (code)
|
|
5902
|
+
* consequent;
|
|
5903
|
+
*
|
|
5904
|
+
* When taking this `IfStatement`, returns `consequent;` statement.
|
|
5905
|
+
* @param {ASTNode} A node to get.
|
|
5906
|
+
* @returns {ASTNode|null} The trailing statement's node.
|
|
5907
|
+
*/
|
|
5451
5908
|
getTrailingStatement: esutils.ast.trailingStatement,
|
|
5909
|
+
/**
|
|
5910
|
+
* Finds the variable by a given name in a given scope and its upper scopes.
|
|
5911
|
+
* @param {Scope} initScope A scope to start find.
|
|
5912
|
+
* @param {string} name A variable name to find.
|
|
5913
|
+
* @returns {Variable|null} A found variable or `null`.
|
|
5914
|
+
*/
|
|
5452
5915
|
getVariableByName(initScope, name) {
|
|
5453
5916
|
let scope = initScope;
|
|
5454
5917
|
for (; scope;) {
|
|
@@ -5458,6 +5921,34 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5458
5921
|
}
|
|
5459
5922
|
return null;
|
|
5460
5923
|
},
|
|
5924
|
+
/**
|
|
5925
|
+
* Checks whether or not a given function node is the default `this` binding.
|
|
5926
|
+
*
|
|
5927
|
+
* First, this checks the node:
|
|
5928
|
+
*
|
|
5929
|
+
* - The given node is not in `PropertyDefinition#value` position.
|
|
5930
|
+
* - The given node is not `StaticBlock`.
|
|
5931
|
+
* - The function name does not start with uppercase. It's a convention to capitalize the names
|
|
5932
|
+
* of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
|
|
5933
|
+
* - The function does not have a JSDoc comment that has a `@this` tag.
|
|
5934
|
+
*
|
|
5935
|
+
* Next, this checks the location of the node.
|
|
5936
|
+
* If the location is below, this judges `this` is valid.
|
|
5937
|
+
*
|
|
5938
|
+
* - The location is not on an object literal.
|
|
5939
|
+
* - The location is not assigned to a variable which starts with an uppercase letter. Applies to anonymous
|
|
5940
|
+
* functions only, as the name of the variable is considered to be the name of the function in this case.
|
|
5941
|
+
* This check is not performed if `capIsConstructor` is set to `false`.
|
|
5942
|
+
* - The location is not on an ES2015 class.
|
|
5943
|
+
* - Its `bind`/`call`/`apply` method is not called directly.
|
|
5944
|
+
* - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given.
|
|
5945
|
+
* @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock`
|
|
5946
|
+
* or any expression that is `PropertyDefinition#value` node.
|
|
5947
|
+
* @param {SourceCode} sourceCode A SourceCode instance to get comments.
|
|
5948
|
+
* @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts
|
|
5949
|
+
* with an uppercase or are assigned to a variable which name starts with an uppercase are constructors.
|
|
5950
|
+
* @returns {boolean} The function node is the default `this` binding.
|
|
5951
|
+
*/
|
|
5461
5952
|
isDefaultThisBinding(node, sourceCode, { capIsConstructor = !0 } = {}) {
|
|
5462
5953
|
if (node.parent.type === "PropertyDefinition" && node.parent.value === node || node.type === "StaticBlock" || (node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && node.params.some((param) => param.type === "Identifier" && param.name === "this") || capIsConstructor && isES5Constructor(node) || hasJSDocThisTag(node, sourceCode)) return !1;
|
|
5463
5954
|
let isAnonymous = node.id === null, currentNode = node;
|
|
@@ -5491,13 +5982,19 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5491
5982
|
return !(isCallee(maybeCalleeNode) && maybeCalleeNode.parent.arguments.length >= 1 && !isNullOrUndefined(maybeCalleeNode.parent.arguments[0]));
|
|
5492
5983
|
}
|
|
5493
5984
|
return !0;
|
|
5494
|
-
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;
|
|
5495
5986
|
default: return !0;
|
|
5496
5987
|
}
|
|
5497
5988
|
}
|
|
5498
5989
|
/* c8 ignore next */
|
|
5499
5990
|
return !0;
|
|
5500
5991
|
},
|
|
5992
|
+
/**
|
|
5993
|
+
* Get the precedence level based on the node type
|
|
5994
|
+
* @param {ASTNode} node node to evaluate
|
|
5995
|
+
* @returns {number} precedence level
|
|
5996
|
+
* @private
|
|
5997
|
+
*/
|
|
5501
5998
|
getPrecedence(node) {
|
|
5502
5999
|
switch (node.type) {
|
|
5503
6000
|
case "SequenceExpression": return 0;
|
|
@@ -5544,12 +6041,27 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5544
6041
|
default: return node.type in eslintVisitorKeys ? 20 : -1;
|
|
5545
6042
|
}
|
|
5546
6043
|
},
|
|
6044
|
+
/**
|
|
6045
|
+
* Checks whether the given node is an empty block node or not.
|
|
6046
|
+
* @param {ASTNode|null} node The node to check.
|
|
6047
|
+
* @returns {boolean} `true` if the node is an empty block.
|
|
6048
|
+
*/
|
|
5547
6049
|
isEmptyBlock(node) {
|
|
5548
6050
|
return !!(node && node.type === "BlockStatement" && node.body.length === 0);
|
|
5549
6051
|
},
|
|
6052
|
+
/**
|
|
6053
|
+
* Checks whether the given node is an empty function node or not.
|
|
6054
|
+
* @param {ASTNode|null} node The node to check.
|
|
6055
|
+
* @returns {boolean} `true` if the node is an empty function.
|
|
6056
|
+
*/
|
|
5550
6057
|
isEmptyFunction(node) {
|
|
5551
6058
|
return isFunction(node) && module.exports.isEmptyBlock(node.body);
|
|
5552
6059
|
},
|
|
6060
|
+
/**
|
|
6061
|
+
* Get directives from directive prologue of a Program or Function node.
|
|
6062
|
+
* @param {ASTNode} node The node to check.
|
|
6063
|
+
* @returns {ASTNode[]} The directives found in the directive prologue.
|
|
6064
|
+
*/
|
|
5553
6065
|
getDirectivePrologue(node) {
|
|
5554
6066
|
let directives = [];
|
|
5555
6067
|
if (node.type === "Program" || node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") {
|
|
@@ -5559,12 +6071,106 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5559
6071
|
}
|
|
5560
6072
|
return directives;
|
|
5561
6073
|
},
|
|
6074
|
+
/**
|
|
6075
|
+
* Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added
|
|
6076
|
+
* after the node will be parsed as a decimal point, rather than a property-access dot.
|
|
6077
|
+
* @param {ASTNode} node The node to check.
|
|
6078
|
+
* @returns {boolean} `true` if this node is a decimal integer.
|
|
6079
|
+
* @example
|
|
6080
|
+
*
|
|
6081
|
+
* 0 // true
|
|
6082
|
+
* 5 // true
|
|
6083
|
+
* 50 // true
|
|
6084
|
+
* 5_000 // true
|
|
6085
|
+
* 1_234_56 // true
|
|
6086
|
+
* 08 // true
|
|
6087
|
+
* 0192 // true
|
|
6088
|
+
* 5. // false
|
|
6089
|
+
* .5 // false
|
|
6090
|
+
* 5.0 // false
|
|
6091
|
+
* 5.00_00 // false
|
|
6092
|
+
* 05 // false
|
|
6093
|
+
* 0x5 // false
|
|
6094
|
+
* 0b101 // false
|
|
6095
|
+
* 0b11_01 // false
|
|
6096
|
+
* 0o5 // false
|
|
6097
|
+
* 5e0 // false
|
|
6098
|
+
* 5e1_000 // false
|
|
6099
|
+
* 5n // false
|
|
6100
|
+
* 1_000n // false
|
|
6101
|
+
* "5" // false
|
|
6102
|
+
*
|
|
6103
|
+
*/
|
|
5562
6104
|
isDecimalInteger(node) {
|
|
5563
6105
|
return node.type === "Literal" && typeof node.value == "number" && DECIMAL_INTEGER_PATTERN.test(node.raw);
|
|
5564
6106
|
},
|
|
6107
|
+
/**
|
|
6108
|
+
* Determines whether this token is a decimal integer numeric token.
|
|
6109
|
+
* This is similar to isDecimalInteger(), but for tokens.
|
|
6110
|
+
* @param {Token} token The token to check.
|
|
6111
|
+
* @returns {boolean} `true` if this token is a decimal integer.
|
|
6112
|
+
*/
|
|
5565
6113
|
isDecimalIntegerNumericToken(token) {
|
|
5566
6114
|
return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value);
|
|
5567
6115
|
},
|
|
6116
|
+
/**
|
|
6117
|
+
* Gets the name and kind of the given function node.
|
|
6118
|
+
*
|
|
6119
|
+
* - `function foo() {}` .................... `function 'foo'`
|
|
6120
|
+
* - `(function foo() {})` .................. `function 'foo'`
|
|
6121
|
+
* - `(function() {})` ...................... `function`
|
|
6122
|
+
* - `function* foo() {}` ................... `generator function 'foo'`
|
|
6123
|
+
* - `(function* foo() {})` ................. `generator function 'foo'`
|
|
6124
|
+
* - `(function*() {})` ..................... `generator function`
|
|
6125
|
+
* - `() => {}` ............................. `arrow function`
|
|
6126
|
+
* - `async () => {}` ....................... `async arrow function`
|
|
6127
|
+
* - `({ foo: function foo() {} })` ......... `method 'foo'`
|
|
6128
|
+
* - `({ foo: function() {} })` ............. `method 'foo'`
|
|
6129
|
+
* - `({ ['foo']: function() {} })` ......... `method 'foo'`
|
|
6130
|
+
* - `({ [foo]: function() {} })` ........... `method`
|
|
6131
|
+
* - `({ foo() {} })` ....................... `method 'foo'`
|
|
6132
|
+
* - `({ foo: function* foo() {} })` ........ `generator method 'foo'`
|
|
6133
|
+
* - `({ foo: function*() {} })` ............ `generator method 'foo'`
|
|
6134
|
+
* - `({ ['foo']: function*() {} })` ........ `generator method 'foo'`
|
|
6135
|
+
* - `({ [foo]: function*() {} })` .......... `generator method`
|
|
6136
|
+
* - `({ *foo() {} })` ...................... `generator method 'foo'`
|
|
6137
|
+
* - `({ foo: async function foo() {} })` ... `async method 'foo'`
|
|
6138
|
+
* - `({ foo: async function() {} })` ....... `async method 'foo'`
|
|
6139
|
+
* - `({ ['foo']: async function() {} })` ... `async method 'foo'`
|
|
6140
|
+
* - `({ [foo]: async function() {} })` ..... `async method`
|
|
6141
|
+
* - `({ async foo() {} })` ................. `async method 'foo'`
|
|
6142
|
+
* - `({ get foo() {} })` ................... `getter 'foo'`
|
|
6143
|
+
* - `({ set foo(a) {} })` .................. `setter 'foo'`
|
|
6144
|
+
* - `class A { constructor() {} }` ......... `constructor`
|
|
6145
|
+
* - `class A { foo() {} }` ................. `method 'foo'`
|
|
6146
|
+
* - `class A { *foo() {} }` ................ `generator method 'foo'`
|
|
6147
|
+
* - `class A { async foo() {} }` ........... `async method 'foo'`
|
|
6148
|
+
* - `class A { ['foo']() {} }` ............. `method 'foo'`
|
|
6149
|
+
* - `class A { *['foo']() {} }` ............ `generator method 'foo'`
|
|
6150
|
+
* - `class A { async ['foo']() {} }` ....... `async method 'foo'`
|
|
6151
|
+
* - `class A { [foo]() {} }` ............... `method`
|
|
6152
|
+
* - `class A { *[foo]() {} }` .............. `generator method`
|
|
6153
|
+
* - `class A { async [foo]() {} }` ......... `async method`
|
|
6154
|
+
* - `class A { get foo() {} }` ............. `getter 'foo'`
|
|
6155
|
+
* - `class A { set foo(a) {} }` ............ `setter 'foo'`
|
|
6156
|
+
* - `class A { static foo() {} }` .......... `static method 'foo'`
|
|
6157
|
+
* - `class A { static *foo() {} }` ......... `static generator method 'foo'`
|
|
6158
|
+
* - `class A { static async foo() {} }` .... `static async method 'foo'`
|
|
6159
|
+
* - `class A { static get foo() {} }` ...... `static getter 'foo'`
|
|
6160
|
+
* - `class A { static set foo(a) {} }` ..... `static setter 'foo'`
|
|
6161
|
+
* - `class A { foo = () => {}; }` .......... `method 'foo'`
|
|
6162
|
+
* - `class A { foo = function() {}; }` ..... `method 'foo'`
|
|
6163
|
+
* - `class A { foo = function bar() {}; }` . `method 'foo'`
|
|
6164
|
+
* - `class A { static foo = () => {}; }` ... `static method 'foo'`
|
|
6165
|
+
* - `class A { '#foo' = () => {}; }` ....... `method '#foo'`
|
|
6166
|
+
* - `class A { #foo = () => {}; }` ......... `private method #foo`
|
|
6167
|
+
* - `class A { static #foo = () => {}; }` .. `static private method #foo`
|
|
6168
|
+
* - `class A { '#foo'() {} }` .............. `method '#foo'`
|
|
6169
|
+
* - `class A { #foo() {} }` ................ `private method #foo`
|
|
6170
|
+
* - `class A { static #foo() {} }` ......... `static private method #foo`
|
|
6171
|
+
* @param {ASTNode} node The function node to get.
|
|
6172
|
+
* @returns {string} The name and kind of the function node.
|
|
6173
|
+
*/
|
|
5568
6174
|
getFunctionNameWithKind(node) {
|
|
5569
6175
|
let parent = node.parent, tokens = [];
|
|
5570
6176
|
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition" || node.type === "TSPropertySignature" || node.type === "TSMethodSignature") && (parent.static && tokens.push("static"), !parent.computed && parent.key?.type === "PrivateIdentifier" && tokens.push("private")), node.async && tokens.push("async"), node.generator && tokens.push("generator"), parent.type === "Property" || parent.type === "MethodDefinition") {
|
|
@@ -5579,6 +6185,103 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5579
6185
|
else node.type === "TSMethodSignature" ? tokens.push(`'${getStaticPropertyName(node)}'`) : node.id && tokens.push(`'${node.id.name}'`);
|
|
5580
6186
|
return tokens.join(" ");
|
|
5581
6187
|
},
|
|
6188
|
+
/**
|
|
6189
|
+
* Gets the location of the given function node for reporting.
|
|
6190
|
+
*
|
|
6191
|
+
* - `function foo() {}`
|
|
6192
|
+
* ^^^^^^^^^^^^
|
|
6193
|
+
* - `(function foo() {})`
|
|
6194
|
+
* ^^^^^^^^^^^^
|
|
6195
|
+
* - `(function() {})`
|
|
6196
|
+
* ^^^^^^^^
|
|
6197
|
+
* - `function* foo() {}`
|
|
6198
|
+
* ^^^^^^^^^^^^^
|
|
6199
|
+
* - `(function* foo() {})`
|
|
6200
|
+
* ^^^^^^^^^^^^^
|
|
6201
|
+
* - `(function*() {})`
|
|
6202
|
+
* ^^^^^^^^^
|
|
6203
|
+
* - `() => {}`
|
|
6204
|
+
* ^^
|
|
6205
|
+
* - `async () => {}`
|
|
6206
|
+
* ^^
|
|
6207
|
+
* - `({ foo: function foo() {} })`
|
|
6208
|
+
* ^^^^^^^^^^^^^^^^^
|
|
6209
|
+
* - `({ foo: function() {} })`
|
|
6210
|
+
* ^^^^^^^^^^^^^
|
|
6211
|
+
* - `({ ['foo']: function() {} })`
|
|
6212
|
+
* ^^^^^^^^^^^^^^^^^
|
|
6213
|
+
* - `({ [foo]: function() {} })`
|
|
6214
|
+
* ^^^^^^^^^^^^^^^
|
|
6215
|
+
* - `({ foo() {} })`
|
|
6216
|
+
* ^^^
|
|
6217
|
+
* - `({ foo: function* foo() {} })`
|
|
6218
|
+
* ^^^^^^^^^^^^^^^^^^
|
|
6219
|
+
* - `({ foo: function*() {} })`
|
|
6220
|
+
* ^^^^^^^^^^^^^^
|
|
6221
|
+
* - `({ ['foo']: function*() {} })`
|
|
6222
|
+
* ^^^^^^^^^^^^^^^^^^
|
|
6223
|
+
* - `({ [foo]: function*() {} })`
|
|
6224
|
+
* ^^^^^^^^^^^^^^^^
|
|
6225
|
+
* - `({ *foo() {} })`
|
|
6226
|
+
* ^^^^
|
|
6227
|
+
* - `({ foo: async function foo() {} })`
|
|
6228
|
+
* ^^^^^^^^^^^^^^^^^^^^^^^
|
|
6229
|
+
* - `({ foo: async function() {} })`
|
|
6230
|
+
* ^^^^^^^^^^^^^^^^^^^
|
|
6231
|
+
* - `({ ['foo']: async function() {} })`
|
|
6232
|
+
* ^^^^^^^^^^^^^^^^^^^^^^^
|
|
6233
|
+
* - `({ [foo]: async function() {} })`
|
|
6234
|
+
* ^^^^^^^^^^^^^^^^^^^^^
|
|
6235
|
+
* - `({ async foo() {} })`
|
|
6236
|
+
* ^^^^^^^^^
|
|
6237
|
+
* - `({ get foo() {} })`
|
|
6238
|
+
* ^^^^^^^
|
|
6239
|
+
* - `({ set foo(a) {} })`
|
|
6240
|
+
* ^^^^^^^
|
|
6241
|
+
* - `class A { constructor() {} }`
|
|
6242
|
+
* ^^^^^^^^^^^
|
|
6243
|
+
* - `class A { foo() {} }`
|
|
6244
|
+
* ^^^
|
|
6245
|
+
* - `class A { *foo() {} }`
|
|
6246
|
+
* ^^^^
|
|
6247
|
+
* - `class A { async foo() {} }`
|
|
6248
|
+
* ^^^^^^^^^
|
|
6249
|
+
* - `class A { ['foo']() {} }`
|
|
6250
|
+
* ^^^^^^^
|
|
6251
|
+
* - `class A { *['foo']() {} }`
|
|
6252
|
+
* ^^^^^^^^
|
|
6253
|
+
* - `class A { async ['foo']() {} }`
|
|
6254
|
+
* ^^^^^^^^^^^^^
|
|
6255
|
+
* - `class A { [foo]() {} }`
|
|
6256
|
+
* ^^^^^
|
|
6257
|
+
* - `class A { *[foo]() {} }`
|
|
6258
|
+
* ^^^^^^
|
|
6259
|
+
* - `class A { async [foo]() {} }`
|
|
6260
|
+
* ^^^^^^^^^^^
|
|
6261
|
+
* - `class A { get foo() {} }`
|
|
6262
|
+
* ^^^^^^^
|
|
6263
|
+
* - `class A { set foo(a) {} }`
|
|
6264
|
+
* ^^^^^^^
|
|
6265
|
+
* - `class A { static foo() {} }`
|
|
6266
|
+
* ^^^^^^^^^^
|
|
6267
|
+
* - `class A { static *foo() {} }`
|
|
6268
|
+
* ^^^^^^^^^^^
|
|
6269
|
+
* - `class A { static async foo() {} }`
|
|
6270
|
+
* ^^^^^^^^^^^^^^^^
|
|
6271
|
+
* - `class A { static get foo() {} }`
|
|
6272
|
+
* ^^^^^^^^^^^^^^
|
|
6273
|
+
* - `class A { static set foo(a) {} }`
|
|
6274
|
+
* ^^^^^^^^^^^^^^
|
|
6275
|
+
* - `class A { foo = function() {} }`
|
|
6276
|
+
* ^^^^^^^^^^^^^^
|
|
6277
|
+
* - `class A { static foo = function() {} }`
|
|
6278
|
+
* ^^^^^^^^^^^^^^^^^^^^^
|
|
6279
|
+
* - `class A { foo = (a, b) => {} }`
|
|
6280
|
+
* ^^^^^^
|
|
6281
|
+
* @param {ASTNode} node The function node to get.
|
|
6282
|
+
* @param {SourceCode} sourceCode The source code object to get tokens.
|
|
6283
|
+
* @returns {string} The location of the function node for reporting.
|
|
6284
|
+
*/
|
|
5582
6285
|
getFunctionHeadLoc(node, sourceCode) {
|
|
5583
6286
|
let parent = node.parent, start, end;
|
|
5584
6287
|
if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition" || parent.type === "TSPropertySignature" || parent.type === "TSMethodSignature") start = parent.loc.start, end = getOpeningParenOfParams(node, sourceCode).loc.start;
|
|
@@ -5591,6 +6294,50 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5591
6294
|
end: Object.assign({}, end)
|
|
5592
6295
|
};
|
|
5593
6296
|
},
|
|
6297
|
+
/**
|
|
6298
|
+
* Gets next location when the result is not out of bound, otherwise returns null.
|
|
6299
|
+
*
|
|
6300
|
+
* Assumptions:
|
|
6301
|
+
*
|
|
6302
|
+
* - The given location represents a valid location in the given source code.
|
|
6303
|
+
* - Columns are 0-based.
|
|
6304
|
+
* - Lines are 1-based.
|
|
6305
|
+
* - Column immediately after the last character in a line (not incl. linebreaks) is considered to be a valid location.
|
|
6306
|
+
* - If the source code ends with a linebreak, `sourceCode.lines` array will have an extra element (empty string) at the end.
|
|
6307
|
+
* The start (column 0) of that extra line is considered to be a valid location.
|
|
6308
|
+
*
|
|
6309
|
+
* Examples of successive locations (line, column):
|
|
6310
|
+
*
|
|
6311
|
+
* code: foo
|
|
6312
|
+
* locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> null
|
|
6313
|
+
*
|
|
6314
|
+
* code: foo<LF>
|
|
6315
|
+
* locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null
|
|
6316
|
+
*
|
|
6317
|
+
* code: foo<CR><LF>
|
|
6318
|
+
* locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null
|
|
6319
|
+
*
|
|
6320
|
+
* code: a<LF>b
|
|
6321
|
+
* locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> null
|
|
6322
|
+
*
|
|
6323
|
+
* code: a<LF>b<LF>
|
|
6324
|
+
* locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null
|
|
6325
|
+
*
|
|
6326
|
+
* code: a<CR><LF>b<CR><LF>
|
|
6327
|
+
* locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null
|
|
6328
|
+
*
|
|
6329
|
+
* code: a<LF><LF>
|
|
6330
|
+
* locations: (1, 0) -> (1, 1) -> (2, 0) -> (3, 0) -> null
|
|
6331
|
+
*
|
|
6332
|
+
* code: <LF>
|
|
6333
|
+
* locations: (1, 0) -> (2, 0) -> null
|
|
6334
|
+
*
|
|
6335
|
+
* code:
|
|
6336
|
+
* locations: (1, 0) -> null
|
|
6337
|
+
* @param {SourceCode} sourceCode The sourceCode
|
|
6338
|
+
* @param {{line: number, column: number}} location The location
|
|
6339
|
+
* @returns {{line: number, column: number} | null} Next location
|
|
6340
|
+
*/
|
|
5594
6341
|
getNextLocation(sourceCode, { line, column }) {
|
|
5595
6342
|
return column < sourceCode.lines[line - 1].length ? {
|
|
5596
6343
|
line,
|
|
@@ -5600,11 +6347,23 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5600
6347
|
column: 0
|
|
5601
6348
|
} : null;
|
|
5602
6349
|
},
|
|
6350
|
+
/**
|
|
6351
|
+
* Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses
|
|
6352
|
+
* surrounding the node.
|
|
6353
|
+
* @param {SourceCode} sourceCode The source code object
|
|
6354
|
+
* @param {ASTNode} node An expression node
|
|
6355
|
+
* @returns {string} The text representing the node, with all surrounding parentheses included
|
|
6356
|
+
*/
|
|
5603
6357
|
getParenthesisedText(sourceCode, node) {
|
|
5604
6358
|
let leftToken = sourceCode.getFirstToken(node), rightToken = sourceCode.getLastToken(node);
|
|
5605
6359
|
for (; sourceCode.getTokenBefore(leftToken) && sourceCode.getTokenBefore(leftToken).type === "Punctuator" && sourceCode.getTokenBefore(leftToken).value === "(" && sourceCode.getTokenAfter(rightToken) && sourceCode.getTokenAfter(rightToken).type === "Punctuator" && sourceCode.getTokenAfter(rightToken).value === ")";) leftToken = sourceCode.getTokenBefore(leftToken), rightToken = sourceCode.getTokenAfter(rightToken);
|
|
5606
6360
|
return sourceCode.getText().slice(leftToken.range[0], rightToken.range[1]);
|
|
5607
6361
|
},
|
|
6362
|
+
/**
|
|
6363
|
+
* Determine if a node has a possibility to be an Error object
|
|
6364
|
+
* @param {ASTNode} node ASTNode to check
|
|
6365
|
+
* @returns {boolean} True if there is a chance it contains an Error obj
|
|
6366
|
+
*/
|
|
5608
6367
|
couldBeError(node) {
|
|
5609
6368
|
switch (node.type) {
|
|
5610
6369
|
case "Identifier":
|
|
@@ -5631,9 +6390,21 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5631
6390
|
default: return !1;
|
|
5632
6391
|
}
|
|
5633
6392
|
},
|
|
6393
|
+
/**
|
|
6394
|
+
* Check if a given node is a numeric literal or not.
|
|
6395
|
+
* @param {ASTNode} node The node to check.
|
|
6396
|
+
* @returns {boolean} `true` if the node is a number or bigint literal.
|
|
6397
|
+
*/
|
|
5634
6398
|
isNumericLiteral(node) {
|
|
5635
6399
|
return node.type === "Literal" && (typeof node.value == "number" || !!node.bigint);
|
|
5636
6400
|
},
|
|
6401
|
+
/**
|
|
6402
|
+
* Determines whether two tokens can safely be placed next to each other without merging into a single token
|
|
6403
|
+
* @param {Token|string} leftValue The left token. If this is a string, it will be tokenized and the last token will be used.
|
|
6404
|
+
* @param {Token|string} rightValue The right token. If this is a string, it will be tokenized and the first token will be used.
|
|
6405
|
+
* @returns {boolean} If the tokens cannot be safely placed next to each other, returns `false`. If the tokens can be placed
|
|
6406
|
+
* next to each other, behavior is undefined (although it should return `true` in most cases).
|
|
6407
|
+
*/
|
|
5637
6408
|
canTokensBeAdjacent(leftValue, rightValue) {
|
|
5638
6409
|
let espreeOptions = {
|
|
5639
6410
|
ecmaVersion: espree.latestEcmaVersion,
|
|
@@ -5681,6 +6452,13 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5681
6452
|
}
|
|
5682
6453
|
return !!(leftToken.type === "String" || rightToken.type === "String" || leftToken.type === "Template" || rightToken.type === "Template" || leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith(".") || leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line" || rightToken.type === "PrivateIdentifier");
|
|
5683
6454
|
},
|
|
6455
|
+
/**
|
|
6456
|
+
* Get the `loc` object of a given name in a `/*globals` directive comment.
|
|
6457
|
+
* @param {SourceCode} sourceCode The source code to convert index to loc.
|
|
6458
|
+
* @param {Comment} comment The `/*globals` directive comment which include the name.
|
|
6459
|
+
* @param {string} name The name to find.
|
|
6460
|
+
* @returns {SourceLocation} The `loc` object.
|
|
6461
|
+
*/
|
|
5684
6462
|
getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) {
|
|
5685
6463
|
let namePattern = RegExp(`[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`, "gu");
|
|
5686
6464
|
namePattern.lastIndex = comment.value.indexOf("global") + 6;
|
|
@@ -5693,12 +6471,58 @@ var require_eslint_visitor_keys = /* @__PURE__ */ require_chunk.t(((exports) =>
|
|
|
5693
6471
|
}
|
|
5694
6472
|
};
|
|
5695
6473
|
},
|
|
6474
|
+
/**
|
|
6475
|
+
* Determines whether the given raw string contains an octal escape sequence
|
|
6476
|
+
* or a non-octal decimal escape sequence ("\8", "\9").
|
|
6477
|
+
*
|
|
6478
|
+
* "\1", "\2" ... "\7", "\8", "\9"
|
|
6479
|
+
* "\00", "\01" ... "\07", "\08", "\09"
|
|
6480
|
+
*
|
|
6481
|
+
* "\0", when not followed by a digit, is not an octal escape sequence.
|
|
6482
|
+
* @param {string} rawString A string in its raw representation.
|
|
6483
|
+
* @returns {boolean} `true` if the string contains at least one octal escape sequence
|
|
6484
|
+
* or at least one non-octal decimal escape sequence.
|
|
6485
|
+
*/
|
|
5696
6486
|
hasOctalOrNonOctalDecimalEscapeSequence(rawString) {
|
|
5697
6487
|
return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
|
|
5698
6488
|
},
|
|
6489
|
+
/**
|
|
6490
|
+
* Determines whether the given node is a template literal without expressions.
|
|
6491
|
+
* @param {ASTNode} node Node to check.
|
|
6492
|
+
* @returns {boolean} True if the node is a template literal without expressions.
|
|
6493
|
+
*/
|
|
5699
6494
|
isStaticTemplateLiteral(node) {
|
|
5700
6495
|
return node.type === "TemplateLiteral" && node.expressions.length === 0;
|
|
5701
6496
|
},
|
|
6497
|
+
/**
|
|
6498
|
+
* Determines whether the existing curly braces around the single statement are necessary to preserve the semantics of the code.
|
|
6499
|
+
* The braces, which make the given block body, are necessary in either of the following situations:
|
|
6500
|
+
*
|
|
6501
|
+
* 1. The statement is a lexical declaration.
|
|
6502
|
+
* 2. Without the braces, an `if` within the statement would become associated with an `else` after the closing brace:
|
|
6503
|
+
*
|
|
6504
|
+
* if (a) {
|
|
6505
|
+
* if (b)
|
|
6506
|
+
* foo();
|
|
6507
|
+
* }
|
|
6508
|
+
* else
|
|
6509
|
+
* bar();
|
|
6510
|
+
*
|
|
6511
|
+
* if (a)
|
|
6512
|
+
* while (b)
|
|
6513
|
+
* while (c) {
|
|
6514
|
+
* while (d)
|
|
6515
|
+
* if (e)
|
|
6516
|
+
* while(f)
|
|
6517
|
+
* foo();
|
|
6518
|
+
* }
|
|
6519
|
+
* else
|
|
6520
|
+
* bar();
|
|
6521
|
+
* @param {ASTNode} node `BlockStatement` body with exactly one statement directly inside. The statement can have its own nested statements.
|
|
6522
|
+
* @param {SourceCode} sourceCode The source code
|
|
6523
|
+
* @returns {boolean} `true` if the braces are necessary - removing them (replacing the given `BlockStatement` body with its single statement content)
|
|
6524
|
+
* would change the semantics of the code or produce a syntax error.
|
|
6525
|
+
*/
|
|
5702
6526
|
areBracesNecessary(node, sourceCode) {
|
|
5703
6527
|
/**
|
|
5704
6528
|
* Determines if the given node is a lexical declaration (let, const, using, await using, function, or class)
|