@alexlit/lint-kit 175.0.0 → 176.0.1

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.
Files changed (948) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/node_modules/@eslint/core/README.md +29 -0
  3. package/packages/config-eslint/node_modules/@eslint/core/dist/cjs/types.d.cts +1179 -0
  4. package/packages/config-eslint/node_modules/@eslint/core/dist/esm/types.d.ts +1179 -0
  5. package/packages/config-eslint/node_modules/@eslint/core/package.json +49 -0
  6. package/packages/config-eslint/node_modules/@eslint/plugin-kit/README.md +10 -10
  7. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +1 -12
  8. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +3 -4
  9. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/types.cts +0 -74
  10. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +3 -4
  11. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.js +1 -12
  12. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +0 -40
  13. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.ts +0 -74
  14. package/packages/config-eslint/node_modules/@eslint/plugin-kit/package.json +4 -5
  15. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/configs/flat-config-base.js +9 -0
  16. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/index.d.ts +17 -0
  17. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/index.js +91 -0
  18. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/license +9 -0
  19. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/globals.json +3345 -0
  20. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/index.d.ts +3452 -0
  21. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/index.js +2 -0
  22. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/license +9 -0
  23. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/package.json +117 -0
  24. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/node_modules/globals/readme.md +42 -0
  25. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/package.json +128 -0
  26. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/readme.md +261 -0
  27. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/call-or-new-expression.js +120 -0
  28. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/function-types.js +7 -0
  29. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/index.js +30 -0
  30. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-arrow-function-body.js +3 -0
  31. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-directive.js +4 -0
  32. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-array-expression.js +5 -0
  33. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-empty-node.js +17 -0
  34. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-expression-statement.js +7 -0
  35. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-function.js +5 -0
  36. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-member-expression.js +98 -0
  37. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-method-call.js +62 -0
  38. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-negative-one.js +8 -0
  39. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-reference-identifier.js +159 -0
  40. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-static-require.js +10 -0
  41. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-tagged-template-literal.js +24 -0
  42. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/is-undefined.js +3 -0
  43. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/ast/literal.js +24 -0
  44. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/better-regex.js +146 -0
  45. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/catch-error-name.js +138 -0
  46. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-assert.js +98 -0
  47. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-date-clone.js +54 -0
  48. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-destructuring.js +168 -0
  49. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-empty-array-spread.js +127 -0
  50. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-existence-index-check.js +137 -0
  51. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/consistent-function-scoping.js +265 -0
  52. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/custom-error-definition.js +218 -0
  53. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/empty-brace-spaces.js +62 -0
  54. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/error-message.js +98 -0
  55. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/escape-case.js +86 -0
  56. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js +584 -0
  57. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/explicit-length-check.js +236 -0
  58. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/filename-case.js +276 -0
  59. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/add-parenthesizes-to-return-or-throw-expression.js +29 -0
  60. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/append-argument.js +30 -0
  61. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/extend-fix-range.js +11 -0
  62. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/fix-space-around-keywords.js +43 -0
  63. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/index.js +23 -0
  64. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-argument.js +40 -0
  65. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-expression-statement.js +34 -0
  66. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-method-call.js +28 -0
  67. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-object-property.js +21 -0
  68. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-parentheses.js +19 -0
  69. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-spaces-after.js +22 -0
  70. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/remove-specifier.js +59 -0
  71. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/rename-variable.js +8 -0
  72. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-argument.js +17 -0
  73. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-member-expression-property.js +25 -0
  74. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-node-or-token-and-spaces-before.js +31 -0
  75. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-reference-identifier.js +32 -0
  76. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-string-raw.js +12 -0
  77. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/replace-template-element.js +10 -0
  78. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/switch-call-expression-to-new-expression.js +29 -0
  79. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/fix/switch-new-expression-to-call-expression.js +42 -0
  80. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/import-style.js +375 -0
  81. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/index.js +143 -0
  82. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/new-for-builtins.js +112 -0
  83. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-abusive-eslint-disable.js +63 -0
  84. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-accessor-recursion.js +160 -0
  85. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-anonymous-default-export.js +210 -0
  86. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-callback-reference.js +285 -0
  87. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-for-each.js +496 -0
  88. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-method-this-argument.js +223 -0
  89. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-reduce.js +128 -0
  90. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-reverse.js +6 -0
  91. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-array-sort.js +6 -0
  92. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-await-expression-member.js +85 -0
  93. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-await-in-promise-methods.js +69 -0
  94. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-console-spaces.js +89 -0
  95. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-document-cookie.js +27 -0
  96. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-empty-file.js +58 -0
  97. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-for-loop.js +419 -0
  98. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-hex-escape.js +54 -0
  99. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-immediate-mutation.js +778 -0
  100. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-instanceof-builtins.js +216 -0
  101. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-invalid-fetch-options.js +112 -0
  102. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-invalid-remove-event-listener.js +61 -0
  103. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-keyword-prefix.js +202 -0
  104. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-lonely-if.js +155 -0
  105. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-magic-array-flat-depth.js +55 -0
  106. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-named-default.js +101 -0
  107. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-negated-condition.js +145 -0
  108. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-negation-in-equality-check.js +99 -0
  109. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-nested-ternary.js +60 -0
  110. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-new-array.js +106 -0
  111. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-new-buffer.js +100 -0
  112. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-null.js +153 -0
  113. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-object-as-default-parameter.js +52 -0
  114. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-process-exit.js +106 -0
  115. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-single-promise-in-promise-methods.js +179 -0
  116. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-static-only-class.js +226 -0
  117. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-thenable.js +194 -0
  118. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-this-assignment.js +40 -0
  119. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-typeof-undefined.js +146 -0
  120. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-array-flat-depth.js +49 -0
  121. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-array-splice-count.js +23 -0
  122. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-await.js +110 -0
  123. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-polyfills.js +174 -0
  124. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unnecessary-slice-end.js +22 -0
  125. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unreadable-array-destructuring.js +85 -0
  126. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unreadable-iife.js +43 -0
  127. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-unused-properties.js +240 -0
  128. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-collection-argument.js +101 -0
  129. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-error-capture-stack-trace.js +146 -0
  130. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-fallback-in-spread.js +66 -0
  131. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-length-check.js +150 -0
  132. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-promise-resolve-reject.js +210 -0
  133. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-spread.js +389 -0
  134. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-switch-case.js +59 -0
  135. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-useless-undefined.js +275 -0
  136. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/no-zero-fractions.js +81 -0
  137. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/number-literal-case.js +82 -0
  138. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/numeric-separators-style.js +189 -0
  139. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-add-event-listener.js +191 -0
  140. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-find.js +458 -0
  141. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat-map.js +86 -0
  142. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-flat.js +279 -0
  143. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-index-of.js +34 -0
  144. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-array-some.js +219 -0
  145. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-at.js +380 -0
  146. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-bigint-literals.js +129 -0
  147. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-blob-reading-methods.js +47 -0
  148. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-class-fields.js +158 -0
  149. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-classlist-toggle.js +255 -0
  150. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-code-point.js +56 -0
  151. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-date-now.js +133 -0
  152. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-default-parameters.js +218 -0
  153. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-append.js +50 -0
  154. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-dataset.js +135 -0
  155. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-remove.js +124 -0
  156. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-dom-node-text-content.js +77 -0
  157. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-event-target.js +119 -0
  158. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-export-from.js +367 -0
  159. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-global-this.js +222 -0
  160. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-import-meta-properties.js +320 -0
  161. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-includes.js +111 -0
  162. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-json-parse-buffer.js +161 -0
  163. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-keyboard-event-key.js +188 -0
  164. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-logical-operator-over-ternary.js +162 -0
  165. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-math-min-max.js +205 -0
  166. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-math-trunc.js +111 -0
  167. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-modern-dom-apis.js +145 -0
  168. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-modern-math-apis.js +210 -0
  169. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-module.js +377 -0
  170. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-native-coercion-functions.js +187 -0
  171. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-negative-index.js +211 -0
  172. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-node-protocol.js +86 -0
  173. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-number-properties.js +142 -0
  174. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-object-from-entries.js +256 -0
  175. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-optional-catch-binding.js +77 -0
  176. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-prototype-methods.js +162 -0
  177. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-query-selector.js +170 -0
  178. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-reflect-apply.js +99 -0
  179. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-regexp-test.js +155 -0
  180. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-response-static-json.js +85 -0
  181. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-set-has.js +181 -0
  182. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-set-size.js +106 -0
  183. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-single-call.js +188 -0
  184. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-spread.js +521 -0
  185. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-raw.js +149 -0
  186. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-replace-all.js +180 -0
  187. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-slice.js +180 -0
  188. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-starts-ends-with.js +201 -0
  189. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-string-trim-start-end.js +46 -0
  190. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-structured-clone.js +149 -0
  191. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-switch.js +357 -0
  192. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-ternary.js +288 -0
  193. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-top-level-await.js +154 -0
  194. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prefer-type-error.js +169 -0
  195. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js +655 -0
  196. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/relative-url-style.js +171 -0
  197. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-array-join-separator.js +65 -0
  198. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-module-attributes.js +120 -0
  199. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-module-specifiers.js +158 -0
  200. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-number-to-fixed-digits-argument.js +55 -0
  201. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/require-post-message-target-origin.js +74 -0
  202. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/get-documentation-url.js +9 -0
  203. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/index.js +9 -0
  204. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-create.js +51 -0
  205. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-listener.js +40 -0
  206. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-problem.js +38 -0
  207. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rule-fixer.js +49 -0
  208. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rule.js +38 -0
  209. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/to-eslint-rules.js +13 -0
  210. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/unicorn-context.js +36 -0
  211. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/unicorn-listeners.js +65 -0
  212. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/rule/utilities.js +27 -0
  213. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/abbreviations.js +270 -0
  214. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/builtin-errors.js +14 -0
  215. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/dom-events.js +275 -0
  216. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/event-keys.js +54 -0
  217. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/negative-index.js +52 -0
  218. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/no-array-mutate-rule.js +139 -0
  219. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/no-unnecessary-length-or-infinity-rule.js +80 -0
  220. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/package-json.js +42 -0
  221. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/simple-array-search-rule.js +126 -0
  222. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/shared/typed-array.js +17 -0
  223. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/string-content.js +192 -0
  224. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/switch-case-braces.js +114 -0
  225. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/template-indent.js +219 -0
  226. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/text-encoding-identifier-case.js +130 -0
  227. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/throw-new-error.js +60 -0
  228. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/array-or-object-prototype-property.js +57 -0
  229. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/assert-token.js +29 -0
  230. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/boolean.js +88 -0
  231. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/builtins.js +30 -0
  232. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/cartesian-product-samples.js +22 -0
  233. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/create-deprecated-rules.js +29 -0
  234. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/escape-string.js +24 -0
  235. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/escape-template-element-raw.js +6 -0
  236. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-ancestor.js +15 -0
  237. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-available-variable-name.js +147 -0
  238. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-builtin-rule.js +5 -0
  239. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-call-expression-arguments-text.js +36 -0
  240. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-call-or-new-expression-tokens.js +67 -0
  241. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-class-head-location.js +22 -0
  242. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-documentation-url.js +9 -0
  243. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-indent-string.js +18 -0
  244. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-references.js +5 -0
  245. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-scopes.js +12 -0
  246. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-sibling-node.js +38 -0
  247. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-switch-case-head-location.js +22 -0
  248. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-token-store.js +24 -0
  249. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/get-variable-identifiers.js +7 -0
  250. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/global-reference-tracker.js +68 -0
  251. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/has-optional-chain-element.js +17 -0
  252. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/has-same-range.js +7 -0
  253. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/index.js +59 -0
  254. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-function-self-used-inside.js +39 -0
  255. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-left-hand-side.js +20 -0
  256. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-logical-expression.js +14 -0
  257. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-method-named.js +7 -0
  258. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-new-expression-with-parentheses.js +28 -0
  259. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-matches.js +58 -0
  260. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-dom-node.js +20 -0
  261. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-node-value-not-function.js +40 -0
  262. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-number.js +224 -0
  263. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-object-method.js +10 -0
  264. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-on-same-line.js +7 -0
  265. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-same-identifier.js +5 -0
  266. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-same-reference.js +170 -0
  267. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-export-local.js +8 -0
  268. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-import-local.js +8 -0
  269. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-assignment-pattern-left.js +8 -0
  270. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-shorthand-property-value.js +6 -0
  271. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-unresolved-variable.js +14 -0
  272. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/is-value-not-usable.js +5 -0
  273. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/needs-semicolon.js +118 -0
  274. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/numeric.js +49 -0
  275. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/parentheses.js +71 -0
  276. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/resolve-variable-name.js +18 -0
  277. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/rule.js +27 -0
  278. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-await-expression-argument.js +17 -0
  279. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-call-expression-callee.js +18 -0
  280. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-conditional-expression-child.js +13 -0
  281. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-expression-statement-expression.js +22 -0
  282. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-logical-expression-child.js +43 -0
  283. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-member-expression-object.js +47 -0
  284. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-new-expression-callee.js +28 -0
  285. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/should-add-parentheses-to-unary-expression.js +24 -0
  286. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/singular.js +16 -0
  287. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/string-cases.js +2 -0
  288. package/packages/config-eslint/node_modules/eslint-plugin-unicorn/rules/utils/to-location.js +25 -0
  289. package/packages/config-eslint/package.json +4 -4
  290. package/packages/config-eslint/plugins/vue.js +6 -0
  291. package/packages/config-eslint/node_modules/@eslint/config-array/README.md +0 -368
  292. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs +0 -1536
  293. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.d.cts +0 -144
  294. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs +0 -1336
  295. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs +0 -1678
  296. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/types.cts +0 -29
  297. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.d.ts +0 -144
  298. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.js +0 -1511
  299. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/posix.js +0 -1314
  300. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/windows.js +0 -1656
  301. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.d.ts +0 -23
  302. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.ts +0 -29
  303. package/packages/config-eslint/node_modules/@eslint/config-array/package.json +0 -65
  304. package/packages/config-eslint/node_modules/@eslint/config-helpers/LICENSE +0 -201
  305. package/packages/config-eslint/node_modules/@eslint/config-helpers/README.md +0 -97
  306. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.cjs +0 -588
  307. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts +0 -26
  308. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/types.cts +0 -29
  309. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.d.ts +0 -26
  310. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.js +0 -586
  311. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.d.ts +0 -23
  312. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.ts +0 -29
  313. package/packages/config-eslint/node_modules/@eslint/config-helpers/package.json +0 -60
  314. package/packages/config-eslint/node_modules/@eslint/js/LICENSE +0 -19
  315. package/packages/config-eslint/node_modules/@eslint/js/README.md +0 -103
  316. package/packages/config-eslint/node_modules/@eslint/js/package.json +0 -44
  317. package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-all.js +0 -210
  318. package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-recommended.js +0 -75
  319. package/packages/config-eslint/node_modules/@eslint/js/src/index.js +0 -23
  320. package/packages/config-eslint/node_modules/@eslint/js/types/index.d.ts +0 -14
  321. package/packages/config-eslint/node_modules/@eslint/object-schema/LICENSE +0 -201
  322. package/packages/config-eslint/node_modules/@eslint/object-schema/README.md +0 -243
  323. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.cjs +0 -459
  324. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.d.cts +0 -127
  325. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/types.cts +0 -57
  326. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.d.ts +0 -127
  327. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.js +0 -456
  328. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.d.ts +0 -40
  329. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.ts +0 -57
  330. package/packages/config-eslint/node_modules/@eslint/object-schema/package.json +0 -62
  331. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +0 -20
  332. package/packages/config-eslint/node_modules/ajv/LICENSE +0 -22
  333. package/packages/config-eslint/node_modules/ajv/README.md +0 -1497
  334. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +0 -7189
  335. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +0 -3
  336. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +0 -1
  337. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +0 -397
  338. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +0 -506
  339. package/packages/config-eslint/node_modules/ajv/lib/cache.js +0 -26
  340. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +0 -90
  341. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +0 -5
  342. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +0 -34
  343. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +0 -142
  344. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +0 -387
  345. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +0 -270
  346. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +0 -66
  347. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +0 -9
  348. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +0 -20
  349. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +0 -239
  350. package/packages/config-eslint/node_modules/ajv/lib/data.js +0 -49
  351. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +0 -37
  352. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +0 -113
  353. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +0 -12
  354. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +0 -12
  355. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +0 -12
  356. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +0 -32
  357. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +0 -46
  358. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +0 -51
  359. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +0 -9
  360. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +0 -11
  361. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +0 -55
  362. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +0 -191
  363. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +0 -47
  364. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +0 -203
  365. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +0 -79
  366. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +0 -30
  367. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +0 -194
  368. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +0 -106
  369. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +0 -73
  370. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +0 -98
  371. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +0 -39
  372. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +0 -22
  373. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +0 -43
  374. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +0 -54
  375. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +0 -14
  376. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +0 -245
  377. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +0 -52
  378. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +0 -85
  379. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +0 -108
  380. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +0 -62
  381. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +0 -276
  382. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +0 -3
  383. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +0 -163
  384. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +0 -80
  385. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +0 -85
  386. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -80
  387. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +0 -42
  388. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +0 -73
  389. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +0 -14
  390. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +0 -56
  391. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +0 -81
  392. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +0 -228
  393. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +0 -168
  394. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +0 -66
  395. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +0 -150
  396. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +0 -103
  397. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +0 -33
  398. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +0 -140
  399. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +0 -80
  400. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +0 -84
  401. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +0 -73
  402. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +0 -75
  403. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +0 -335
  404. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +0 -81
  405. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +0 -124
  406. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +0 -270
  407. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -86
  408. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +0 -482
  409. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +0 -146
  410. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +0 -17
  411. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +0 -149
  412. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +0 -154
  413. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +0 -168
  414. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +0 -94
  415. package/packages/config-eslint/node_modules/ajv/package.json +0 -106
  416. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +0 -3
  417. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +0 -61
  418. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +0 -73
  419. package/packages/config-eslint/node_modules/ajv/scripts/info +0 -10
  420. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +0 -12
  421. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +0 -32
  422. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +0 -23
  423. package/packages/config-eslint/node_modules/eslint/LICENSE +0 -19
  424. package/packages/config-eslint/node_modules/eslint/README.md +0 -363
  425. package/packages/config-eslint/node_modules/eslint/bin/eslint.js +0 -195
  426. package/packages/config-eslint/node_modules/eslint/conf/ecma-version.js +0 -16
  427. package/packages/config-eslint/node_modules/eslint/conf/globals.js +0 -169
  428. package/packages/config-eslint/node_modules/eslint/conf/replacements.json +0 -26
  429. package/packages/config-eslint/node_modules/eslint/conf/rule-type-list.json +0 -91
  430. package/packages/config-eslint/node_modules/eslint/lib/api.js +0 -39
  431. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json +0 -18
  432. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/html.js +0 -359
  433. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +0 -16
  434. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json.js +0 -13
  435. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/stylish.js +0 -153
  436. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/hash.js +0 -35
  437. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/lint-result-cache.js +0 -220
  438. package/packages/config-eslint/node_modules/eslint/lib/cli.js +0 -521
  439. package/packages/config-eslint/node_modules/eslint/lib/config/config-loader.js +0 -668
  440. package/packages/config-eslint/node_modules/eslint/lib/config/config.js +0 -674
  441. package/packages/config-eslint/node_modules/eslint/lib/config/default-config.js +0 -78
  442. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-array.js +0 -217
  443. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-schema.js +0 -598
  444. package/packages/config-eslint/node_modules/eslint/lib/config-api.js +0 -12
  445. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint-helpers.js +0 -1462
  446. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint.js +0 -1364
  447. package/packages/config-eslint/node_modules/eslint/lib/eslint/index.js +0 -7
  448. package/packages/config-eslint/node_modules/eslint/lib/eslint/worker.js +0 -173
  449. package/packages/config-eslint/node_modules/eslint/lib/languages/js/index.js +0 -336
  450. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/index.js +0 -7
  451. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js +0 -1178
  452. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +0 -61
  453. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js +0 -57
  454. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js +0 -76
  455. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js +0 -120
  456. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js +0 -38
  457. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js +0 -42
  458. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +0 -65
  459. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js +0 -62
  460. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/index.js +0 -695
  461. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js +0 -39
  462. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js +0 -45
  463. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js +0 -41
  464. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js +0 -131
  465. package/packages/config-eslint/node_modules/eslint/lib/languages/js/validate-language-options.js +0 -196
  466. package/packages/config-eslint/node_modules/eslint/lib/linter/apply-disable-directives.js +0 -583
  467. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +0 -828
  468. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +0 -262
  469. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +0 -2370
  470. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +0 -332
  471. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +0 -223
  472. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +0 -374
  473. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +0 -44
  474. package/packages/config-eslint/node_modules/eslint/lib/linter/esquery.js +0 -332
  475. package/packages/config-eslint/node_modules/eslint/lib/linter/file-context.js +0 -88
  476. package/packages/config-eslint/node_modules/eslint/lib/linter/file-report.js +0 -604
  477. package/packages/config-eslint/node_modules/eslint/lib/linter/index.js +0 -11
  478. package/packages/config-eslint/node_modules/eslint/lib/linter/interpolate.js +0 -50
  479. package/packages/config-eslint/node_modules/eslint/lib/linter/linter.js +0 -1614
  480. package/packages/config-eslint/node_modules/eslint/lib/linter/rule-fixer.js +0 -199
  481. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-fixer.js +0 -154
  482. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-traverser.js +0 -333
  483. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-visitor.js +0 -81
  484. package/packages/config-eslint/node_modules/eslint/lib/linter/timing.js +0 -209
  485. package/packages/config-eslint/node_modules/eslint/lib/linter/vfile.js +0 -115
  486. package/packages/config-eslint/node_modules/eslint/lib/options.js +0 -416
  487. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/index.js +0 -7
  488. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/rule-tester.js +0 -1996
  489. package/packages/config-eslint/node_modules/eslint/lib/rules/accessor-pairs.js +0 -420
  490. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-newline.js +0 -291
  491. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-spacing.js +0 -301
  492. package/packages/config-eslint/node_modules/eslint/lib/rules/array-callback-return.js +0 -510
  493. package/packages/config-eslint/node_modules/eslint/lib/rules/array-element-newline.js +0 -374
  494. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-body-style.js +0 -418
  495. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-parens.js +0 -237
  496. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-spacing.js +0 -188
  497. package/packages/config-eslint/node_modules/eslint/lib/rules/block-scoped-var.js +0 -137
  498. package/packages/config-eslint/node_modules/eslint/lib/rules/block-spacing.js +0 -202
  499. package/packages/config-eslint/node_modules/eslint/lib/rules/brace-style.js +0 -278
  500. package/packages/config-eslint/node_modules/eslint/lib/rules/callback-return.js +0 -216
  501. package/packages/config-eslint/node_modules/eslint/lib/rules/camelcase.js +0 -422
  502. package/packages/config-eslint/node_modules/eslint/lib/rules/capitalized-comments.js +0 -325
  503. package/packages/config-eslint/node_modules/eslint/lib/rules/class-methods-use-this.js +0 -250
  504. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-dangle.js +0 -424
  505. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-spacing.js +0 -205
  506. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-style.js +0 -391
  507. package/packages/config-eslint/node_modules/eslint/lib/rules/complexity.js +0 -201
  508. package/packages/config-eslint/node_modules/eslint/lib/rules/computed-property-spacing.js +0 -251
  509. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-return.js +0 -221
  510. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-this.js +0 -179
  511. package/packages/config-eslint/node_modules/eslint/lib/rules/constructor-super.js +0 -453
  512. package/packages/config-eslint/node_modules/eslint/lib/rules/curly.js +0 -425
  513. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case-last.js +0 -51
  514. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case.js +0 -103
  515. package/packages/config-eslint/node_modules/eslint/lib/rules/default-param-last.js +0 -78
  516. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-location.js +0 -138
  517. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-notation.js +0 -216
  518. package/packages/config-eslint/node_modules/eslint/lib/rules/eol-last.js +0 -135
  519. package/packages/config-eslint/node_modules/eslint/lib/rules/eqeqeq.js +0 -210
  520. package/packages/config-eslint/node_modules/eslint/lib/rules/for-direction.js +0 -168
  521. package/packages/config-eslint/node_modules/eslint/lib/rules/func-call-spacing.js +0 -281
  522. package/packages/config-eslint/node_modules/eslint/lib/rules/func-name-matching.js +0 -338
  523. package/packages/config-eslint/node_modules/eslint/lib/rules/func-names.js +0 -194
  524. package/packages/config-eslint/node_modules/eslint/lib/rules/func-style.js +0 -221
  525. package/packages/config-eslint/node_modules/eslint/lib/rules/function-call-argument-newline.js +0 -166
  526. package/packages/config-eslint/node_modules/eslint/lib/rules/function-paren-newline.js +0 -368
  527. package/packages/config-eslint/node_modules/eslint/lib/rules/generator-star-spacing.js +0 -246
  528. package/packages/config-eslint/node_modules/eslint/lib/rules/getter-return.js +0 -242
  529. package/packages/config-eslint/node_modules/eslint/lib/rules/global-require.js +0 -117
  530. package/packages/config-eslint/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +0 -268
  531. package/packages/config-eslint/node_modules/eslint/lib/rules/guard-for-in.js +0 -85
  532. package/packages/config-eslint/node_modules/eslint/lib/rules/handle-callback-err.js +0 -122
  533. package/packages/config-eslint/node_modules/eslint/lib/rules/id-blacklist.js +0 -241
  534. package/packages/config-eslint/node_modules/eslint/lib/rules/id-denylist.js +0 -223
  535. package/packages/config-eslint/node_modules/eslint/lib/rules/id-length.js +0 -217
  536. package/packages/config-eslint/node_modules/eslint/lib/rules/id-match.js +0 -363
  537. package/packages/config-eslint/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +0 -125
  538. package/packages/config-eslint/node_modules/eslint/lib/rules/indent-legacy.js +0 -1369
  539. package/packages/config-eslint/node_modules/eslint/lib/rules/indent.js +0 -2334
  540. package/packages/config-eslint/node_modules/eslint/lib/rules/index.js +0 -332
  541. package/packages/config-eslint/node_modules/eslint/lib/rules/init-declarations.js +0 -172
  542. package/packages/config-eslint/node_modules/eslint/lib/rules/jsx-quotes.js +0 -128
  543. package/packages/config-eslint/node_modules/eslint/lib/rules/key-spacing.js +0 -822
  544. package/packages/config-eslint/node_modules/eslint/lib/rules/keyword-spacing.js +0 -701
  545. package/packages/config-eslint/node_modules/eslint/lib/rules/line-comment-position.js +0 -157
  546. package/packages/config-eslint/node_modules/eslint/lib/rules/linebreak-style.js +0 -135
  547. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-comment.js +0 -581
  548. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-directive.js +0 -249
  549. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-between-class-members.js +0 -358
  550. package/packages/config-eslint/node_modules/eslint/lib/rules/logical-assignment-operators.js +0 -688
  551. package/packages/config-eslint/node_modules/eslint/lib/rules/max-classes-per-file.js +0 -90
  552. package/packages/config-eslint/node_modules/eslint/lib/rules/max-depth.js +0 -159
  553. package/packages/config-eslint/node_modules/eslint/lib/rules/max-len.js +0 -497
  554. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines-per-function.js +0 -238
  555. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines.js +0 -189
  556. package/packages/config-eslint/node_modules/eslint/lib/rules/max-nested-callbacks.js +0 -115
  557. package/packages/config-eslint/node_modules/eslint/lib/rules/max-params.js +0 -148
  558. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements-per-line.js +0 -224
  559. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements.js +0 -188
  560. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-comment-style.js +0 -652
  561. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-ternary.js +0 -257
  562. package/packages/config-eslint/node_modules/eslint/lib/rules/new-cap.js +0 -277
  563. package/packages/config-eslint/node_modules/eslint/lib/rules/new-parens.js +0 -120
  564. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-after-var.js +0 -307
  565. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-before-return.js +0 -242
  566. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-per-chained-call.js +0 -159
  567. package/packages/config-eslint/node_modules/eslint/lib/rules/no-alert.js +0 -149
  568. package/packages/config-eslint/node_modules/eslint/lib/rules/no-array-constructor.js +0 -195
  569. package/packages/config-eslint/node_modules/eslint/lib/rules/no-async-promise-executor.js +0 -45
  570. package/packages/config-eslint/node_modules/eslint/lib/rules/no-await-in-loop.js +0 -115
  571. package/packages/config-eslint/node_modules/eslint/lib/rules/no-bitwise.js +0 -145
  572. package/packages/config-eslint/node_modules/eslint/lib/rules/no-buffer-constructor.js +0 -74
  573. package/packages/config-eslint/node_modules/eslint/lib/rules/no-caller.js +0 -52
  574. package/packages/config-eslint/node_modules/eslint/lib/rules/no-case-declarations.js +0 -80
  575. package/packages/config-eslint/node_modules/eslint/lib/rules/no-catch-shadow.js +0 -96
  576. package/packages/config-eslint/node_modules/eslint/lib/rules/no-class-assign.js +0 -66
  577. package/packages/config-eslint/node_modules/eslint/lib/rules/no-compare-neg-zero.js +0 -74
  578. package/packages/config-eslint/node_modules/eslint/lib/rules/no-cond-assign.js +0 -175
  579. package/packages/config-eslint/node_modules/eslint/lib/rules/no-confusing-arrow.js +0 -127
  580. package/packages/config-eslint/node_modules/eslint/lib/rules/no-console.js +0 -221
  581. package/packages/config-eslint/node_modules/eslint/lib/rules/no-const-assign.js +0 -73
  582. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-binary-expression.js +0 -603
  583. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-condition.js +0 -177
  584. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constructor-return.js +0 -62
  585. package/packages/config-eslint/node_modules/eslint/lib/rules/no-continue.js +0 -38
  586. package/packages/config-eslint/node_modules/eslint/lib/rules/no-control-regex.js +0 -142
  587. package/packages/config-eslint/node_modules/eslint/lib/rules/no-debugger.js +0 -41
  588. package/packages/config-eslint/node_modules/eslint/lib/rules/no-delete-var.js +0 -42
  589. package/packages/config-eslint/node_modules/eslint/lib/rules/no-div-regex.js +0 -60
  590. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-args.js +0 -92
  591. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-class-members.js +0 -117
  592. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-else-if.js +0 -145
  593. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-keys.js +0 -165
  594. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-case.js +0 -78
  595. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-imports.js +0 -368
  596. package/packages/config-eslint/node_modules/eslint/lib/rules/no-else-return.js +0 -450
  597. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-character-class.js +0 -83
  598. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-function.js +0 -236
  599. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-pattern.js +0 -85
  600. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-static-block.js +0 -73
  601. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty.js +0 -153
  602. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eq-null.js +0 -51
  603. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eval.js +0 -295
  604. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ex-assign.js +0 -57
  605. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extend-native.js +0 -180
  606. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-bind.js +0 -224
  607. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +0 -420
  608. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-label.js +0 -169
  609. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-parens.js +0 -1669
  610. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-semi.js +0 -167
  611. package/packages/config-eslint/node_modules/eslint/lib/rules/no-fallthrough.js +0 -260
  612. package/packages/config-eslint/node_modules/eslint/lib/rules/no-floating-decimal.js +0 -99
  613. package/packages/config-eslint/node_modules/eslint/lib/rules/no-func-assign.js +0 -77
  614. package/packages/config-eslint/node_modules/eslint/lib/rules/no-global-assign.js +0 -101
  615. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-coercion.js +0 -468
  616. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-globals.js +0 -187
  617. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implied-eval.js +0 -171
  618. package/packages/config-eslint/node_modules/eslint/lib/rules/no-import-assign.js +0 -227
  619. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inline-comments.js +0 -115
  620. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inner-declarations.js +0 -147
  621. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-regexp.js +0 -244
  622. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-this.js +0 -178
  623. package/packages/config-eslint/node_modules/eslint/lib/rules/no-irregular-whitespace.js +0 -292
  624. package/packages/config-eslint/node_modules/eslint/lib/rules/no-iterator.js +0 -48
  625. package/packages/config-eslint/node_modules/eslint/lib/rules/no-label-var.js +0 -78
  626. package/packages/config-eslint/node_modules/eslint/lib/rules/no-labels.js +0 -156
  627. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lone-blocks.js +0 -140
  628. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lonely-if.js +0 -126
  629. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loop-func.js +0 -267
  630. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loss-of-precision.js +0 -249
  631. package/packages/config-eslint/node_modules/eslint/lib/rules/no-magic-numbers.js +0 -365
  632. package/packages/config-eslint/node_modules/eslint/lib/rules/no-misleading-character-class.js +0 -595
  633. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-operators.js +0 -253
  634. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-requires.js +0 -267
  635. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +0 -148
  636. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-assign.js +0 -66
  637. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-spaces.js +0 -179
  638. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-str.js +0 -67
  639. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +0 -210
  640. package/packages/config-eslint/node_modules/eslint/lib/rules/no-native-reassign.js +0 -114
  641. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-condition.js +0 -100
  642. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-in-lhs.js +0 -59
  643. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nested-ternary.js +0 -46
  644. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-func.js +0 -96
  645. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +0 -70
  646. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-object.js +0 -76
  647. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-require.js +0 -67
  648. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-symbol.js +0 -74
  649. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-wrappers.js +0 -62
  650. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new.js +0 -42
  651. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +0 -176
  652. package/packages/config-eslint/node_modules/eslint/lib/rules/no-obj-calls.js +0 -99
  653. package/packages/config-eslint/node_modules/eslint/lib/rules/no-object-constructor.js +0 -124
  654. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal-escape.js +0 -53
  655. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal.js +0 -42
  656. package/packages/config-eslint/node_modules/eslint/lib/rules/no-param-reassign.js +0 -248
  657. package/packages/config-eslint/node_modules/eslint/lib/rules/no-path-concat.js +0 -79
  658. package/packages/config-eslint/node_modules/eslint/lib/rules/no-plusplus.js +0 -102
  659. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-env.js +0 -68
  660. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-exit.js +0 -67
  661. package/packages/config-eslint/node_modules/eslint/lib/rules/no-promise-executor-return.js +0 -264
  662. package/packages/config-eslint/node_modules/eslint/lib/rules/no-proto.js +0 -45
  663. package/packages/config-eslint/node_modules/eslint/lib/rules/no-prototype-builtins.js +0 -181
  664. package/packages/config-eslint/node_modules/eslint/lib/rules/no-redeclare.js +0 -173
  665. package/packages/config-eslint/node_modules/eslint/lib/rules/no-regex-spaces.js +0 -219
  666. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-exports.js +0 -227
  667. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-globals.js +0 -266
  668. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-imports.js +0 -892
  669. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-modules.js +0 -249
  670. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-properties.js +0 -233
  671. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-syntax.js +0 -74
  672. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-assign.js +0 -87
  673. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-await.js +0 -162
  674. package/packages/config-eslint/node_modules/eslint/lib/rules/no-script-url.js +0 -68
  675. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-assign.js +0 -186
  676. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-compare.js +0 -77
  677. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sequences.js +0 -158
  678. package/packages/config-eslint/node_modules/eslint/lib/rules/no-setter-return.js +0 -224
  679. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +0 -113
  680. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow.js +0 -689
  681. package/packages/config-eslint/node_modules/eslint/lib/rules/no-spaced-func.js +0 -105
  682. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sparse-arrays.js +0 -68
  683. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sync.js +0 -81
  684. package/packages/config-eslint/node_modules/eslint/lib/rules/no-tabs.js +0 -110
  685. package/packages/config-eslint/node_modules/eslint/lib/rules/no-template-curly-in-string.js +0 -45
  686. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ternary.js +0 -38
  687. package/packages/config-eslint/node_modules/eslint/lib/rules/no-this-before-super.js +0 -365
  688. package/packages/config-eslint/node_modules/eslint/lib/rules/no-throw-literal.js +0 -46
  689. package/packages/config-eslint/node_modules/eslint/lib/rules/no-trailing-spaces.js +0 -227
  690. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unassigned-vars.js +0 -80
  691. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef-init.js +0 -101
  692. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef.js +0 -84
  693. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undefined.js +0 -85
  694. package/packages/config-eslint/node_modules/eslint/lib/rules/no-underscore-dangle.js +0 -383
  695. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unexpected-multiline.js +0 -130
  696. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +0 -360
  697. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unneeded-ternary.js +0 -232
  698. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable-loop.js +0 -190
  699. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable.js +0 -300
  700. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-finally.js +0 -119
  701. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-negation.js +0 -152
  702. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +0 -221
  703. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-expressions.js +0 -227
  704. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-labels.js +0 -158
  705. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-private-class-members.js +0 -219
  706. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-vars.js +0 -1739
  707. package/packages/config-eslint/node_modules/eslint/lib/rules/no-use-before-define.js +0 -446
  708. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-assignment.js +0 -657
  709. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-backreference.js +0 -263
  710. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-call.js +0 -95
  711. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-catch.js +0 -57
  712. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-computed-key.js +0 -204
  713. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-concat.js +0 -121
  714. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-constructor.js +0 -262
  715. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-escape.js +0 -406
  716. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-rename.js +0 -202
  717. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-return.js +0 -401
  718. package/packages/config-eslint/node_modules/eslint/lib/rules/no-var.js +0 -367
  719. package/packages/config-eslint/node_modules/eslint/lib/rules/no-void.js +0 -69
  720. package/packages/config-eslint/node_modules/eslint/lib/rules/no-warning-comments.js +0 -209
  721. package/packages/config-eslint/node_modules/eslint/lib/rules/no-whitespace-before-property.js +0 -150
  722. package/packages/config-eslint/node_modules/eslint/lib/rules/no-with.js +0 -37
  723. package/packages/config-eslint/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +0 -164
  724. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-newline.js +0 -383
  725. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-spacing.js +0 -369
  726. package/packages/config-eslint/node_modules/eslint/lib/rules/object-property-newline.js +0 -151
  727. package/packages/config-eslint/node_modules/eslint/lib/rules/object-shorthand.js +0 -652
  728. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +0 -117
  729. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var.js +0 -717
  730. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-assignment.js +0 -270
  731. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-linebreak.js +0 -315
  732. package/packages/config-eslint/node_modules/eslint/lib/rules/padded-blocks.js +0 -366
  733. package/packages/config-eslint/node_modules/eslint/lib/rules/padding-line-between-statements.js +0 -612
  734. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-arrow-callback.js +0 -437
  735. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-const.js +0 -546
  736. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-destructuring.js +0 -332
  737. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +0 -235
  738. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-named-capture-group.js +0 -197
  739. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-numeric-literals.js +0 -157
  740. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-has-own.js +0 -148
  741. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-spread.js +0 -319
  742. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +0 -154
  743. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-reflect.js +0 -150
  744. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-regex-literals.js +0 -605
  745. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-rest-params.js +0 -117
  746. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-spread.js +0 -91
  747. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-template.js +0 -347
  748. package/packages/config-eslint/node_modules/eslint/lib/rules/preserve-caught-error.js +0 -535
  749. package/packages/config-eslint/node_modules/eslint/lib/rules/quote-props.js +0 -394
  750. package/packages/config-eslint/node_modules/eslint/lib/rules/quotes.js +0 -416
  751. package/packages/config-eslint/node_modules/eslint/lib/rules/radix.js +0 -193
  752. package/packages/config-eslint/node_modules/eslint/lib/rules/require-atomic-updates.js +0 -365
  753. package/packages/config-eslint/node_modules/eslint/lib/rules/require-await.js +0 -184
  754. package/packages/config-eslint/node_modules/eslint/lib/rules/require-unicode-regexp.js +0 -317
  755. package/packages/config-eslint/node_modules/eslint/lib/rules/require-yield.js +0 -86
  756. package/packages/config-eslint/node_modules/eslint/lib/rules/rest-spread-spacing.js +0 -150
  757. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-spacing.js +0 -297
  758. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-style.js +0 -218
  759. package/packages/config-eslint/node_modules/eslint/lib/rules/semi.js +0 -476
  760. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-imports.js +0 -319
  761. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-keys.js +0 -268
  762. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-vars.js +0 -140
  763. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-blocks.js +0 -232
  764. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-function-paren.js +0 -202
  765. package/packages/config-eslint/node_modules/eslint/lib/rules/space-in-parens.js +0 -374
  766. package/packages/config-eslint/node_modules/eslint/lib/rules/space-infix-ops.js +0 -249
  767. package/packages/config-eslint/node_modules/eslint/lib/rules/space-unary-ops.js +0 -400
  768. package/packages/config-eslint/node_modules/eslint/lib/rules/spaced-comment.js +0 -447
  769. package/packages/config-eslint/node_modules/eslint/lib/rules/strict.js +0 -324
  770. package/packages/config-eslint/node_modules/eslint/lib/rules/switch-colon-spacing.js +0 -158
  771. package/packages/config-eslint/node_modules/eslint/lib/rules/symbol-description.js +0 -70
  772. package/packages/config-eslint/node_modules/eslint/lib/rules/template-curly-spacing.js +0 -168
  773. package/packages/config-eslint/node_modules/eslint/lib/rules/template-tag-spacing.js +0 -121
  774. package/packages/config-eslint/node_modules/eslint/lib/rules/unicode-bom.js +0 -73
  775. package/packages/config-eslint/node_modules/eslint/lib/rules/use-isnan.js +0 -268
  776. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/ast-utils.js +0 -2841
  777. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/char-source.js +0 -247
  778. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/fix-tracker.js +0 -125
  779. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/keywords.js +0 -67
  780. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +0 -118
  781. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/regular-expressions.js +0 -58
  782. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/index.js +0 -16
  783. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +0 -13
  784. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +0 -13
  785. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +0 -13
  786. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +0 -14
  787. package/packages/config-eslint/node_modules/eslint/lib/rules/valid-typeof.js +0 -171
  788. package/packages/config-eslint/node_modules/eslint/lib/rules/vars-on-top.js +0 -165
  789. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-iife.js +0 -238
  790. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-regex.js +0 -91
  791. package/packages/config-eslint/node_modules/eslint/lib/rules/yield-star-spacing.js +0 -158
  792. package/packages/config-eslint/node_modules/eslint/lib/rules/yoda.js +0 -362
  793. package/packages/config-eslint/node_modules/eslint/lib/services/parser-service.js +0 -64
  794. package/packages/config-eslint/node_modules/eslint/lib/services/processor-service.js +0 -100
  795. package/packages/config-eslint/node_modules/eslint/lib/services/suppressions-service.js +0 -302
  796. package/packages/config-eslint/node_modules/eslint/lib/services/warning-service.js +0 -87
  797. package/packages/config-eslint/node_modules/eslint/lib/shared/ajv.js +0 -34
  798. package/packages/config-eslint/node_modules/eslint/lib/shared/assert.js +0 -21
  799. package/packages/config-eslint/node_modules/eslint/lib/shared/ast-utils.js +0 -30
  800. package/packages/config-eslint/node_modules/eslint/lib/shared/deep-merge-arrays.js +0 -62
  801. package/packages/config-eslint/node_modules/eslint/lib/shared/directives.js +0 -16
  802. package/packages/config-eslint/node_modules/eslint/lib/shared/flags.js +0 -89
  803. package/packages/config-eslint/node_modules/eslint/lib/shared/logging.js +0 -38
  804. package/packages/config-eslint/node_modules/eslint/lib/shared/naming.js +0 -109
  805. package/packages/config-eslint/node_modules/eslint/lib/shared/option-utils.js +0 -63
  806. package/packages/config-eslint/node_modules/eslint/lib/shared/relative-module-resolver.js +0 -28
  807. package/packages/config-eslint/node_modules/eslint/lib/shared/runtime-info.js +0 -177
  808. package/packages/config-eslint/node_modules/eslint/lib/shared/serialization.js +0 -78
  809. package/packages/config-eslint/node_modules/eslint/lib/shared/severity.js +0 -49
  810. package/packages/config-eslint/node_modules/eslint/lib/shared/stats.js +0 -30
  811. package/packages/config-eslint/node_modules/eslint/lib/shared/string-utils.js +0 -58
  812. package/packages/config-eslint/node_modules/eslint/lib/shared/text-table.js +0 -68
  813. package/packages/config-eslint/node_modules/eslint/lib/shared/translate-cli-options.js +0 -223
  814. package/packages/config-eslint/node_modules/eslint/lib/shared/traverser.js +0 -202
  815. package/packages/config-eslint/node_modules/eslint/lib/types/config-api.d.ts +0 -12
  816. package/packages/config-eslint/node_modules/eslint/lib/types/index.d.ts +0 -1475
  817. package/packages/config-eslint/node_modules/eslint/lib/types/rules.d.ts +0 -5603
  818. package/packages/config-eslint/node_modules/eslint/lib/types/universal.d.ts +0 -6
  819. package/packages/config-eslint/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +0 -34
  820. package/packages/config-eslint/node_modules/eslint/lib/universal.js +0 -10
  821. package/packages/config-eslint/node_modules/eslint/lib/unsupported-api.js +0 -21
  822. package/packages/config-eslint/node_modules/eslint/messages/all-files-ignored.js +0 -16
  823. package/packages/config-eslint/node_modules/eslint/messages/all-matched-files-ignored.js +0 -21
  824. package/packages/config-eslint/node_modules/eslint/messages/config-file-missing.js +0 -16
  825. package/packages/config-eslint/node_modules/eslint/messages/config-plugin-missing.js +0 -14
  826. package/packages/config-eslint/node_modules/eslint/messages/config-serialize-function.js +0 -30
  827. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-incompat.js +0 -117
  828. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-plugins.js +0 -27
  829. package/packages/config-eslint/node_modules/eslint/messages/extend-config-missing.js +0 -13
  830. package/packages/config-eslint/node_modules/eslint/messages/failed-to-read-json.js +0 -11
  831. package/packages/config-eslint/node_modules/eslint/messages/file-not-found.js +0 -10
  832. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-options.js +0 -17
  833. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-severity.js +0 -13
  834. package/packages/config-eslint/node_modules/eslint/messages/no-config-found.js +0 -15
  835. package/packages/config-eslint/node_modules/eslint/messages/plugin-conflict.js +0 -22
  836. package/packages/config-eslint/node_modules/eslint/messages/plugin-invalid.js +0 -16
  837. package/packages/config-eslint/node_modules/eslint/messages/plugin-missing.js +0 -19
  838. package/packages/config-eslint/node_modules/eslint/messages/print-config-with-directory-path.js +0 -8
  839. package/packages/config-eslint/node_modules/eslint/messages/shared.js +0 -23
  840. package/packages/config-eslint/node_modules/eslint/messages/whitespace-found.js +0 -11
  841. package/packages/config-eslint/node_modules/eslint/package.json +0 -220
  842. package/packages/config-eslint/node_modules/eslint-scope/LICENSE +0 -22
  843. package/packages/config-eslint/node_modules/eslint-scope/README.md +0 -206
  844. package/packages/config-eslint/node_modules/eslint-scope/dist/eslint-scope.cjs +0 -2420
  845. package/packages/config-eslint/node_modules/eslint-scope/lib/assert.js +0 -17
  846. package/packages/config-eslint/node_modules/eslint-scope/lib/definition.js +0 -89
  847. package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.cts +0 -1069
  848. package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.ts +0 -6
  849. package/packages/config-eslint/node_modules/eslint-scope/lib/index.js +0 -170
  850. package/packages/config-eslint/node_modules/eslint-scope/lib/pattern-visitor.js +0 -157
  851. package/packages/config-eslint/node_modules/eslint-scope/lib/reference.js +0 -165
  852. package/packages/config-eslint/node_modules/eslint-scope/lib/referencer.js +0 -712
  853. package/packages/config-eslint/node_modules/eslint-scope/lib/scope-manager.js +0 -271
  854. package/packages/config-eslint/node_modules/eslint-scope/lib/scope.js +0 -839
  855. package/packages/config-eslint/node_modules/eslint-scope/lib/variable.js +0 -91
  856. package/packages/config-eslint/node_modules/eslint-scope/package.json +0 -69
  857. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +0 -201
  858. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +0 -121
  859. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +0 -396
  860. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +0 -28
  861. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +0 -16
  862. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +0 -12
  863. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +0 -67
  864. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +0 -327
  865. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +0 -59
  866. package/packages/config-eslint/node_modules/espree/LICENSE +0 -25
  867. package/packages/config-eslint/node_modules/espree/README.md +0 -262
  868. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +0 -1272
  869. package/packages/config-eslint/node_modules/espree/dist/espree.d.cts +0 -3
  870. package/packages/config-eslint/node_modules/espree/dist/espree.d.cts.map +0 -1
  871. package/packages/config-eslint/node_modules/espree/dist/espree.d.ts +0 -71
  872. package/packages/config-eslint/node_modules/espree/dist/espree.d.ts.map +0 -1
  873. package/packages/config-eslint/node_modules/espree/espree.js +0 -291
  874. package/packages/config-eslint/node_modules/espree/lib/espree.js +0 -482
  875. package/packages/config-eslint/node_modules/espree/lib/features.js +0 -21
  876. package/packages/config-eslint/node_modules/espree/lib/options.js +0 -164
  877. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +0 -306
  878. package/packages/config-eslint/node_modules/espree/lib/types.js +0 -118
  879. package/packages/config-eslint/node_modules/espree/package.json +0 -72
  880. package/packages/config-eslint/node_modules/ignore/LICENSE-MIT +0 -21
  881. package/packages/config-eslint/node_modules/ignore/README.md +0 -412
  882. package/packages/config-eslint/node_modules/ignore/index.d.ts +0 -61
  883. package/packages/config-eslint/node_modules/ignore/index.js +0 -636
  884. package/packages/config-eslint/node_modules/ignore/legacy.js +0 -559
  885. package/packages/config-eslint/node_modules/ignore/package.json +0 -74
  886. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +0 -27
  887. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +0 -8
  888. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +0 -21
  889. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +0 -83
  890. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +0 -89
  891. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +0 -43
  892. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +0 -6
  893. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +0 -125
  894. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +0 -171
  895. package/packages/config-eslint/node_modules/minimatch/LICENSE.md +0 -55
  896. package/packages/config-eslint/node_modules/minimatch/README.md +0 -453
  897. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +0 -2
  898. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +0 -1
  899. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +0 -14
  900. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +0 -1
  901. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -20
  902. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts.map +0 -1
  903. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js +0 -591
  904. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js.map +0 -1
  905. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
  906. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +0 -1
  907. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -152
  908. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +0 -1
  909. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts +0 -15
  910. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts.map +0 -1
  911. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js +0 -30
  912. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js.map +0 -1
  913. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts +0 -94
  914. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts.map +0 -1
  915. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js +0 -1029
  916. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js.map +0 -1
  917. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/package.json +0 -3
  918. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts +0 -22
  919. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +0 -1
  920. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js +0 -38
  921. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js.map +0 -1
  922. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +0 -2
  923. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +0 -1
  924. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js +0 -10
  925. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +0 -1
  926. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts +0 -20
  927. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts.map +0 -1
  928. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js +0 -587
  929. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js.map +0 -1
  930. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
  931. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +0 -1
  932. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js +0 -148
  933. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js.map +0 -1
  934. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts +0 -15
  935. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts.map +0 -1
  936. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js +0 -26
  937. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js.map +0 -1
  938. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts +0 -94
  939. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts.map +0 -1
  940. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js +0 -1016
  941. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js.map +0 -1
  942. package/packages/config-eslint/node_modules/minimatch/dist/esm/package.json +0 -3
  943. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts +0 -22
  944. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts.map +0 -1
  945. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js +0 -34
  946. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js.map +0 -1
  947. package/packages/config-eslint/node_modules/minimatch/package.json +0 -67
  948. /package/packages/config-eslint/node_modules/@eslint/{config-array → core}/LICENSE +0 -0
@@ -1,2841 +0,0 @@
1
- /**
2
- * @fileoverview Common utils for AST.
3
- * @author Gyandeep Singh
4
- */
5
-
6
- "use strict";
7
-
8
- //------------------------------------------------------------------------------
9
- // Requirements
10
- //------------------------------------------------------------------------------
11
-
12
- const { KEYS: eslintVisitorKeys } = require("eslint-visitor-keys");
13
- const esutils = require("esutils");
14
- const espree = require("espree");
15
- const escapeRegExp = require("escape-string-regexp");
16
- const {
17
- breakableTypePattern,
18
- createGlobalLinebreakMatcher,
19
- lineBreakPattern,
20
- shebangPattern,
21
- } = require("../../shared/ast-utils");
22
- const globals = require("../../../conf/globals");
23
- const { LATEST_ECMA_VERSION } = require("../../../conf/ecma-version");
24
-
25
- //------------------------------------------------------------------------------
26
- // Helpers
27
- //------------------------------------------------------------------------------
28
-
29
- const anyFunctionPattern =
30
- /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u;
31
- const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/u;
32
- const arrayMethodWithThisArgPattern =
33
- /^(?:every|filter|find(?:Last)?(?:Index)?|flatMap|forEach|map|some)$/u;
34
- const arrayOrTypedArrayPattern = /Array$/u;
35
- const bindOrCallOrApplyPattern = /^(?:bind|call|apply)$/u;
36
- const thisTagPattern = /^[\s*]*@this/mu;
37
-
38
- const COMMENTS_IGNORE_PATTERN =
39
- /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u;
40
- const ESLINT_DIRECTIVE_PATTERN = /^(?:eslint[- ]|(?:globals?|exported) )/u;
41
- const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
42
-
43
- // A set of node types that can contain a list of statements
44
- const STATEMENT_LIST_PARENTS = new Set([
45
- "Program",
46
- "BlockStatement",
47
- "StaticBlock",
48
- "SwitchCase",
49
- ]);
50
- const LEXICAL_DECLARATION_KINDS = new Set([
51
- "let",
52
- "const",
53
- "using",
54
- "await using",
55
- ]);
56
-
57
- const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
58
-
59
- // Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string
60
- const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN =
61
- /^(?:[^\\]|\\.)*\\(?:[1-9]|0\d)/su;
62
-
63
- const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]);
64
-
65
- /**
66
- * All builtin global variables defined in the latest ECMAScript specification.
67
- * @type {Record<string,boolean>} Key is the name of the variable. Value is `true` if the variable is considered writable, `false` otherwise.
68
- */
69
- const ECMASCRIPT_GLOBALS = globals[`es${LATEST_ECMA_VERSION}`];
70
-
71
- /**
72
- * Checks reference if is non initializer and writable.
73
- * @param {Reference} reference A reference to check.
74
- * @param {number} index The index of the reference in the references.
75
- * @param {Reference[]} references The array that the reference belongs to.
76
- * @returns {boolean} Success/Failure
77
- * @private
78
- */
79
- function isModifyingReference(reference, index, references) {
80
- const identifier = reference.identifier;
81
-
82
- /*
83
- * Destructuring assignments can have multiple default value, so
84
- * possibly there are multiple writeable references for the same
85
- * identifier.
86
- */
87
- const modifyingDifferentIdentifier =
88
- index === 0 || references[index - 1].identifier !== identifier;
89
-
90
- return (
91
- identifier &&
92
- reference.init === false &&
93
- reference.isWrite() &&
94
- modifyingDifferentIdentifier
95
- );
96
- }
97
-
98
- /**
99
- * Checks whether the given string starts with uppercase or not.
100
- * @param {string} s The string to check.
101
- * @returns {boolean} `true` if the string starts with uppercase.
102
- */
103
- function startsWithUpperCase(s) {
104
- return s[0] !== s[0].toLocaleLowerCase();
105
- }
106
-
107
- /**
108
- * Checks whether or not a node is a constructor.
109
- * @param {ASTNode} node A function node to check.
110
- * @returns {boolean} Whether or not a node is a constructor.
111
- */
112
- function isES5Constructor(node) {
113
- return node.id && startsWithUpperCase(node.id.name);
114
- }
115
-
116
- /**
117
- * Finds a function node from ancestors of a node.
118
- * @param {ASTNode} node A start node to find.
119
- * @returns {Node|null} A found function node.
120
- */
121
- function getUpperFunction(node) {
122
- for (
123
- let currentNode = node;
124
- currentNode;
125
- currentNode = currentNode.parent
126
- ) {
127
- if (anyFunctionPattern.test(currentNode.type)) {
128
- return currentNode;
129
- }
130
- }
131
- return null;
132
- }
133
-
134
- /**
135
- * Checks whether a given node is a function node or not.
136
- * The following types are function nodes:
137
- *
138
- * - ArrowFunctionExpression
139
- * - FunctionDeclaration
140
- * - FunctionExpression
141
- * @param {ASTNode|null} node A node to check.
142
- * @returns {boolean} `true` if the node is a function node.
143
- */
144
- function isFunction(node) {
145
- return Boolean(node && anyFunctionPattern.test(node.type));
146
- }
147
-
148
- /**
149
- * Checks whether a given node is a loop node or not.
150
- * The following types are loop nodes:
151
- *
152
- * - DoWhileStatement
153
- * - ForInStatement
154
- * - ForOfStatement
155
- * - ForStatement
156
- * - WhileStatement
157
- * @param {ASTNode|null} node A node to check.
158
- * @returns {boolean} `true` if the node is a loop node.
159
- */
160
- function isLoop(node) {
161
- return Boolean(node && anyLoopPattern.test(node.type));
162
- }
163
-
164
- /**
165
- * Checks whether the given node is in a loop or not.
166
- * @param {ASTNode} node The node to check.
167
- * @returns {boolean} `true` if the node is in a loop.
168
- */
169
- function isInLoop(node) {
170
- for (
171
- let currentNode = node;
172
- currentNode && !isFunction(currentNode);
173
- currentNode = currentNode.parent
174
- ) {
175
- if (isLoop(currentNode)) {
176
- return true;
177
- }
178
- }
179
-
180
- return false;
181
- }
182
-
183
- /**
184
- * Determines whether the given node is a `null` literal.
185
- * @param {ASTNode} node The node to check
186
- * @returns {boolean} `true` if the node is a `null` literal
187
- */
188
- function isNullLiteral(node) {
189
- /*
190
- * Checking `node.value === null` does not guarantee that a literal is a null literal.
191
- * When parsing values that cannot be represented in the current environment (e.g. unicode
192
- * regexes in Node 4), `node.value` is set to `null` because it wouldn't be possible to
193
- * set `node.value` to a unicode regex. To make sure a literal is actually `null`, check
194
- * `node.regex` instead. Also see: https://github.com/eslint/eslint/issues/8020
195
- */
196
- return (
197
- node.type === "Literal" &&
198
- node.value === null &&
199
- !node.regex &&
200
- !node.bigint
201
- );
202
- }
203
-
204
- /**
205
- * Checks whether or not a node is `null` or `undefined`.
206
- * @param {ASTNode} node A node to check.
207
- * @returns {boolean} Whether or not the node is a `null` or `undefined`.
208
- * @public
209
- */
210
- function isNullOrUndefined(node) {
211
- return (
212
- isNullLiteral(node) ||
213
- (node.type === "Identifier" && node.name === "undefined") ||
214
- (node.type === "UnaryExpression" && node.operator === "void")
215
- );
216
- }
217
-
218
- /**
219
- * Checks whether or not a node is callee.
220
- * @param {ASTNode} node A node to check.
221
- * @returns {boolean} Whether or not the node is callee.
222
- */
223
- function isCallee(node) {
224
- return node.parent.type === "CallExpression" && node.parent.callee === node;
225
- }
226
-
227
- /**
228
- * Returns the result of the string conversion applied to the evaluated value of the given expression node,
229
- * if it can be determined statically.
230
- *
231
- * This function returns a `string` value for all `Literal` nodes and simple `TemplateLiteral` nodes only.
232
- * In all other cases, this function returns `null`.
233
- * @param {ASTNode} node Expression node.
234
- * @returns {string|null} String value if it can be determined. Otherwise, `null`.
235
- */
236
- function getStaticStringValue(node) {
237
- switch (node.type) {
238
- case "Literal":
239
- if (node.value === null) {
240
- if (isNullLiteral(node)) {
241
- return String(node.value); // "null"
242
- }
243
- if (node.regex) {
244
- return `/${node.regex.pattern}/${node.regex.flags}`;
245
- }
246
- if (node.bigint) {
247
- return node.bigint;
248
- }
249
-
250
- // Otherwise, this is an unknown literal. The function will return null.
251
- } else {
252
- return String(node.value);
253
- }
254
- break;
255
- case "TemplateLiteral":
256
- if (node.expressions.length === 0 && node.quasis.length === 1) {
257
- return node.quasis[0].value.cooked;
258
- }
259
- break;
260
-
261
- // no default
262
- }
263
-
264
- return null;
265
- }
266
-
267
- /**
268
- * Gets the property name of a given node.
269
- * The node can be a MemberExpression, a Property, or a MethodDefinition.
270
- *
271
- * If the name is dynamic, this returns `null`.
272
- *
273
- * For examples:
274
- *
275
- * a.b // => "b"
276
- * a["b"] // => "b"
277
- * a['b'] // => "b"
278
- * a[`b`] // => "b"
279
- * a[100] // => "100"
280
- * a[b] // => null
281
- * a["a" + "b"] // => null
282
- * a[tag`b`] // => null
283
- * a[`${b}`] // => null
284
- *
285
- * let a = {b: 1} // => "b"
286
- * let a = {["b"]: 1} // => "b"
287
- * let a = {['b']: 1} // => "b"
288
- * let a = {[`b`]: 1} // => "b"
289
- * let a = {[100]: 1} // => "100"
290
- * let a = {[b]: 1} // => null
291
- * let a = {["a" + "b"]: 1} // => null
292
- * let a = {[tag`b`]: 1} // => null
293
- * let a = {[`${b}`]: 1} // => null
294
- * @param {ASTNode} node The node to get.
295
- * @returns {string|null} The property name if static. Otherwise, null.
296
- */
297
- function getStaticPropertyName(node) {
298
- let prop;
299
-
300
- switch (node && node.type) {
301
- case "ChainExpression":
302
- return getStaticPropertyName(node.expression);
303
-
304
- case "Property":
305
- case "PropertyDefinition":
306
- case "MethodDefinition":
307
- case "TSPropertySignature":
308
- case "TSMethodSignature":
309
- prop = node.key;
310
- break;
311
-
312
- case "MemberExpression":
313
- prop = node.property;
314
- break;
315
-
316
- // no default
317
- }
318
-
319
- if (prop) {
320
- if (prop.type === "Identifier" && !node.computed) {
321
- return prop.name;
322
- }
323
-
324
- return getStaticStringValue(prop);
325
- }
326
-
327
- return null;
328
- }
329
-
330
- /**
331
- * Retrieve `ChainExpression#expression` value if the given node a `ChainExpression` node. Otherwise, pass through it.
332
- * @param {ASTNode} node The node to address.
333
- * @returns {ASTNode} The `ChainExpression#expression` value if the node is a `ChainExpression` node. Otherwise, the node.
334
- */
335
- function skipChainExpression(node) {
336
- return node && node.type === "ChainExpression" ? node.expression : node;
337
- }
338
-
339
- /**
340
- * Check if the `actual` is an expected value.
341
- * @param {string} actual The string value to check.
342
- * @param {string | RegExp} expected The expected string value or pattern.
343
- * @returns {boolean} `true` if the `actual` is an expected value.
344
- */
345
- function checkText(actual, expected) {
346
- return typeof expected === "string"
347
- ? actual === expected
348
- : expected.test(actual);
349
- }
350
-
351
- /**
352
- * Check if a given node is an Identifier node with a given name.
353
- * @param {ASTNode} node The node to check.
354
- * @param {string | RegExp} name The expected name or the expected pattern of the object name.
355
- * @returns {boolean} `true` if the node is an Identifier node with the name.
356
- */
357
- function isSpecificId(node, name) {
358
- return node.type === "Identifier" && checkText(node.name, name);
359
- }
360
-
361
- /**
362
- * Check if a given node is member access with a given object name and property name pair.
363
- * This is regardless of optional or not.
364
- * @param {ASTNode} node The node to check.
365
- * @param {string | RegExp | null} objectName The expected name or the expected pattern of the object name. If this is nullish, this method doesn't check object.
366
- * @param {string | RegExp | null} propertyName The expected name or the expected pattern of the property name. If this is nullish, this method doesn't check property.
367
- * @returns {boolean} `true` if the node is member access with the object name and property name pair.
368
- * The node is a `MemberExpression` or `ChainExpression`.
369
- */
370
- function isSpecificMemberAccess(node, objectName, propertyName) {
371
- const checkNode = skipChainExpression(node);
372
-
373
- if (checkNode.type !== "MemberExpression") {
374
- return false;
375
- }
376
-
377
- if (objectName && !isSpecificId(checkNode.object, objectName)) {
378
- return false;
379
- }
380
-
381
- if (propertyName) {
382
- const actualPropertyName = getStaticPropertyName(checkNode);
383
-
384
- if (
385
- typeof actualPropertyName !== "string" ||
386
- !checkText(actualPropertyName, propertyName)
387
- ) {
388
- return false;
389
- }
390
- }
391
-
392
- return true;
393
- }
394
-
395
- /**
396
- * Check if two literal nodes are the same value.
397
- * @param {ASTNode} left The Literal node to compare.
398
- * @param {ASTNode} right The other Literal node to compare.
399
- * @returns {boolean} `true` if the two literal nodes are the same value.
400
- */
401
- function equalLiteralValue(left, right) {
402
- // RegExp literal.
403
- if (left.regex || right.regex) {
404
- return Boolean(
405
- left.regex &&
406
- right.regex &&
407
- left.regex.pattern === right.regex.pattern &&
408
- left.regex.flags === right.regex.flags,
409
- );
410
- }
411
-
412
- // BigInt literal.
413
- if (left.bigint || right.bigint) {
414
- return left.bigint === right.bigint;
415
- }
416
-
417
- return left.value === right.value;
418
- }
419
-
420
- /**
421
- * Check if two expressions reference the same value. For example:
422
- * a = a
423
- * a.b = a.b
424
- * a[0] = a[0]
425
- * a['b'] = a['b']
426
- * @param {ASTNode} left The left side of the comparison.
427
- * @param {ASTNode} right The right side of the comparison.
428
- * @param {boolean} [disableStaticComputedKey] Don't address `a.b` and `a["b"]` are the same if `true`. For backward compatibility.
429
- * @returns {boolean} `true` if both sides match and reference the same value.
430
- */
431
- function isSameReference(left, right, disableStaticComputedKey = false) {
432
- if (left.type !== right.type) {
433
- // Handle `a.b` and `a?.b` are samely.
434
- if (left.type === "ChainExpression") {
435
- return isSameReference(
436
- left.expression,
437
- right,
438
- disableStaticComputedKey,
439
- );
440
- }
441
- if (right.type === "ChainExpression") {
442
- return isSameReference(
443
- left,
444
- right.expression,
445
- disableStaticComputedKey,
446
- );
447
- }
448
-
449
- return false;
450
- }
451
-
452
- switch (left.type) {
453
- case "Super":
454
- case "ThisExpression":
455
- return true;
456
-
457
- case "Identifier":
458
- case "PrivateIdentifier":
459
- return left.name === right.name;
460
- case "Literal":
461
- return equalLiteralValue(left, right);
462
-
463
- case "ChainExpression":
464
- return isSameReference(
465
- left.expression,
466
- right.expression,
467
- disableStaticComputedKey,
468
- );
469
-
470
- case "MemberExpression": {
471
- if (!disableStaticComputedKey) {
472
- const nameA = getStaticPropertyName(left);
473
-
474
- // x.y = x["y"]
475
- if (nameA !== null) {
476
- return (
477
- isSameReference(
478
- left.object,
479
- right.object,
480
- disableStaticComputedKey,
481
- ) && nameA === getStaticPropertyName(right)
482
- );
483
- }
484
- }
485
-
486
- /*
487
- * x[0] = x[0]
488
- * x[y] = x[y]
489
- * x.y = x.y
490
- */
491
- return (
492
- left.computed === right.computed &&
493
- isSameReference(
494
- left.object,
495
- right.object,
496
- disableStaticComputedKey,
497
- ) &&
498
- isSameReference(
499
- left.property,
500
- right.property,
501
- disableStaticComputedKey,
502
- )
503
- );
504
- }
505
-
506
- default:
507
- return false;
508
- }
509
- }
510
-
511
- /**
512
- * Checks whether or not a node is `Reflect.apply`.
513
- * @param {ASTNode} node A node to check.
514
- * @returns {boolean} Whether or not the node is a `Reflect.apply`.
515
- */
516
- function isReflectApply(node) {
517
- return isSpecificMemberAccess(node, "Reflect", "apply");
518
- }
519
-
520
- /**
521
- * Checks whether or not a node is `Array.from`.
522
- * @param {ASTNode} node A node to check.
523
- * @returns {boolean} Whether or not the node is a `Array.from`.
524
- */
525
- function isArrayFromMethod(node) {
526
- return isSpecificMemberAccess(node, arrayOrTypedArrayPattern, "from");
527
- }
528
-
529
- /**
530
- * Checks whether or not a node is `Array.fromAsync`.
531
- * @param {ASTNode} node A node to check.
532
- * @returns {boolean} Whether or not the node is a `Array.fromAsync`.
533
- */
534
- function isArrayFromAsyncMethod(node) {
535
- return isSpecificMemberAccess(node, "Array", "fromAsync");
536
- }
537
-
538
- /**
539
- * Checks whether or not a node is a method which expects a function as a first argument, and `thisArg` as a second argument.
540
- * @param {ASTNode} node A node to check.
541
- * @returns {boolean} Whether or not the node is a method which expects a function as a first argument, and `thisArg` as a second argument.
542
- */
543
- function isMethodWhichHasThisArg(node) {
544
- return isSpecificMemberAccess(node, null, arrayMethodWithThisArgPattern);
545
- }
546
-
547
- /**
548
- * Creates the negate function of the given function.
549
- * @param {Function} f The function to negate.
550
- * @returns {Function} Negated function.
551
- */
552
- function negate(f) {
553
- return token => !f(token);
554
- }
555
-
556
- /**
557
- * Determines if a node is surrounded by parentheses.
558
- * @param {SourceCode} sourceCode The ESLint source code object
559
- * @param {ASTNode} node The node to be checked.
560
- * @returns {boolean} True if the node is parenthesised.
561
- * @private
562
- */
563
- function isParenthesised(sourceCode, node) {
564
- const previousToken = sourceCode.getTokenBefore(node),
565
- nextToken = sourceCode.getTokenAfter(node);
566
-
567
- return (
568
- Boolean(previousToken && nextToken) &&
569
- previousToken.value === "(" &&
570
- previousToken.range[1] <= node.range[0] &&
571
- nextToken.value === ")" &&
572
- nextToken.range[0] >= node.range[1]
573
- );
574
- }
575
-
576
- /**
577
- * Checks if the given token is a `=` token or not.
578
- * @param {Token} token The token to check.
579
- * @returns {boolean} `true` if the token is a `=` token.
580
- */
581
- function isEqToken(token) {
582
- return token.value === "=" && token.type === "Punctuator";
583
- }
584
-
585
- /**
586
- * Checks if the given token is an arrow token or not.
587
- * @param {Token} token The token to check.
588
- * @returns {boolean} `true` if the token is an arrow token.
589
- */
590
- function isArrowToken(token) {
591
- return token.value === "=>" && token.type === "Punctuator";
592
- }
593
-
594
- /**
595
- * Checks if the given token is a comma token or not.
596
- * @param {Token} token The token to check.
597
- * @returns {boolean} `true` if the token is a comma token.
598
- */
599
- function isCommaToken(token) {
600
- return token.value === "," && token.type === "Punctuator";
601
- }
602
-
603
- /**
604
- * Checks if the given token is a dot token or not.
605
- * @param {Token} token The token to check.
606
- * @returns {boolean} `true` if the token is a dot token.
607
- */
608
- function isDotToken(token) {
609
- return token.value === "." && token.type === "Punctuator";
610
- }
611
-
612
- /**
613
- * Checks if the given token is a `?.` token or not.
614
- * @param {Token} token The token to check.
615
- * @returns {boolean} `true` if the token is a `?.` token.
616
- */
617
- function isQuestionDotToken(token) {
618
- return token.value === "?." && token.type === "Punctuator";
619
- }
620
-
621
- /**
622
- * Checks if the given token is a semicolon token or not.
623
- * @param {Token} token The token to check.
624
- * @returns {boolean} `true` if the token is a semicolon token.
625
- */
626
- function isSemicolonToken(token) {
627
- return token.value === ";" && token.type === "Punctuator";
628
- }
629
-
630
- /**
631
- * Checks if the given token is a colon token or not.
632
- * @param {Token} token The token to check.
633
- * @returns {boolean} `true` if the token is a colon token.
634
- */
635
- function isColonToken(token) {
636
- return token.value === ":" && token.type === "Punctuator";
637
- }
638
-
639
- /**
640
- * Checks if the given token is an opening parenthesis token or not.
641
- * @param {Token} token The token to check.
642
- * @returns {boolean} `true` if the token is an opening parenthesis token.
643
- */
644
- function isOpeningParenToken(token) {
645
- return token.value === "(" && token.type === "Punctuator";
646
- }
647
-
648
- /**
649
- * Checks if the given token is a closing parenthesis token or not.
650
- * @param {Token} token The token to check.
651
- * @returns {boolean} `true` if the token is a closing parenthesis token.
652
- */
653
- function isClosingParenToken(token) {
654
- return token.value === ")" && token.type === "Punctuator";
655
- }
656
-
657
- /**
658
- * Checks if the given token is an opening square bracket token or not.
659
- * @param {Token} token The token to check.
660
- * @returns {boolean} `true` if the token is an opening square bracket token.
661
- */
662
- function isOpeningBracketToken(token) {
663
- return token.value === "[" && token.type === "Punctuator";
664
- }
665
-
666
- /**
667
- * Checks if the given token is a closing square bracket token or not.
668
- * @param {Token} token The token to check.
669
- * @returns {boolean} `true` if the token is a closing square bracket token.
670
- */
671
- function isClosingBracketToken(token) {
672
- return token.value === "]" && token.type === "Punctuator";
673
- }
674
-
675
- /**
676
- * Checks if the given token is an opening brace token or not.
677
- * @param {Token} token The token to check.
678
- * @returns {boolean} `true` if the token is an opening brace token.
679
- */
680
- function isOpeningBraceToken(token) {
681
- return token.value === "{" && token.type === "Punctuator";
682
- }
683
-
684
- /**
685
- * Checks if the given token is a closing brace token or not.
686
- * @param {Token} token The token to check.
687
- * @returns {boolean} `true` if the token is a closing brace token.
688
- */
689
- function isClosingBraceToken(token) {
690
- return token.value === "}" && token.type === "Punctuator";
691
- }
692
-
693
- /**
694
- * Checks if the given token is a comment token or not.
695
- * @param {Token} token The token to check.
696
- * @returns {boolean} `true` if the token is a comment token.
697
- */
698
- function isCommentToken(token) {
699
- return (
700
- token.type === "Line" ||
701
- token.type === "Block" ||
702
- token.type === "Shebang"
703
- );
704
- }
705
-
706
- /**
707
- * Checks if the given token is a keyword token or not.
708
- * @param {Token} token The token to check.
709
- * @returns {boolean} `true` if the token is a keyword token.
710
- */
711
- function isKeywordToken(token) {
712
- return token.type === "Keyword";
713
- }
714
-
715
- /**
716
- * Checks whether the given node represents an ES6 export declaration.
717
- * @param {ASTNode} node A node to check.
718
- * @returns {boolean} `true` if the node is an export declaration.
719
- * @private
720
- */
721
- function isExportDeclaration(node) {
722
- return (
723
- node.type === "ExportDefaultDeclaration" ||
724
- node.type === "ExportNamedDeclaration" ||
725
- node.type === "ExportAllDeclaration"
726
- );
727
- }
728
-
729
- /**
730
- * Checks for the presence of a JSDoc comment for the given node and returns it.
731
- * @param {ASTNode} node The node to get the comment for.
732
- * @param {SourceCode} sourceCode A SourceCode instance to get comments.
733
- * @returns {Token|null} The Block comment token containing the JSDoc comment for the given node or null if not found.
734
- * @private
735
- */
736
- function findJSDocComment(node, sourceCode) {
737
- const tokenBefore = sourceCode.getTokenBefore(node, {
738
- includeComments: true,
739
- });
740
-
741
- if (
742
- tokenBefore &&
743
- tokenBefore.type === "Block" &&
744
- tokenBefore.value.charAt(0) === "*" &&
745
- node.loc.start.line - tokenBefore.loc.end.line <= 1
746
- ) {
747
- return tokenBefore;
748
- }
749
-
750
- return null;
751
- }
752
-
753
- /**
754
- * Retrieves the JSDoc comment for a given node.
755
- * @param {ASTNode} node The node to get the comment for.
756
- * @param {SourceCode} sourceCode A SourceCode instance to get comments.
757
- * @returns {Token|null} The Block comment token containing the JSDoc comment for the given node or null if not found.
758
- * @private
759
- */
760
- function getJSDocComment(node, sourceCode) {
761
- let parent = node.parent;
762
-
763
- switch (node.type) {
764
- case "ClassDeclaration":
765
- case "FunctionDeclaration":
766
- return findJSDocComment(
767
- isExportDeclaration(parent) ? parent : node,
768
- sourceCode,
769
- );
770
-
771
- case "ClassExpression":
772
- return findJSDocComment(parent.parent, sourceCode);
773
-
774
- case "ArrowFunctionExpression":
775
- case "FunctionExpression":
776
- if (
777
- parent.type !== "CallExpression" &&
778
- parent.type !== "NewExpression"
779
- ) {
780
- while (
781
- !sourceCode.getCommentsBefore(parent).length &&
782
- !/Function/u.test(parent.type) &&
783
- parent.type !== "MethodDefinition" &&
784
- parent.type !== "Property"
785
- ) {
786
- parent = parent.parent;
787
-
788
- if (!parent) {
789
- break;
790
- }
791
- }
792
-
793
- if (
794
- parent &&
795
- parent.type !== "FunctionDeclaration" &&
796
- parent.type !== "Program"
797
- ) {
798
- return findJSDocComment(parent, sourceCode);
799
- }
800
- }
801
-
802
- return findJSDocComment(node, sourceCode);
803
-
804
- // falls through
805
- default:
806
- return null;
807
- }
808
- }
809
-
810
- /**
811
- * Checks whether or not a node has a `@this` tag in its comments.
812
- * @param {ASTNode} node A node to check.
813
- * @param {SourceCode} sourceCode A SourceCode instance to get comments.
814
- * @returns {boolean} Whether or not the node has a `@this` tag in its comments.
815
- */
816
- function hasJSDocThisTag(node, sourceCode) {
817
- const jsdocComment = getJSDocComment(node, sourceCode);
818
-
819
- if (jsdocComment && thisTagPattern.test(jsdocComment.value)) {
820
- return true;
821
- }
822
-
823
- // Checks `@this` in its leading comments for callbacks,
824
- // because callbacks don't have its JSDoc comment.
825
- // e.g.
826
- // sinon.test(/* @this sinon.Sandbox */function() { this.spy(); });
827
- return sourceCode
828
- .getCommentsBefore(node)
829
- .some(comment => thisTagPattern.test(comment.value));
830
- }
831
-
832
- /**
833
- * Gets the `(` token of the given function node.
834
- * @param {ASTNode} node The function node to get.
835
- * @param {SourceCode} sourceCode The source code object to get tokens.
836
- * @returns {Token} `(` token.
837
- */
838
- function getOpeningParenOfParams(node, sourceCode) {
839
- // If the node is an arrow function and doesn't have parens, this returns the identifier of the first param.
840
- if (node.type === "ArrowFunctionExpression" && node.params.length === 1) {
841
- const argToken = sourceCode.getFirstToken(node.params[0]);
842
- const maybeParenToken = sourceCode.getTokenBefore(argToken);
843
-
844
- return isOpeningParenToken(maybeParenToken)
845
- ? maybeParenToken
846
- : argToken;
847
- }
848
-
849
- // Otherwise, returns paren.
850
- return node.id
851
- ? sourceCode.getTokenAfter(node.id, isOpeningParenToken)
852
- : sourceCode.getFirstToken(node, isOpeningParenToken);
853
- }
854
-
855
- /**
856
- * Checks whether or not the tokens of two given nodes are same.
857
- * @param {ASTNode} left A node 1 to compare.
858
- * @param {ASTNode} right A node 2 to compare.
859
- * @param {SourceCode} sourceCode The ESLint source code object.
860
- * @returns {boolean} the source code for the given node.
861
- */
862
- function equalTokens(left, right, sourceCode) {
863
- const tokensL = sourceCode.getTokens(left);
864
- const tokensR = sourceCode.getTokens(right);
865
-
866
- if (tokensL.length !== tokensR.length) {
867
- return false;
868
- }
869
- for (let i = 0; i < tokensL.length; ++i) {
870
- if (
871
- tokensL[i].type !== tokensR[i].type ||
872
- tokensL[i].value !== tokensR[i].value
873
- ) {
874
- return false;
875
- }
876
- }
877
-
878
- return true;
879
- }
880
-
881
- /**
882
- * Check if the given node is a true logical expression or not.
883
- *
884
- * The three binary expressions logical-or (`||`), logical-and (`&&`), and
885
- * coalesce (`??`) are known as `ShortCircuitExpression`.
886
- * But ESTree represents those by `LogicalExpression` node.
887
- *
888
- * This function rejects coalesce expressions of `LogicalExpression` node.
889
- * @param {ASTNode} node The node to check.
890
- * @returns {boolean} `true` if the node is `&&` or `||`.
891
- * @see https://tc39.es/ecma262/#prod-ShortCircuitExpression
892
- */
893
- function isLogicalExpression(node) {
894
- return (
895
- node.type === "LogicalExpression" &&
896
- (node.operator === "&&" || node.operator === "||")
897
- );
898
- }
899
-
900
- /**
901
- * Check if the given node is a nullish coalescing expression or not.
902
- *
903
- * The three binary expressions logical-or (`||`), logical-and (`&&`), and
904
- * coalesce (`??`) are known as `ShortCircuitExpression`.
905
- * But ESTree represents those by `LogicalExpression` node.
906
- *
907
- * This function finds only coalesce expressions of `LogicalExpression` node.
908
- * @param {ASTNode} node The node to check.
909
- * @returns {boolean} `true` if the node is `??`.
910
- */
911
- function isCoalesceExpression(node) {
912
- return node.type === "LogicalExpression" && node.operator === "??";
913
- }
914
-
915
- /**
916
- * Check if given two nodes are the pair of a logical expression and a coalesce expression.
917
- * @param {ASTNode} left A node to check.
918
- * @param {ASTNode} right Another node to check.
919
- * @returns {boolean} `true` if the two nodes are the pair of a logical expression and a coalesce expression.
920
- */
921
- function isMixedLogicalAndCoalesceExpressions(left, right) {
922
- return (
923
- (isLogicalExpression(left) && isCoalesceExpression(right)) ||
924
- (isCoalesceExpression(left) && isLogicalExpression(right))
925
- );
926
- }
927
-
928
- /**
929
- * Checks if the given operator is a logical assignment operator.
930
- * @param {string} operator The operator to check.
931
- * @returns {boolean} `true` if the operator is a logical assignment operator.
932
- */
933
- function isLogicalAssignmentOperator(operator) {
934
- return LOGICAL_ASSIGNMENT_OPERATORS.has(operator);
935
- }
936
-
937
- /**
938
- * Get the colon token of the given SwitchCase node.
939
- * @param {ASTNode} node The SwitchCase node to get.
940
- * @param {SourceCode} sourceCode The source code object to get tokens.
941
- * @returns {Token} The colon token of the node.
942
- */
943
- function getSwitchCaseColonToken(node, sourceCode) {
944
- if (node.test) {
945
- return sourceCode.getTokenAfter(node.test, isColonToken);
946
- }
947
- return sourceCode.getFirstToken(node, 1);
948
- }
949
-
950
- /**
951
- * Gets ESM module export name represented by the given node.
952
- * @param {ASTNode} node `Identifier` or string `Literal` node in a position
953
- * that represents a module export name:
954
- * - `ImportSpecifier#imported`
955
- * - `ExportSpecifier#local` (if it is a re-export from another module)
956
- * - `ExportSpecifier#exported`
957
- * - `ExportAllDeclaration#exported`
958
- * @returns {string} The module export name.
959
- */
960
- function getModuleExportName(node) {
961
- if (node.type === "Identifier") {
962
- return node.name;
963
- }
964
-
965
- // string literal
966
- return node.value;
967
- }
968
-
969
- /**
970
- * Returns literal's value converted to the Boolean type
971
- * @param {ASTNode} node any `Literal` node
972
- * @returns {boolean | null} `true` when node is truthy, `false` when node is falsy,
973
- * `null` when it cannot be determined.
974
- */
975
- function getBooleanValue(node) {
976
- if (node.value === null) {
977
- /*
978
- * it might be a null literal or bigint/regex literal in unsupported environments .
979
- * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es5.md#regexpliteral
980
- * https://github.com/estree/estree/blob/14df8a024956ea289bd55b9c2226a1d5b8a473ee/es2020.md#bigintliteral
981
- */
982
-
983
- if (node.raw === "null") {
984
- return false;
985
- }
986
-
987
- // regex is always truthy
988
- if (typeof node.regex === "object") {
989
- return true;
990
- }
991
-
992
- return null;
993
- }
994
-
995
- return !!node.value;
996
- }
997
-
998
- /**
999
- * Checks if a branch node of LogicalExpression short circuits the whole condition
1000
- * @param {ASTNode} node The branch of main condition which needs to be checked
1001
- * @param {string} operator The operator of the main LogicalExpression.
1002
- * @returns {boolean} true when condition short circuits whole condition
1003
- */
1004
- function isLogicalIdentity(node, operator) {
1005
- switch (node.type) {
1006
- case "Literal":
1007
- return (
1008
- (operator === "||" && getBooleanValue(node) === true) ||
1009
- (operator === "&&" && getBooleanValue(node) === false)
1010
- );
1011
-
1012
- case "UnaryExpression":
1013
- return operator === "&&" && node.operator === "void";
1014
-
1015
- case "LogicalExpression":
1016
- /*
1017
- * handles `a && false || b`
1018
- * `false` is an identity element of `&&` but not `||`
1019
- */
1020
- return (
1021
- operator === node.operator &&
1022
- (isLogicalIdentity(node.left, operator) ||
1023
- isLogicalIdentity(node.right, operator))
1024
- );
1025
-
1026
- case "AssignmentExpression":
1027
- return (
1028
- ["||=", "&&="].includes(node.operator) &&
1029
- operator === node.operator.slice(0, -1) &&
1030
- isLogicalIdentity(node.right, operator)
1031
- );
1032
-
1033
- // no default
1034
- }
1035
- return false;
1036
- }
1037
-
1038
- /**
1039
- * Checks if an identifier is a reference to a global variable.
1040
- * @param {Scope} scope The scope in which the identifier is referenced.
1041
- * @param {ASTNode} node An identifier node to check.
1042
- * @returns {boolean} `true` if the identifier is a reference to a global variable.
1043
- */
1044
- function isReferenceToGlobalVariable(scope, node) {
1045
- const reference = scope.references.find(ref => ref.identifier === node);
1046
-
1047
- return Boolean(
1048
- reference &&
1049
- reference.resolved &&
1050
- reference.resolved.scope.type === "global" &&
1051
- reference.resolved.defs.length === 0,
1052
- );
1053
- }
1054
-
1055
- /**
1056
- * Checks if a node has a constant truthiness value.
1057
- * @param {Scope} scope Scope in which the node appears.
1058
- * @param {ASTNode} node The AST node to check.
1059
- * @param {boolean} inBooleanPosition `true` if checking the test of a
1060
- * condition. `false` in all other cases. When `false`, checks if -- for
1061
- * both string and number -- if coerced to that type, the value will
1062
- * be constant.
1063
- * @returns {boolean} true when node's truthiness is constant
1064
- * @private
1065
- */
1066
- function isConstant(scope, node, inBooleanPosition) {
1067
- // node.elements can return null values in the case of sparse arrays ex. [,]
1068
- if (!node) {
1069
- return true;
1070
- }
1071
- switch (node.type) {
1072
- case "Literal":
1073
- case "ArrowFunctionExpression":
1074
- case "FunctionExpression":
1075
- return true;
1076
- case "ClassExpression":
1077
- case "ObjectExpression":
1078
- /**
1079
- * In theory objects like:
1080
- *
1081
- * `{toString: () => a}`
1082
- * `{valueOf: () => a}`
1083
- *
1084
- * Or a classes like:
1085
- *
1086
- * `class { static toString() { return a } }`
1087
- * `class { static valueOf() { return a } }`
1088
- *
1089
- * Are not constant verifiably when `inBooleanPosition` is
1090
- * false, but it's an edge case we've opted not to handle.
1091
- */
1092
- return true;
1093
- case "TemplateLiteral":
1094
- return (
1095
- (inBooleanPosition &&
1096
- node.quasis.some(quasi => quasi.value.cooked.length)) ||
1097
- node.expressions.every(exp => isConstant(scope, exp, false))
1098
- );
1099
-
1100
- case "ArrayExpression": {
1101
- if (!inBooleanPosition) {
1102
- return node.elements.every(element =>
1103
- isConstant(scope, element, false),
1104
- );
1105
- }
1106
- return true;
1107
- }
1108
-
1109
- case "UnaryExpression":
1110
- if (
1111
- node.operator === "void" ||
1112
- (node.operator === "typeof" && inBooleanPosition)
1113
- ) {
1114
- return true;
1115
- }
1116
-
1117
- if (node.operator === "!") {
1118
- return isConstant(scope, node.argument, true);
1119
- }
1120
-
1121
- return isConstant(scope, node.argument, false);
1122
-
1123
- case "BinaryExpression":
1124
- return (
1125
- isConstant(scope, node.left, false) &&
1126
- isConstant(scope, node.right, false) &&
1127
- node.operator !== "in"
1128
- );
1129
-
1130
- case "LogicalExpression": {
1131
- const isLeftConstant = isConstant(
1132
- scope,
1133
- node.left,
1134
- inBooleanPosition,
1135
- );
1136
- const isRightConstant = isConstant(
1137
- scope,
1138
- node.right,
1139
- inBooleanPosition,
1140
- );
1141
- const isLeftShortCircuit =
1142
- isLeftConstant && isLogicalIdentity(node.left, node.operator);
1143
- const isRightShortCircuit =
1144
- inBooleanPosition &&
1145
- isRightConstant &&
1146
- isLogicalIdentity(node.right, node.operator);
1147
-
1148
- return (
1149
- (isLeftConstant && isRightConstant) ||
1150
- isLeftShortCircuit ||
1151
- isRightShortCircuit
1152
- );
1153
- }
1154
- case "NewExpression":
1155
- return inBooleanPosition;
1156
- case "AssignmentExpression":
1157
- if (node.operator === "=") {
1158
- return isConstant(scope, node.right, inBooleanPosition);
1159
- }
1160
-
1161
- if (["||=", "&&="].includes(node.operator) && inBooleanPosition) {
1162
- return isLogicalIdentity(
1163
- node.right,
1164
- node.operator.slice(0, -1),
1165
- );
1166
- }
1167
-
1168
- return false;
1169
-
1170
- case "SequenceExpression":
1171
- return isConstant(
1172
- scope,
1173
- node.expressions.at(-1),
1174
- inBooleanPosition,
1175
- );
1176
- case "SpreadElement":
1177
- return isConstant(scope, node.argument, inBooleanPosition);
1178
- case "CallExpression":
1179
- if (
1180
- node.callee.type === "Identifier" &&
1181
- node.callee.name === "Boolean"
1182
- ) {
1183
- if (
1184
- node.arguments.length === 0 ||
1185
- isConstant(scope, node.arguments[0], true)
1186
- ) {
1187
- return isReferenceToGlobalVariable(scope, node.callee);
1188
- }
1189
- }
1190
- return false;
1191
- case "Identifier":
1192
- return (
1193
- node.name === "undefined" &&
1194
- isReferenceToGlobalVariable(scope, node)
1195
- );
1196
-
1197
- // no default
1198
- }
1199
- return false;
1200
- }
1201
-
1202
- /**
1203
- * Checks whether a node is an ExpressionStatement at the top level of a file, function body, or TypeScript module block.
1204
- * A top-level ExpressionStatement node is a directive if it contains a single unparenthesized
1205
- * string literal and if it occurs either as the first sibling or immediately after another
1206
- * directive.
1207
- * @param {ASTNode} node The node to check.
1208
- * @returns {boolean} Whether or not the node is an ExpressionStatement at the top level of a
1209
- * file, function body, or TypeScript module block.
1210
- */
1211
- function isTopLevelExpressionStatement(node) {
1212
- if (node.type !== "ExpressionStatement") {
1213
- return false;
1214
- }
1215
- const parent = node.parent;
1216
-
1217
- return (
1218
- parent.type === "Program" ||
1219
- parent.type === "TSModuleBlock" ||
1220
- (parent.type === "BlockStatement" && isFunction(parent.parent))
1221
- );
1222
- }
1223
-
1224
- /**
1225
- * Check whether the given node is a part of a directive prologue or not.
1226
- * @param {ASTNode} node The node to check.
1227
- * @returns {boolean} `true` if the node is a part of directive prologue.
1228
- */
1229
- function isDirective(node) {
1230
- return (
1231
- node.type === "ExpressionStatement" &&
1232
- typeof node.directive === "string"
1233
- );
1234
- }
1235
-
1236
- /**
1237
- * Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
1238
- * @param {ASTNode} node The node to check.
1239
- * @returns {boolean} Whether the node appears at the beginning of an ancestor ExpressionStatement node.
1240
- */
1241
- function isStartOfExpressionStatement(node) {
1242
- const start = node.range[0];
1243
- let ancestor = node;
1244
-
1245
- while ((ancestor = ancestor.parent) && ancestor.range[0] === start) {
1246
- if (ancestor.type === "ExpressionStatement") {
1247
- return true;
1248
- }
1249
- }
1250
- return false;
1251
- }
1252
-
1253
- /**
1254
- * Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon.
1255
- * This opening parenthesis or bracket should be at the start of an `ExpressionStatement`, a `MethodDefinition` or at
1256
- * the start of the body of an `ArrowFunctionExpression`.
1257
- * @type {(sourceCode: SourceCode, node: ASTNode) => boolean}
1258
- * @param {SourceCode} sourceCode The source code object.
1259
- * @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted.
1260
- * @returns {boolean} Whether a semicolon is required before the opening parenthesis or bracket.
1261
- */
1262
- let needsPrecedingSemicolon;
1263
-
1264
- {
1265
- const BREAK_OR_CONTINUE = new Set(["BreakStatement", "ContinueStatement"]);
1266
-
1267
- // Declaration types that cannot be continued by a punctuator when ending with a string Literal that is a direct child.
1268
- const DECLARATIONS = new Set([
1269
- "ExportAllDeclaration",
1270
- "ExportNamedDeclaration",
1271
- "ImportDeclaration",
1272
- ]);
1273
-
1274
- const IDENTIFIER_OR_KEYWORD = new Set(["Identifier", "Keyword"]);
1275
-
1276
- // Keywords that can immediately precede an ExpressionStatement node, mapped to the their node types.
1277
- const NODE_TYPES_BY_KEYWORD = {
1278
- __proto__: null,
1279
- break: "BreakStatement",
1280
- continue: "ContinueStatement",
1281
- debugger: "DebuggerStatement",
1282
- do: "DoWhileStatement",
1283
- else: "IfStatement",
1284
- return: "ReturnStatement",
1285
- yield: "YieldExpression",
1286
- };
1287
-
1288
- /*
1289
- * Before an opening parenthesis, postfix `++` and `--` always trigger ASI;
1290
- * the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement.
1291
- */
1292
- const PUNCTUATORS = new Set([":", ";", "{", "=>", "++", "--"]);
1293
-
1294
- /*
1295
- * Statements that can contain an `ExpressionStatement` after a closing parenthesis.
1296
- * DoWhileStatement is an exception in that it always triggers ASI after the closing parenthesis.
1297
- */
1298
- const STATEMENTS = new Set([
1299
- "DoWhileStatement",
1300
- "ForInStatement",
1301
- "ForOfStatement",
1302
- "ForStatement",
1303
- "IfStatement",
1304
- "WhileStatement",
1305
- "WithStatement",
1306
- ]);
1307
-
1308
- const TS_TYPE_NODE_TYPES = new Set([
1309
- "TSAsExpression",
1310
- "TSSatisfiesExpression",
1311
- "TSTypeAliasDeclaration",
1312
- "TSTypeAnnotation",
1313
- ]);
1314
-
1315
- /**
1316
- * Determines whether a specified node is inside a TypeScript type context.
1317
- * @param {ASTNode} node The node to check.
1318
- * @returns {boolean} Whether the node is inside a TypeScript type context.
1319
- */
1320
- function isInType(node) {
1321
- for (let currNode = node; ; ) {
1322
- const { parent } = currNode;
1323
- if (!parent) {
1324
- break;
1325
- }
1326
- if (
1327
- TS_TYPE_NODE_TYPES.has(parent.type) &&
1328
- currNode === parent.typeAnnotation
1329
- ) {
1330
- return true;
1331
- }
1332
- currNode = parent;
1333
- }
1334
- return false;
1335
- }
1336
-
1337
- needsPrecedingSemicolon = function (sourceCode, node) {
1338
- const prevToken = sourceCode.getTokenBefore(node);
1339
-
1340
- if (
1341
- !prevToken ||
1342
- (prevToken.type === "Punctuator" &&
1343
- PUNCTUATORS.has(prevToken.value))
1344
- ) {
1345
- return false;
1346
- }
1347
-
1348
- const prevNode = sourceCode.getNodeByRangeIndex(prevToken.range[0]);
1349
-
1350
- if (
1351
- prevNode.type === "TSDeclareFunction" ||
1352
- prevNode.parent.type === "TSImportEqualsDeclaration" ||
1353
- prevNode.parent.parent?.type === "TSImportEqualsDeclaration" ||
1354
- TS_TYPE_NODE_TYPES.has(prevNode.type) ||
1355
- isInType(prevNode)
1356
- ) {
1357
- return false;
1358
- }
1359
-
1360
- if (isClosingParenToken(prevToken)) {
1361
- return !STATEMENTS.has(prevNode.type);
1362
- }
1363
-
1364
- if (isClosingBraceToken(prevToken)) {
1365
- return (
1366
- (prevNode.type === "BlockStatement" &&
1367
- prevNode.parent.type === "FunctionExpression" &&
1368
- prevNode.parent.parent.type !== "MethodDefinition") ||
1369
- (prevNode.type === "ClassBody" &&
1370
- prevNode.parent.type === "ClassExpression") ||
1371
- prevNode.type === "ObjectExpression"
1372
- );
1373
- }
1374
-
1375
- if (IDENTIFIER_OR_KEYWORD.has(prevToken.type)) {
1376
- if (
1377
- prevNode.parent.type === "VariableDeclarator" &&
1378
- !prevNode.parent.init
1379
- ) {
1380
- return false;
1381
- }
1382
- if (BREAK_OR_CONTINUE.has(prevNode.parent.type)) {
1383
- return false;
1384
- }
1385
-
1386
- const keyword = prevToken.value;
1387
- const nodeType = NODE_TYPES_BY_KEYWORD[keyword];
1388
-
1389
- return prevNode.type !== nodeType;
1390
- }
1391
-
1392
- if (prevToken.type === "String") {
1393
- return !DECLARATIONS.has(prevNode.parent.type);
1394
- }
1395
-
1396
- return true;
1397
- };
1398
- }
1399
-
1400
- /**
1401
- * Checks if a node is used as an import attribute key, either in a static or dynamic import.
1402
- * @param {ASTNode} node The node to check.
1403
- * @returns {boolean} Whether the node is used as an import attribute key.
1404
- */
1405
- function isImportAttributeKey(node) {
1406
- const { parent } = node;
1407
-
1408
- // static import/re-export
1409
- if (parent.type === "ImportAttribute" && parent.key === node) {
1410
- return true;
1411
- }
1412
-
1413
- // dynamic import
1414
- if (
1415
- parent.type === "Property" &&
1416
- !parent.computed &&
1417
- (parent.key === node ||
1418
- (parent.value === node && parent.shorthand && !parent.method)) &&
1419
- parent.parent.type === "ObjectExpression"
1420
- ) {
1421
- const objectExpression = parent.parent;
1422
- const objectExpressionParent = objectExpression.parent;
1423
-
1424
- if (
1425
- objectExpressionParent.type === "ImportExpression" &&
1426
- objectExpressionParent.options === objectExpression
1427
- ) {
1428
- return true;
1429
- }
1430
-
1431
- // nested key
1432
- if (
1433
- objectExpressionParent.type === "Property" &&
1434
- objectExpressionParent.value === objectExpression
1435
- ) {
1436
- return isImportAttributeKey(objectExpressionParent.key);
1437
- }
1438
- }
1439
-
1440
- return false;
1441
- }
1442
-
1443
- //------------------------------------------------------------------------------
1444
- // Public Interface
1445
- //------------------------------------------------------------------------------
1446
-
1447
- module.exports = {
1448
- COMMENTS_IGNORE_PATTERN,
1449
- LINEBREAKS,
1450
- LINEBREAK_MATCHER: lineBreakPattern,
1451
- SHEBANG_MATCHER: shebangPattern,
1452
- STATEMENT_LIST_PARENTS,
1453
- ECMASCRIPT_GLOBALS,
1454
-
1455
- /**
1456
- * Determines whether two adjacent tokens are on the same line.
1457
- * @param {Object} left The left token object.
1458
- * @param {Object} right The right token object.
1459
- * @returns {boolean} Whether or not the tokens are on the same line.
1460
- * @public
1461
- */
1462
- isTokenOnSameLine(left, right) {
1463
- return left.loc.end.line === right.loc.start.line;
1464
- },
1465
-
1466
- isNullOrUndefined,
1467
- isCallee,
1468
- isES5Constructor,
1469
- getUpperFunction,
1470
- isFunction,
1471
- isLoop,
1472
- isInLoop,
1473
- isArrayFromMethod,
1474
- isArrayFromAsyncMethod,
1475
- isParenthesised,
1476
- createGlobalLinebreakMatcher,
1477
- equalTokens,
1478
-
1479
- isArrowToken,
1480
- isClosingBraceToken,
1481
- isClosingBracketToken,
1482
- isClosingParenToken,
1483
- isColonToken,
1484
- isCommaToken,
1485
- isCommentToken,
1486
- isDotToken,
1487
- isQuestionDotToken,
1488
- isKeywordToken,
1489
- isNotClosingBraceToken: negate(isClosingBraceToken),
1490
- isNotClosingBracketToken: negate(isClosingBracketToken),
1491
- isNotClosingParenToken: negate(isClosingParenToken),
1492
- isNotColonToken: negate(isColonToken),
1493
- isNotCommaToken: negate(isCommaToken),
1494
- isNotDotToken: negate(isDotToken),
1495
- isNotQuestionDotToken: negate(isQuestionDotToken),
1496
- isNotOpeningBraceToken: negate(isOpeningBraceToken),
1497
- isNotOpeningBracketToken: negate(isOpeningBracketToken),
1498
- isNotOpeningParenToken: negate(isOpeningParenToken),
1499
- isNotSemicolonToken: negate(isSemicolonToken),
1500
- isOpeningBraceToken,
1501
- isOpeningBracketToken,
1502
- isOpeningParenToken,
1503
- isSemicolonToken,
1504
- isEqToken,
1505
-
1506
- /**
1507
- * Checks whether or not a given node is a string literal.
1508
- * @param {ASTNode} node A node to check.
1509
- * @returns {boolean} `true` if the node is a string literal.
1510
- */
1511
- isStringLiteral(node) {
1512
- return (
1513
- (node.type === "Literal" && typeof node.value === "string") ||
1514
- node.type === "TemplateLiteral"
1515
- );
1516
- },
1517
-
1518
- /**
1519
- * Checks whether a given node is a breakable statement or not.
1520
- * The node is breakable if the node is one of the following type:
1521
- *
1522
- * - DoWhileStatement
1523
- * - ForInStatement
1524
- * - ForOfStatement
1525
- * - ForStatement
1526
- * - SwitchStatement
1527
- * - WhileStatement
1528
- * @param {ASTNode} node A node to check.
1529
- * @returns {boolean} `true` if the node is breakable.
1530
- */
1531
- isBreakableStatement(node) {
1532
- return breakableTypePattern.test(node.type);
1533
- },
1534
-
1535
- /**
1536
- * Gets references which are non initializer and writable.
1537
- * @param {Reference[]} references An array of references.
1538
- * @returns {Reference[]} An array of only references which are non initializer and writable.
1539
- * @public
1540
- */
1541
- getModifyingReferences(references) {
1542
- return references.filter(isModifyingReference);
1543
- },
1544
-
1545
- /**
1546
- * Validate that a string passed in is surrounded by the specified character
1547
- * @param {string} val The text to check.
1548
- * @param {string} character The character to see if it's surrounded by.
1549
- * @returns {boolean} True if the text is surrounded by the character, false if not.
1550
- * @private
1551
- */
1552
- isSurroundedBy(val, character) {
1553
- return val[0] === character && val.at(-1) === character;
1554
- },
1555
-
1556
- /**
1557
- * Returns whether the provided node is an ESLint directive comment or not
1558
- * @param {Line|Block} node The comment token to be checked
1559
- * @returns {boolean} `true` if the node is an ESLint directive comment
1560
- */
1561
- isDirectiveComment(node) {
1562
- const comment = node.value.trim();
1563
-
1564
- return (
1565
- (node.type === "Line" && comment.startsWith("eslint-")) ||
1566
- (node.type === "Block" && ESLINT_DIRECTIVE_PATTERN.test(comment))
1567
- );
1568
- },
1569
-
1570
- /**
1571
- * Gets the trailing statement of a given node.
1572
- *
1573
- * if (code)
1574
- * consequent;
1575
- *
1576
- * When taking this `IfStatement`, returns `consequent;` statement.
1577
- * @param {ASTNode} A node to get.
1578
- * @returns {ASTNode|null} The trailing statement's node.
1579
- */
1580
- getTrailingStatement: esutils.ast.trailingStatement,
1581
-
1582
- /**
1583
- * Finds the variable by a given name in a given scope and its upper scopes.
1584
- * @param {eslint-scope.Scope} initScope A scope to start find.
1585
- * @param {string} name A variable name to find.
1586
- * @returns {eslint-scope.Variable|null} A found variable or `null`.
1587
- */
1588
- getVariableByName(initScope, name) {
1589
- let scope = initScope;
1590
-
1591
- while (scope) {
1592
- const variable = scope.set.get(name);
1593
-
1594
- if (variable) {
1595
- return variable;
1596
- }
1597
-
1598
- scope = scope.upper;
1599
- }
1600
-
1601
- return null;
1602
- },
1603
-
1604
- /**
1605
- * Checks whether or not a given function node is the default `this` binding.
1606
- *
1607
- * First, this checks the node:
1608
- *
1609
- * - The given node is not in `PropertyDefinition#value` position.
1610
- * - The given node is not `StaticBlock`.
1611
- * - The function name does not start with uppercase. It's a convention to capitalize the names
1612
- * of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
1613
- * - The function does not have a JSDoc comment that has a @this tag.
1614
- *
1615
- * Next, this checks the location of the node.
1616
- * If the location is below, this judges `this` is valid.
1617
- *
1618
- * - The location is not on an object literal.
1619
- * - The location is not assigned to a variable which starts with an uppercase letter. Applies to anonymous
1620
- * functions only, as the name of the variable is considered to be the name of the function in this case.
1621
- * This check is not performed if `capIsConstructor` is set to `false`.
1622
- * - The location is not on an ES2015 class.
1623
- * - Its `bind`/`call`/`apply` method is not called directly.
1624
- * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given.
1625
- * @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock`
1626
- * or any expression that is `PropertyDefinition#value` node.
1627
- * @param {SourceCode} sourceCode A SourceCode instance to get comments.
1628
- * @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts
1629
- * with an uppercase or are assigned to a variable which name starts with an uppercase are constructors.
1630
- * @returns {boolean} The function node is the default `this` binding.
1631
- */
1632
- isDefaultThisBinding(node, sourceCode, { capIsConstructor = true } = {}) {
1633
- /*
1634
- * Class field initializers are implicit functions, but ESTree doesn't have the AST node of field initializers.
1635
- * Therefore, A expression node at `PropertyDefinition#value` is a function.
1636
- * In this case, `this` is always not default binding.
1637
- */
1638
- if (
1639
- node.parent.type === "PropertyDefinition" &&
1640
- node.parent.value === node
1641
- ) {
1642
- return false;
1643
- }
1644
-
1645
- // Class static blocks are implicit functions. In this case, `this` is always not default binding.
1646
- if (node.type === "StaticBlock") {
1647
- return false;
1648
- }
1649
-
1650
- // Check if the function has a parameter named `this`.
1651
- if (
1652
- (node.type === "FunctionDeclaration" ||
1653
- node.type === "FunctionExpression") &&
1654
- node.params.some(
1655
- param => param.type === "Identifier" && param.name === "this",
1656
- )
1657
- ) {
1658
- return false;
1659
- }
1660
-
1661
- if (
1662
- (capIsConstructor && isES5Constructor(node)) ||
1663
- hasJSDocThisTag(node, sourceCode)
1664
- ) {
1665
- return false;
1666
- }
1667
- const isAnonymous = node.id === null;
1668
- let currentNode = node;
1669
-
1670
- while (currentNode) {
1671
- const parent = currentNode.parent;
1672
-
1673
- switch (parent.type) {
1674
- /*
1675
- * Looks up the destination.
1676
- * e.g., obj.foo = nativeFoo || function foo() { ... };
1677
- */
1678
- case "LogicalExpression":
1679
- case "ConditionalExpression":
1680
- case "ChainExpression":
1681
- currentNode = parent;
1682
- break;
1683
-
1684
- /*
1685
- * If the upper function is IIFE, checks the destination of the return value.
1686
- * e.g.
1687
- * obj.foo = (function() {
1688
- * // setup...
1689
- * return function foo() { ... };
1690
- * })();
1691
- * obj.foo = (() =>
1692
- * function foo() { ... }
1693
- * )();
1694
- */
1695
- case "ReturnStatement": {
1696
- const func = getUpperFunction(parent);
1697
-
1698
- if (func === null || !isCallee(func)) {
1699
- return true;
1700
- }
1701
- currentNode = func.parent;
1702
- break;
1703
- }
1704
- case "ArrowFunctionExpression":
1705
- if (currentNode !== parent.body || !isCallee(parent)) {
1706
- return true;
1707
- }
1708
- currentNode = parent.parent;
1709
- break;
1710
-
1711
- /*
1712
- * e.g.
1713
- * var obj = { foo() { ... } };
1714
- * var obj = { foo: function() { ... } };
1715
- * class A { constructor() { ... } }
1716
- * class A { foo() { ... } }
1717
- * class A { get foo() { ... } }
1718
- * class A { set foo() { ... } }
1719
- * class A { static foo() { ... } }
1720
- * class A { foo = function() { ... } }
1721
- */
1722
- case "Property":
1723
- case "PropertyDefinition":
1724
- case "MethodDefinition":
1725
- return parent.value !== currentNode;
1726
-
1727
- /*
1728
- * e.g.
1729
- * obj.foo = function foo() { ... };
1730
- * Foo = function() { ... };
1731
- * [obj.foo = function foo() { ... }] = a;
1732
- * [Foo = function() { ... }] = a;
1733
- */
1734
- case "AssignmentExpression":
1735
- case "AssignmentPattern":
1736
- if (parent.left.type === "MemberExpression") {
1737
- return false;
1738
- }
1739
- if (
1740
- capIsConstructor &&
1741
- isAnonymous &&
1742
- parent.left.type === "Identifier" &&
1743
- startsWithUpperCase(parent.left.name)
1744
- ) {
1745
- return false;
1746
- }
1747
- return true;
1748
-
1749
- /*
1750
- * e.g.
1751
- * var Foo = function() { ... };
1752
- */
1753
- case "VariableDeclarator":
1754
- return !(
1755
- capIsConstructor &&
1756
- isAnonymous &&
1757
- parent.init === currentNode &&
1758
- parent.id.type === "Identifier" &&
1759
- startsWithUpperCase(parent.id.name)
1760
- );
1761
-
1762
- /*
1763
- * e.g.
1764
- * var foo = function foo() { ... }.bind(obj);
1765
- * (function foo() { ... }).call(obj);
1766
- * (function foo() { ... }).apply(obj, []);
1767
- */
1768
- case "MemberExpression":
1769
- if (
1770
- parent.object === currentNode &&
1771
- isSpecificMemberAccess(
1772
- parent,
1773
- null,
1774
- bindOrCallOrApplyPattern,
1775
- )
1776
- ) {
1777
- const maybeCalleeNode =
1778
- parent.parent.type === "ChainExpression"
1779
- ? parent.parent
1780
- : parent;
1781
-
1782
- return !(
1783
- isCallee(maybeCalleeNode) &&
1784
- maybeCalleeNode.parent.arguments.length >= 1 &&
1785
- !isNullOrUndefined(
1786
- maybeCalleeNode.parent.arguments[0],
1787
- )
1788
- );
1789
- }
1790
- return true;
1791
-
1792
- /*
1793
- * e.g.
1794
- * Reflect.apply(function() {}, obj, []);
1795
- * Array.from([], function() {}, obj);
1796
- * list.forEach(function() {}, obj);
1797
- */
1798
- case "CallExpression":
1799
- if (isReflectApply(parent.callee)) {
1800
- return (
1801
- parent.arguments.length !== 3 ||
1802
- parent.arguments[0] !== currentNode ||
1803
- isNullOrUndefined(parent.arguments[1])
1804
- );
1805
- }
1806
- if (
1807
- isArrayFromMethod(parent.callee) ||
1808
- isArrayFromAsyncMethod(parent.callee)
1809
- ) {
1810
- return (
1811
- parent.arguments.length !== 3 ||
1812
- parent.arguments[1] !== currentNode ||
1813
- isNullOrUndefined(parent.arguments[2])
1814
- );
1815
- }
1816
- if (isMethodWhichHasThisArg(parent.callee)) {
1817
- return (
1818
- parent.arguments.length !== 2 ||
1819
- parent.arguments[0] !== currentNode ||
1820
- isNullOrUndefined(parent.arguments[1])
1821
- );
1822
- }
1823
- return true;
1824
-
1825
- // Otherwise `this` is default.
1826
- default:
1827
- return true;
1828
- }
1829
- }
1830
-
1831
- /* c8 ignore next */
1832
- return true;
1833
- },
1834
-
1835
- /**
1836
- * Get the precedence level based on the node type
1837
- * @param {ASTNode} node node to evaluate
1838
- * @returns {number} precedence level
1839
- * @private
1840
- */
1841
- getPrecedence(node) {
1842
- switch (node.type) {
1843
- case "SequenceExpression":
1844
- return 0;
1845
-
1846
- case "AssignmentExpression":
1847
- case "ArrowFunctionExpression":
1848
- case "YieldExpression":
1849
- return 1;
1850
-
1851
- case "ConditionalExpression":
1852
- return 3;
1853
-
1854
- case "LogicalExpression":
1855
- switch (node.operator) {
1856
- case "||":
1857
- case "??":
1858
- return 4;
1859
- case "&&":
1860
- return 5;
1861
-
1862
- // no default
1863
- }
1864
-
1865
- /* falls through */
1866
-
1867
- case "BinaryExpression":
1868
- switch (node.operator) {
1869
- case "|":
1870
- return 6;
1871
- case "^":
1872
- return 7;
1873
- case "&":
1874
- return 8;
1875
- case "==":
1876
- case "!=":
1877
- case "===":
1878
- case "!==":
1879
- return 9;
1880
- case "<":
1881
- case "<=":
1882
- case ">":
1883
- case ">=":
1884
- case "in":
1885
- case "instanceof":
1886
- return 10;
1887
- case "<<":
1888
- case ">>":
1889
- case ">>>":
1890
- return 11;
1891
- case "+":
1892
- case "-":
1893
- return 12;
1894
- case "*":
1895
- case "/":
1896
- case "%":
1897
- return 13;
1898
- case "**":
1899
- return 15;
1900
-
1901
- // no default
1902
- }
1903
-
1904
- /* falls through */
1905
-
1906
- case "UnaryExpression":
1907
- case "AwaitExpression":
1908
- return 16;
1909
-
1910
- case "UpdateExpression":
1911
- return 17;
1912
-
1913
- case "CallExpression":
1914
- case "ChainExpression":
1915
- case "ImportExpression":
1916
- return 18;
1917
-
1918
- case "NewExpression":
1919
- return 19;
1920
-
1921
- default:
1922
- if (node.type in eslintVisitorKeys) {
1923
- return 20;
1924
- }
1925
-
1926
- /*
1927
- * if the node is not a standard node that we know about, then assume it has the lowest precedence
1928
- * this will mean that rules will wrap unknown nodes in parentheses where applicable instead of
1929
- * unwrapping them and potentially changing the meaning of the code or introducing a syntax error.
1930
- */
1931
- return -1;
1932
- }
1933
- },
1934
-
1935
- /**
1936
- * Checks whether the given node is an empty block node or not.
1937
- * @param {ASTNode|null} node The node to check.
1938
- * @returns {boolean} `true` if the node is an empty block.
1939
- */
1940
- isEmptyBlock(node) {
1941
- return Boolean(
1942
- node && node.type === "BlockStatement" && node.body.length === 0,
1943
- );
1944
- },
1945
-
1946
- /**
1947
- * Checks whether the given node is an empty function node or not.
1948
- * @param {ASTNode|null} node The node to check.
1949
- * @returns {boolean} `true` if the node is an empty function.
1950
- */
1951
- isEmptyFunction(node) {
1952
- return isFunction(node) && module.exports.isEmptyBlock(node.body);
1953
- },
1954
-
1955
- /**
1956
- * Get directives from directive prologue of a Program or Function node.
1957
- * @param {ASTNode} node The node to check.
1958
- * @returns {ASTNode[]} The directives found in the directive prologue.
1959
- */
1960
- getDirectivePrologue(node) {
1961
- const directives = [];
1962
-
1963
- // Directive prologues only occur at the top of files or functions.
1964
- if (
1965
- node.type === "Program" ||
1966
- node.type === "FunctionDeclaration" ||
1967
- node.type === "FunctionExpression" ||
1968
- /*
1969
- * Do not check arrow functions with implicit return.
1970
- * `() => "use strict";` returns the string `"use strict"`.
1971
- */
1972
- (node.type === "ArrowFunctionExpression" &&
1973
- node.body.type === "BlockStatement")
1974
- ) {
1975
- const statements =
1976
- node.type === "Program" ? node.body : node.body.body;
1977
-
1978
- for (const statement of statements) {
1979
- if (
1980
- statement.type === "ExpressionStatement" &&
1981
- statement.expression.type === "Literal"
1982
- ) {
1983
- directives.push(statement);
1984
- } else {
1985
- break;
1986
- }
1987
- }
1988
- }
1989
-
1990
- return directives;
1991
- },
1992
-
1993
- /**
1994
- * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added
1995
- * after the node will be parsed as a decimal point, rather than a property-access dot.
1996
- * @param {ASTNode} node The node to check.
1997
- * @returns {boolean} `true` if this node is a decimal integer.
1998
- * @example
1999
- *
2000
- * 0 // true
2001
- * 5 // true
2002
- * 50 // true
2003
- * 5_000 // true
2004
- * 1_234_56 // true
2005
- * 08 // true
2006
- * 0192 // true
2007
- * 5. // false
2008
- * .5 // false
2009
- * 5.0 // false
2010
- * 5.00_00 // false
2011
- * 05 // false
2012
- * 0x5 // false
2013
- * 0b101 // false
2014
- * 0b11_01 // false
2015
- * 0o5 // false
2016
- * 5e0 // false
2017
- * 5e1_000 // false
2018
- * 5n // false
2019
- * 1_000n // false
2020
- * "5" // false
2021
- *
2022
- */
2023
- isDecimalInteger(node) {
2024
- return (
2025
- node.type === "Literal" &&
2026
- typeof node.value === "number" &&
2027
- DECIMAL_INTEGER_PATTERN.test(node.raw)
2028
- );
2029
- },
2030
-
2031
- /**
2032
- * Determines whether this token is a decimal integer numeric token.
2033
- * This is similar to isDecimalInteger(), but for tokens.
2034
- * @param {Token} token The token to check.
2035
- * @returns {boolean} `true` if this token is a decimal integer.
2036
- */
2037
- isDecimalIntegerNumericToken(token) {
2038
- return (
2039
- token.type === "Numeric" &&
2040
- DECIMAL_INTEGER_PATTERN.test(token.value)
2041
- );
2042
- },
2043
-
2044
- /**
2045
- * Gets the name and kind of the given function node.
2046
- *
2047
- * - `function foo() {}` .................... `function 'foo'`
2048
- * - `(function foo() {})` .................. `function 'foo'`
2049
- * - `(function() {})` ...................... `function`
2050
- * - `function* foo() {}` ................... `generator function 'foo'`
2051
- * - `(function* foo() {})` ................. `generator function 'foo'`
2052
- * - `(function*() {})` ..................... `generator function`
2053
- * - `() => {}` ............................. `arrow function`
2054
- * - `async () => {}` ....................... `async arrow function`
2055
- * - `({ foo: function foo() {} })` ......... `method 'foo'`
2056
- * - `({ foo: function() {} })` ............. `method 'foo'`
2057
- * - `({ ['foo']: function() {} })` ......... `method 'foo'`
2058
- * - `({ [foo]: function() {} })` ........... `method`
2059
- * - `({ foo() {} })` ....................... `method 'foo'`
2060
- * - `({ foo: function* foo() {} })` ........ `generator method 'foo'`
2061
- * - `({ foo: function*() {} })` ............ `generator method 'foo'`
2062
- * - `({ ['foo']: function*() {} })` ........ `generator method 'foo'`
2063
- * - `({ [foo]: function*() {} })` .......... `generator method`
2064
- * - `({ *foo() {} })` ...................... `generator method 'foo'`
2065
- * - `({ foo: async function foo() {} })` ... `async method 'foo'`
2066
- * - `({ foo: async function() {} })` ....... `async method 'foo'`
2067
- * - `({ ['foo']: async function() {} })` ... `async method 'foo'`
2068
- * - `({ [foo]: async function() {} })` ..... `async method`
2069
- * - `({ async foo() {} })` ................. `async method 'foo'`
2070
- * - `({ get foo() {} })` ................... `getter 'foo'`
2071
- * - `({ set foo(a) {} })` .................. `setter 'foo'`
2072
- * - `class A { constructor() {} }` ......... `constructor`
2073
- * - `class A { foo() {} }` ................. `method 'foo'`
2074
- * - `class A { *foo() {} }` ................ `generator method 'foo'`
2075
- * - `class A { async foo() {} }` ........... `async method 'foo'`
2076
- * - `class A { ['foo']() {} }` ............. `method 'foo'`
2077
- * - `class A { *['foo']() {} }` ............ `generator method 'foo'`
2078
- * - `class A { async ['foo']() {} }` ....... `async method 'foo'`
2079
- * - `class A { [foo]() {} }` ............... `method`
2080
- * - `class A { *[foo]() {} }` .............. `generator method`
2081
- * - `class A { async [foo]() {} }` ......... `async method`
2082
- * - `class A { get foo() {} }` ............. `getter 'foo'`
2083
- * - `class A { set foo(a) {} }` ............ `setter 'foo'`
2084
- * - `class A { static foo() {} }` .......... `static method 'foo'`
2085
- * - `class A { static *foo() {} }` ......... `static generator method 'foo'`
2086
- * - `class A { static async foo() {} }` .... `static async method 'foo'`
2087
- * - `class A { static get foo() {} }` ...... `static getter 'foo'`
2088
- * - `class A { static set foo(a) {} }` ..... `static setter 'foo'`
2089
- * - `class A { foo = () => {}; }` .......... `method 'foo'`
2090
- * - `class A { foo = function() {}; }` ..... `method 'foo'`
2091
- * - `class A { foo = function bar() {}; }` . `method 'foo'`
2092
- * - `class A { static foo = () => {}; }` ... `static method 'foo'`
2093
- * - `class A { '#foo' = () => {}; }` ....... `method '#foo'`
2094
- * - `class A { #foo = () => {}; }` ......... `private method #foo`
2095
- * - `class A { static #foo = () => {}; }` .. `static private method #foo`
2096
- * - `class A { '#foo'() {} }` .............. `method '#foo'`
2097
- * - `class A { #foo() {} }` ................ `private method #foo`
2098
- * - `class A { static #foo() {} }` ......... `static private method #foo`
2099
- * @param {ASTNode} node The function node to get.
2100
- * @returns {string} The name and kind of the function node.
2101
- */
2102
- getFunctionNameWithKind(node) {
2103
- const parent = node.parent;
2104
- const tokens = [];
2105
-
2106
- if (
2107
- parent.type === "MethodDefinition" ||
2108
- parent.type === "PropertyDefinition" ||
2109
- node.type === "TSPropertySignature" ||
2110
- node.type === "TSMethodSignature"
2111
- ) {
2112
- // The proposal uses `static` word consistently before visibility words: https://github.com/tc39/proposal-static-class-features
2113
- if (parent.static) {
2114
- tokens.push("static");
2115
- }
2116
- if (!parent.computed && parent.key?.type === "PrivateIdentifier") {
2117
- tokens.push("private");
2118
- }
2119
- }
2120
- if (node.async) {
2121
- tokens.push("async");
2122
- }
2123
- if (node.generator) {
2124
- tokens.push("generator");
2125
- }
2126
-
2127
- if (parent.type === "Property" || parent.type === "MethodDefinition") {
2128
- if (parent.kind === "constructor") {
2129
- return "constructor";
2130
- }
2131
- if (parent.kind === "get") {
2132
- tokens.push("getter");
2133
- } else if (parent.kind === "set") {
2134
- tokens.push("setter");
2135
- } else {
2136
- tokens.push("method");
2137
- }
2138
- } else if (node.type === "TSMethodSignature") {
2139
- if (node.kind === "get") {
2140
- tokens.push("getter");
2141
- } else if (node.kind === "set") {
2142
- tokens.push("setter");
2143
- } else {
2144
- tokens.push("method");
2145
- }
2146
- } else if (parent.type === "PropertyDefinition") {
2147
- tokens.push("method");
2148
- } else {
2149
- if (node.type === "ArrowFunctionExpression") {
2150
- tokens.push("arrow");
2151
- }
2152
- tokens.push("function");
2153
- }
2154
-
2155
- if (
2156
- parent.type === "Property" ||
2157
- parent.type === "MethodDefinition" ||
2158
- parent.type === "PropertyDefinition"
2159
- ) {
2160
- if (!parent.computed && parent.key.type === "PrivateIdentifier") {
2161
- tokens.push(`#${parent.key.name}`);
2162
- } else {
2163
- const name = getStaticPropertyName(parent);
2164
-
2165
- if (name !== null) {
2166
- tokens.push(`'${name}'`);
2167
- } else if (node.id) {
2168
- tokens.push(`'${node.id.name}'`);
2169
- }
2170
- }
2171
- } else if (node.type === "TSMethodSignature") {
2172
- tokens.push(`'${getStaticPropertyName(node)}'`);
2173
- } else if (node.id) {
2174
- tokens.push(`'${node.id.name}'`);
2175
- }
2176
-
2177
- return tokens.join(" ");
2178
- },
2179
-
2180
- /**
2181
- * Gets the location of the given function node for reporting.
2182
- *
2183
- * - `function foo() {}`
2184
- * ^^^^^^^^^^^^
2185
- * - `(function foo() {})`
2186
- * ^^^^^^^^^^^^
2187
- * - `(function() {})`
2188
- * ^^^^^^^^
2189
- * - `function* foo() {}`
2190
- * ^^^^^^^^^^^^^
2191
- * - `(function* foo() {})`
2192
- * ^^^^^^^^^^^^^
2193
- * - `(function*() {})`
2194
- * ^^^^^^^^^
2195
- * - `() => {}`
2196
- * ^^
2197
- * - `async () => {}`
2198
- * ^^
2199
- * - `({ foo: function foo() {} })`
2200
- * ^^^^^^^^^^^^^^^^^
2201
- * - `({ foo: function() {} })`
2202
- * ^^^^^^^^^^^^^
2203
- * - `({ ['foo']: function() {} })`
2204
- * ^^^^^^^^^^^^^^^^^
2205
- * - `({ [foo]: function() {} })`
2206
- * ^^^^^^^^^^^^^^^
2207
- * - `({ foo() {} })`
2208
- * ^^^
2209
- * - `({ foo: function* foo() {} })`
2210
- * ^^^^^^^^^^^^^^^^^^
2211
- * - `({ foo: function*() {} })`
2212
- * ^^^^^^^^^^^^^^
2213
- * - `({ ['foo']: function*() {} })`
2214
- * ^^^^^^^^^^^^^^^^^^
2215
- * - `({ [foo]: function*() {} })`
2216
- * ^^^^^^^^^^^^^^^^
2217
- * - `({ *foo() {} })`
2218
- * ^^^^
2219
- * - `({ foo: async function foo() {} })`
2220
- * ^^^^^^^^^^^^^^^^^^^^^^^
2221
- * - `({ foo: async function() {} })`
2222
- * ^^^^^^^^^^^^^^^^^^^
2223
- * - `({ ['foo']: async function() {} })`
2224
- * ^^^^^^^^^^^^^^^^^^^^^^^
2225
- * - `({ [foo]: async function() {} })`
2226
- * ^^^^^^^^^^^^^^^^^^^^^
2227
- * - `({ async foo() {} })`
2228
- * ^^^^^^^^^
2229
- * - `({ get foo() {} })`
2230
- * ^^^^^^^
2231
- * - `({ set foo(a) {} })`
2232
- * ^^^^^^^
2233
- * - `class A { constructor() {} }`
2234
- * ^^^^^^^^^^^
2235
- * - `class A { foo() {} }`
2236
- * ^^^
2237
- * - `class A { *foo() {} }`
2238
- * ^^^^
2239
- * - `class A { async foo() {} }`
2240
- * ^^^^^^^^^
2241
- * - `class A { ['foo']() {} }`
2242
- * ^^^^^^^
2243
- * - `class A { *['foo']() {} }`
2244
- * ^^^^^^^^
2245
- * - `class A { async ['foo']() {} }`
2246
- * ^^^^^^^^^^^^^
2247
- * - `class A { [foo]() {} }`
2248
- * ^^^^^
2249
- * - `class A { *[foo]() {} }`
2250
- * ^^^^^^
2251
- * - `class A { async [foo]() {} }`
2252
- * ^^^^^^^^^^^
2253
- * - `class A { get foo() {} }`
2254
- * ^^^^^^^
2255
- * - `class A { set foo(a) {} }`
2256
- * ^^^^^^^
2257
- * - `class A { static foo() {} }`
2258
- * ^^^^^^^^^^
2259
- * - `class A { static *foo() {} }`
2260
- * ^^^^^^^^^^^
2261
- * - `class A { static async foo() {} }`
2262
- * ^^^^^^^^^^^^^^^^
2263
- * - `class A { static get foo() {} }`
2264
- * ^^^^^^^^^^^^^^
2265
- * - `class A { static set foo(a) {} }`
2266
- * ^^^^^^^^^^^^^^
2267
- * - `class A { foo = function() {} }`
2268
- * ^^^^^^^^^^^^^^
2269
- * - `class A { static foo = function() {} }`
2270
- * ^^^^^^^^^^^^^^^^^^^^^
2271
- * - `class A { foo = (a, b) => {} }`
2272
- * ^^^^^^
2273
- * @param {ASTNode} node The function node to get.
2274
- * @param {SourceCode} sourceCode The source code object to get tokens.
2275
- * @returns {string} The location of the function node for reporting.
2276
- */
2277
- getFunctionHeadLoc(node, sourceCode) {
2278
- const parent = node.parent;
2279
- let start;
2280
- let end;
2281
-
2282
- if (
2283
- parent.type === "Property" ||
2284
- parent.type === "MethodDefinition" ||
2285
- parent.type === "PropertyDefinition" ||
2286
- parent.type === "TSPropertySignature" ||
2287
- parent.type === "TSMethodSignature"
2288
- ) {
2289
- start = parent.loc.start;
2290
- end = getOpeningParenOfParams(node, sourceCode).loc.start;
2291
- } else if (node.type === "ArrowFunctionExpression") {
2292
- const arrowToken = sourceCode.getTokenBefore(
2293
- node.body,
2294
- isArrowToken,
2295
- );
2296
-
2297
- start = arrowToken.loc.start;
2298
- end = arrowToken.loc.end;
2299
- } else {
2300
- start = node.loc.start;
2301
- end = getOpeningParenOfParams(node, sourceCode).loc.start;
2302
- }
2303
-
2304
- return {
2305
- start: Object.assign({}, start),
2306
- end: Object.assign({}, end),
2307
- };
2308
- },
2309
-
2310
- /**
2311
- * Gets next location when the result is not out of bound, otherwise returns null.
2312
- *
2313
- * Assumptions:
2314
- *
2315
- * - The given location represents a valid location in the given source code.
2316
- * - Columns are 0-based.
2317
- * - Lines are 1-based.
2318
- * - Column immediately after the last character in a line (not incl. linebreaks) is considered to be a valid location.
2319
- * - If the source code ends with a linebreak, `sourceCode.lines` array will have an extra element (empty string) at the end.
2320
- * The start (column 0) of that extra line is considered to be a valid location.
2321
- *
2322
- * Examples of successive locations (line, column):
2323
- *
2324
- * code: foo
2325
- * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> null
2326
- *
2327
- * code: foo<LF>
2328
- * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null
2329
- *
2330
- * code: foo<CR><LF>
2331
- * locations: (1, 0) -> (1, 1) -> (1, 2) -> (1, 3) -> (2, 0) -> null
2332
- *
2333
- * code: a<LF>b
2334
- * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> null
2335
- *
2336
- * code: a<LF>b<LF>
2337
- * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null
2338
- *
2339
- * code: a<CR><LF>b<CR><LF>
2340
- * locations: (1, 0) -> (1, 1) -> (2, 0) -> (2, 1) -> (3, 0) -> null
2341
- *
2342
- * code: a<LF><LF>
2343
- * locations: (1, 0) -> (1, 1) -> (2, 0) -> (3, 0) -> null
2344
- *
2345
- * code: <LF>
2346
- * locations: (1, 0) -> (2, 0) -> null
2347
- *
2348
- * code:
2349
- * locations: (1, 0) -> null
2350
- * @param {SourceCode} sourceCode The sourceCode
2351
- * @param {{line: number, column: number}} location The location
2352
- * @returns {{line: number, column: number} | null} Next location
2353
- */
2354
- getNextLocation(sourceCode, { line, column }) {
2355
- if (column < sourceCode.lines[line - 1].length) {
2356
- return {
2357
- line,
2358
- column: column + 1,
2359
- };
2360
- }
2361
-
2362
- if (line < sourceCode.lines.length) {
2363
- return {
2364
- line: line + 1,
2365
- column: 0,
2366
- };
2367
- }
2368
-
2369
- return null;
2370
- },
2371
-
2372
- /**
2373
- * Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses
2374
- * surrounding the node.
2375
- * @param {SourceCode} sourceCode The source code object
2376
- * @param {ASTNode} node An expression node
2377
- * @returns {string} The text representing the node, with all surrounding parentheses included
2378
- */
2379
- getParenthesisedText(sourceCode, node) {
2380
- let leftToken = sourceCode.getFirstToken(node);
2381
- let rightToken = sourceCode.getLastToken(node);
2382
-
2383
- while (
2384
- sourceCode.getTokenBefore(leftToken) &&
2385
- sourceCode.getTokenBefore(leftToken).type === "Punctuator" &&
2386
- sourceCode.getTokenBefore(leftToken).value === "(" &&
2387
- sourceCode.getTokenAfter(rightToken) &&
2388
- sourceCode.getTokenAfter(rightToken).type === "Punctuator" &&
2389
- sourceCode.getTokenAfter(rightToken).value === ")"
2390
- ) {
2391
- leftToken = sourceCode.getTokenBefore(leftToken);
2392
- rightToken = sourceCode.getTokenAfter(rightToken);
2393
- }
2394
-
2395
- return sourceCode
2396
- .getText()
2397
- .slice(leftToken.range[0], rightToken.range[1]);
2398
- },
2399
-
2400
- /**
2401
- * Determine if a node has a possibility to be an Error object
2402
- * @param {ASTNode} node ASTNode to check
2403
- * @returns {boolean} True if there is a chance it contains an Error obj
2404
- */
2405
- couldBeError(node) {
2406
- switch (node.type) {
2407
- case "Identifier":
2408
- case "CallExpression":
2409
- case "NewExpression":
2410
- case "MemberExpression":
2411
- case "TaggedTemplateExpression":
2412
- case "YieldExpression":
2413
- case "AwaitExpression":
2414
- case "ChainExpression":
2415
- return true; // possibly an error object.
2416
-
2417
- case "AssignmentExpression":
2418
- if (["=", "&&="].includes(node.operator)) {
2419
- return module.exports.couldBeError(node.right);
2420
- }
2421
-
2422
- if (["||=", "??="].includes(node.operator)) {
2423
- return (
2424
- module.exports.couldBeError(node.left) ||
2425
- module.exports.couldBeError(node.right)
2426
- );
2427
- }
2428
-
2429
- /**
2430
- * All other assignment operators are mathematical assignment operators (arithmetic or bitwise).
2431
- * An assignment expression with a mathematical operator can either evaluate to a primitive value,
2432
- * or throw, depending on the operands. Thus, it cannot evaluate to an `Error` object.
2433
- */
2434
- return false;
2435
-
2436
- case "SequenceExpression": {
2437
- const exprs = node.expressions;
2438
-
2439
- return (
2440
- exprs.length !== 0 &&
2441
- module.exports.couldBeError(exprs.at(-1))
2442
- );
2443
- }
2444
-
2445
- case "LogicalExpression":
2446
- /*
2447
- * If the && operator short-circuits, the left side was falsy and therefore not an error, and if it
2448
- * doesn't short-circuit, it takes the value from the right side, so the right side must always be
2449
- * a plausible error. A future improvement could verify that the left side could be truthy by
2450
- * excluding falsy literals.
2451
- */
2452
- if (node.operator === "&&") {
2453
- return module.exports.couldBeError(node.right);
2454
- }
2455
-
2456
- return (
2457
- module.exports.couldBeError(node.left) ||
2458
- module.exports.couldBeError(node.right)
2459
- );
2460
-
2461
- case "ConditionalExpression":
2462
- return (
2463
- module.exports.couldBeError(node.consequent) ||
2464
- module.exports.couldBeError(node.alternate)
2465
- );
2466
-
2467
- default:
2468
- return false;
2469
- }
2470
- },
2471
-
2472
- /**
2473
- * Check if a given node is a numeric literal or not.
2474
- * @param {ASTNode} node The node to check.
2475
- * @returns {boolean} `true` if the node is a number or bigint literal.
2476
- */
2477
- isNumericLiteral(node) {
2478
- return (
2479
- node.type === "Literal" &&
2480
- (typeof node.value === "number" || Boolean(node.bigint))
2481
- );
2482
- },
2483
-
2484
- /**
2485
- * Determines whether two tokens can safely be placed next to each other without merging into a single token
2486
- * @param {Token|string} leftValue The left token. If this is a string, it will be tokenized and the last token will be used.
2487
- * @param {Token|string} rightValue The right token. If this is a string, it will be tokenized and the first token will be used.
2488
- * @returns {boolean} If the tokens cannot be safely placed next to each other, returns `false`. If the tokens can be placed
2489
- * next to each other, behavior is undefined (although it should return `true` in most cases).
2490
- */
2491
- canTokensBeAdjacent(leftValue, rightValue) {
2492
- const espreeOptions = {
2493
- ecmaVersion: espree.latestEcmaVersion,
2494
- comment: true,
2495
- range: true,
2496
- };
2497
-
2498
- let leftToken;
2499
-
2500
- if (typeof leftValue === "string") {
2501
- let tokens;
2502
-
2503
- try {
2504
- tokens = espree.tokenize(leftValue, espreeOptions);
2505
- } catch {
2506
- return false;
2507
- }
2508
-
2509
- const comments = tokens.comments;
2510
-
2511
- leftToken = tokens.at(-1);
2512
- if (comments.length) {
2513
- const lastComment = comments.at(-1);
2514
-
2515
- if (!leftToken || lastComment.range[0] > leftToken.range[0]) {
2516
- leftToken = lastComment;
2517
- }
2518
- }
2519
- } else {
2520
- leftToken = leftValue;
2521
- }
2522
-
2523
- /*
2524
- * If a hashbang comment was passed as a token object from SourceCode,
2525
- * its type will be "Shebang" because of the way ESLint itself handles hashbangs.
2526
- * If a hashbang comment was passed in a string and then tokenized in this function,
2527
- * its type will be "Hashbang" because of the way Espree tokenizes hashbangs.
2528
- */
2529
- if (leftToken.type === "Shebang" || leftToken.type === "Hashbang") {
2530
- return false;
2531
- }
2532
-
2533
- let rightToken;
2534
-
2535
- if (typeof rightValue === "string") {
2536
- let tokens;
2537
-
2538
- try {
2539
- tokens = espree.tokenize(rightValue, espreeOptions);
2540
- } catch {
2541
- return false;
2542
- }
2543
-
2544
- const comments = tokens.comments;
2545
-
2546
- rightToken = tokens[0];
2547
- if (comments.length) {
2548
- const firstComment = comments[0];
2549
-
2550
- if (
2551
- !rightToken ||
2552
- firstComment.range[0] < rightToken.range[0]
2553
- ) {
2554
- rightToken = firstComment;
2555
- }
2556
- }
2557
- } else {
2558
- rightToken = rightValue;
2559
- }
2560
-
2561
- if (
2562
- leftToken.type === "Punctuator" ||
2563
- rightToken.type === "Punctuator"
2564
- ) {
2565
- if (
2566
- leftToken.type === "Punctuator" &&
2567
- rightToken.type === "Punctuator"
2568
- ) {
2569
- const PLUS_TOKENS = new Set(["+", "++"]);
2570
- const MINUS_TOKENS = new Set(["-", "--"]);
2571
-
2572
- return !(
2573
- (PLUS_TOKENS.has(leftToken.value) &&
2574
- PLUS_TOKENS.has(rightToken.value)) ||
2575
- (MINUS_TOKENS.has(leftToken.value) &&
2576
- MINUS_TOKENS.has(rightToken.value))
2577
- );
2578
- }
2579
- if (leftToken.type === "Punctuator" && leftToken.value === "/") {
2580
- return !["Block", "Line", "RegularExpression"].includes(
2581
- rightToken.type,
2582
- );
2583
- }
2584
- return true;
2585
- }
2586
-
2587
- if (
2588
- leftToken.type === "String" ||
2589
- rightToken.type === "String" ||
2590
- leftToken.type === "Template" ||
2591
- rightToken.type === "Template"
2592
- ) {
2593
- return true;
2594
- }
2595
-
2596
- if (
2597
- leftToken.type !== "Numeric" &&
2598
- rightToken.type === "Numeric" &&
2599
- rightToken.value.startsWith(".")
2600
- ) {
2601
- return true;
2602
- }
2603
-
2604
- if (
2605
- leftToken.type === "Block" ||
2606
- rightToken.type === "Block" ||
2607
- rightToken.type === "Line"
2608
- ) {
2609
- return true;
2610
- }
2611
-
2612
- if (rightToken.type === "PrivateIdentifier") {
2613
- return true;
2614
- }
2615
-
2616
- return false;
2617
- },
2618
-
2619
- /**
2620
- * Get the `loc` object of a given name in a `/*globals` directive comment.
2621
- * @param {SourceCode} sourceCode The source code to convert index to loc.
2622
- * @param {Comment} comment The `/*globals` directive comment which include the name.
2623
- * @param {string} name The name to find.
2624
- * @returns {SourceLocation} The `loc` object.
2625
- */
2626
- getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) {
2627
- const namePattern = new RegExp(
2628
- `[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`,
2629
- "gu",
2630
- );
2631
-
2632
- // To ignore the first text "global".
2633
- namePattern.lastIndex = comment.value.indexOf("global") + 6;
2634
-
2635
- // Search a given variable name.
2636
- const match = namePattern.exec(comment.value);
2637
-
2638
- // Convert the index to loc.
2639
- const start = sourceCode.getLocFromIndex(
2640
- comment.range[0] + "/*".length + (match ? match.index + 1 : 0),
2641
- );
2642
- const end = {
2643
- line: start.line,
2644
- column: start.column + (match ? name.length : 1),
2645
- };
2646
-
2647
- return { start, end };
2648
- },
2649
-
2650
- /**
2651
- * Determines whether the given raw string contains an octal escape sequence
2652
- * or a non-octal decimal escape sequence ("\8", "\9").
2653
- *
2654
- * "\1", "\2" ... "\7", "\8", "\9"
2655
- * "\00", "\01" ... "\07", "\08", "\09"
2656
- *
2657
- * "\0", when not followed by a digit, is not an octal escape sequence.
2658
- * @param {string} rawString A string in its raw representation.
2659
- * @returns {boolean} `true` if the string contains at least one octal escape sequence
2660
- * or at least one non-octal decimal escape sequence.
2661
- */
2662
- hasOctalOrNonOctalDecimalEscapeSequence(rawString) {
2663
- return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
2664
- },
2665
-
2666
- /**
2667
- * Determines whether the given node is a template literal without expressions.
2668
- * @param {ASTNode} node Node to check.
2669
- * @returns {boolean} True if the node is a template literal without expressions.
2670
- */
2671
- isStaticTemplateLiteral(node) {
2672
- return node.type === "TemplateLiteral" && node.expressions.length === 0;
2673
- },
2674
-
2675
- /**
2676
- * Determines whether the existing curly braces around the single statement are necessary to preserve the semantics of the code.
2677
- * The braces, which make the given block body, are necessary in either of the following situations:
2678
- *
2679
- * 1. The statement is a lexical declaration.
2680
- * 2. Without the braces, an `if` within the statement would become associated with an `else` after the closing brace:
2681
- *
2682
- * if (a) {
2683
- * if (b)
2684
- * foo();
2685
- * }
2686
- * else
2687
- * bar();
2688
- *
2689
- * if (a)
2690
- * while (b)
2691
- * while (c) {
2692
- * while (d)
2693
- * if (e)
2694
- * while(f)
2695
- * foo();
2696
- * }
2697
- * else
2698
- * bar();
2699
- * @param {ASTNode} node `BlockStatement` body with exactly one statement directly inside. The statement can have its own nested statements.
2700
- * @param {SourceCode} sourceCode The source code
2701
- * @returns {boolean} `true` if the braces are necessary - removing them (replacing the given `BlockStatement` body with its single statement content)
2702
- * would change the semantics of the code or produce a syntax error.
2703
- */
2704
- areBracesNecessary(node, sourceCode) {
2705
- /**
2706
- * Determines if the given node is a lexical declaration (let, const, using, await using, function, or class)
2707
- * @param {ASTNode} nodeToCheck The node to check
2708
- * @returns {boolean} True if the node is a lexical declaration
2709
- * @private
2710
- */
2711
- function isLexicalDeclaration(nodeToCheck) {
2712
- if (nodeToCheck.type === "VariableDeclaration") {
2713
- return LEXICAL_DECLARATION_KINDS.has(nodeToCheck.kind);
2714
- }
2715
-
2716
- return (
2717
- nodeToCheck.type === "FunctionDeclaration" ||
2718
- nodeToCheck.type === "ClassDeclaration"
2719
- );
2720
- }
2721
-
2722
- /**
2723
- * Checks if the given token is an `else` token or not.
2724
- * @param {Token} token The token to check.
2725
- * @returns {boolean} `true` if the token is an `else` token.
2726
- */
2727
- function isElseKeywordToken(token) {
2728
- return token.value === "else" && token.type === "Keyword";
2729
- }
2730
-
2731
- /**
2732
- * Determines whether the given node has an `else` keyword token as the first token after.
2733
- * @param {ASTNode} nodeToCheck The node to check.
2734
- * @returns {boolean} `true` if the node is followed by an `else` keyword token.
2735
- */
2736
- function isFollowedByElseKeyword(nodeToCheck) {
2737
- const nextToken = sourceCode.getTokenAfter(nodeToCheck);
2738
-
2739
- return Boolean(nextToken) && isElseKeywordToken(nextToken);
2740
- }
2741
-
2742
- /**
2743
- * Determines whether the code represented by the given node contains an `if` statement
2744
- * that would become associated with an `else` keyword directly appended to that code.
2745
- *
2746
- * Examples where it returns `true`:
2747
- *
2748
- * if (a)
2749
- * foo();
2750
- *
2751
- * if (a) {
2752
- * foo();
2753
- * }
2754
- *
2755
- * if (a)
2756
- * foo();
2757
- * else if (b)
2758
- * bar();
2759
- *
2760
- * while (a)
2761
- * if (b)
2762
- * if(c)
2763
- * foo();
2764
- * else
2765
- * bar();
2766
- *
2767
- * Examples where it returns `false`:
2768
- *
2769
- * if (a)
2770
- * foo();
2771
- * else
2772
- * bar();
2773
- *
2774
- * while (a) {
2775
- * if (b)
2776
- * if(c)
2777
- * foo();
2778
- * else
2779
- * bar();
2780
- * }
2781
- *
2782
- * while (a)
2783
- * if (b) {
2784
- * if(c)
2785
- * foo();
2786
- * }
2787
- * else
2788
- * bar();
2789
- * @param {ASTNode} nodeToCheck Node representing the code to check.
2790
- * @returns {boolean} `true` if an `if` statement within the code would become associated with an `else` appended to that code.
2791
- */
2792
- function hasUnsafeIf(nodeToCheck) {
2793
- switch (nodeToCheck.type) {
2794
- case "IfStatement":
2795
- if (!nodeToCheck.alternate) {
2796
- return true;
2797
- }
2798
- return hasUnsafeIf(nodeToCheck.alternate);
2799
- case "ForStatement":
2800
- case "ForInStatement":
2801
- case "ForOfStatement":
2802
- case "LabeledStatement":
2803
- case "WithStatement":
2804
- case "WhileStatement":
2805
- return hasUnsafeIf(nodeToCheck.body);
2806
- default:
2807
- return false;
2808
- }
2809
- }
2810
-
2811
- const statement = node.body[0];
2812
-
2813
- return (
2814
- isLexicalDeclaration(statement) ||
2815
- (hasUnsafeIf(statement) && isFollowedByElseKeyword(node))
2816
- );
2817
- },
2818
-
2819
- isReferenceToGlobalVariable,
2820
- isLogicalExpression,
2821
- isCoalesceExpression,
2822
- isMixedLogicalAndCoalesceExpressions,
2823
- isNullLiteral,
2824
- getStaticStringValue,
2825
- getStaticPropertyName,
2826
- skipChainExpression,
2827
- isSpecificId,
2828
- isSpecificMemberAccess,
2829
- equalLiteralValue,
2830
- isSameReference,
2831
- isLogicalAssignmentOperator,
2832
- getSwitchCaseColonToken,
2833
- getModuleExportName,
2834
- isConstant,
2835
- isTopLevelExpressionStatement,
2836
- isDirective,
2837
- isStartOfExpressionStatement,
2838
- needsPrecedingSemicolon,
2839
- isImportAttributeKey,
2840
- getOpeningParenOfParams,
2841
- };