@alexlit/lint-kit 126.6.0 → 127.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (590) hide show
  1. package/eslint.config.js +16 -0
  2. package/package.json +5 -5
  3. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +20 -0
  4. package/packages/config-eslint/node_modules/ajv/LICENSE +22 -0
  5. package/packages/config-eslint/node_modules/ajv/README.md +1497 -0
  6. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +7189 -0
  7. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +3 -0
  8. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +1 -0
  9. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +397 -0
  10. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +506 -0
  11. package/packages/config-eslint/node_modules/ajv/lib/cache.js +26 -0
  12. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +90 -0
  13. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +5 -0
  14. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +34 -0
  15. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +142 -0
  16. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +387 -0
  17. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +270 -0
  18. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +66 -0
  19. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +9 -0
  20. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +20 -0
  21. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +239 -0
  22. package/packages/config-eslint/node_modules/ajv/lib/data.js +49 -0
  23. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +37 -0
  24. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +113 -0
  25. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
  26. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
  27. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
  28. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +32 -0
  29. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +46 -0
  30. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +51 -0
  31. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +9 -0
  32. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +11 -0
  33. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +55 -0
  34. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +191 -0
  35. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +47 -0
  36. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +203 -0
  37. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +79 -0
  38. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +30 -0
  39. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +194 -0
  40. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +106 -0
  41. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +73 -0
  42. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +98 -0
  43. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +39 -0
  44. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
  45. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +43 -0
  46. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +54 -0
  47. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +14 -0
  48. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +245 -0
  49. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
  50. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +85 -0
  51. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +108 -0
  52. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
  53. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +276 -0
  54. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +3 -0
  55. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +163 -0
  56. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
  57. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
  58. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
  59. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +42 -0
  60. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
  61. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +14 -0
  62. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +56 -0
  63. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +81 -0
  64. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +228 -0
  65. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
  66. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +66 -0
  67. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +150 -0
  68. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +103 -0
  69. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +33 -0
  70. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +140 -0
  71. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
  72. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +84 -0
  73. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
  74. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +75 -0
  75. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +335 -0
  76. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
  77. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +124 -0
  78. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +270 -0
  79. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
  80. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +482 -0
  81. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +146 -0
  82. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +17 -0
  83. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
  84. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
  85. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
  86. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
  87. package/packages/config-eslint/node_modules/ajv/package.json +106 -0
  88. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +3 -0
  89. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +61 -0
  90. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +73 -0
  91. package/packages/config-eslint/node_modules/ajv/scripts/info +10 -0
  92. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +12 -0
  93. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +32 -0
  94. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +23 -0
  95. package/packages/config-eslint/node_modules/ansi-styles/index.d.ts +345 -0
  96. package/packages/config-eslint/node_modules/ansi-styles/index.js +163 -0
  97. package/packages/config-eslint/node_modules/ansi-styles/license +9 -0
  98. package/packages/config-eslint/node_modules/ansi-styles/package.json +56 -0
  99. package/packages/config-eslint/node_modules/ansi-styles/readme.md +152 -0
  100. package/packages/config-eslint/node_modules/chalk/index.d.ts +415 -0
  101. package/packages/config-eslint/node_modules/chalk/license +9 -0
  102. package/packages/config-eslint/node_modules/chalk/package.json +68 -0
  103. package/packages/config-eslint/node_modules/chalk/readme.md +341 -0
  104. package/packages/config-eslint/node_modules/chalk/source/index.js +229 -0
  105. package/packages/config-eslint/node_modules/chalk/source/templates.js +134 -0
  106. package/packages/config-eslint/node_modules/chalk/source/util.js +39 -0
  107. package/packages/config-eslint/node_modules/color-convert/CHANGELOG.md +54 -0
  108. package/packages/config-eslint/node_modules/color-convert/LICENSE +21 -0
  109. package/packages/config-eslint/node_modules/color-convert/README.md +68 -0
  110. package/packages/config-eslint/node_modules/color-convert/conversions.js +839 -0
  111. package/packages/config-eslint/node_modules/color-convert/index.js +81 -0
  112. package/packages/config-eslint/node_modules/color-convert/package.json +48 -0
  113. package/packages/config-eslint/node_modules/color-convert/route.js +97 -0
  114. package/packages/config-eslint/node_modules/color-name/LICENSE +8 -0
  115. package/packages/config-eslint/node_modules/color-name/README.md +11 -0
  116. package/packages/config-eslint/node_modules/color-name/index.js +152 -0
  117. package/packages/config-eslint/node_modules/color-name/package.json +28 -0
  118. package/packages/config-eslint/node_modules/eslint/LICENSE +19 -0
  119. package/packages/config-eslint/node_modules/eslint/README.md +306 -0
  120. package/packages/config-eslint/node_modules/eslint/bin/eslint.js +174 -0
  121. package/packages/config-eslint/node_modules/eslint/conf/default-cli-options.js +32 -0
  122. package/packages/config-eslint/node_modules/eslint/conf/ecma-version.js +16 -0
  123. package/packages/config-eslint/node_modules/eslint/conf/globals.js +160 -0
  124. package/packages/config-eslint/node_modules/eslint/conf/replacements.json +22 -0
  125. package/packages/config-eslint/node_modules/eslint/conf/rule-type-list.json +30 -0
  126. package/packages/config-eslint/node_modules/eslint/lib/api.js +50 -0
  127. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/cli-engine.js +1089 -0
  128. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/file-enumerator.js +547 -0
  129. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json +18 -0
  130. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/html.js +351 -0
  131. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +16 -0
  132. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json.js +13 -0
  133. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/stylish.js +101 -0
  134. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/hash.js +35 -0
  135. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/index.js +7 -0
  136. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/lint-result-cache.js +203 -0
  137. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/load-rules.js +46 -0
  138. package/packages/config-eslint/node_modules/eslint/lib/cli.js +552 -0
  139. package/packages/config-eslint/node_modules/eslint/lib/config/default-config.js +75 -0
  140. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-array.js +423 -0
  141. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-helpers.js +132 -0
  142. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-schema.js +576 -0
  143. package/packages/config-eslint/node_modules/eslint/lib/config/rule-validator.js +194 -0
  144. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint-helpers.js +975 -0
  145. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint.js +1307 -0
  146. package/packages/config-eslint/node_modules/eslint/lib/eslint/index.js +9 -0
  147. package/packages/config-eslint/node_modules/eslint/lib/eslint/legacy-eslint.js +742 -0
  148. package/packages/config-eslint/node_modules/eslint/lib/languages/js/index.js +252 -0
  149. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/index.js +7 -0
  150. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js +1318 -0
  151. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +57 -0
  152. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js +58 -0
  153. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js +76 -0
  154. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js +92 -0
  155. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js +39 -0
  156. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js +43 -0
  157. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +57 -0
  158. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js +63 -0
  159. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/index.js +627 -0
  160. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js +40 -0
  161. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js +38 -0
  162. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js +42 -0
  163. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js +107 -0
  164. package/packages/config-eslint/node_modules/eslint/lib/languages/js/validate-language-options.js +181 -0
  165. package/packages/config-eslint/node_modules/eslint/lib/linter/apply-disable-directives.js +513 -0
  166. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +851 -0
  167. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +263 -0
  168. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +2348 -0
  169. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +344 -0
  170. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +203 -0
  171. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +349 -0
  172. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +45 -0
  173. package/packages/config-eslint/node_modules/eslint/lib/linter/config-comment-parser.js +169 -0
  174. package/packages/config-eslint/node_modules/eslint/lib/linter/index.js +11 -0
  175. package/packages/config-eslint/node_modules/eslint/lib/linter/interpolate.js +50 -0
  176. package/packages/config-eslint/node_modules/eslint/lib/linter/linter.js +2410 -0
  177. package/packages/config-eslint/node_modules/eslint/lib/linter/node-event-generator.js +352 -0
  178. package/packages/config-eslint/node_modules/eslint/lib/linter/report-translator.js +376 -0
  179. package/packages/config-eslint/node_modules/eslint/lib/linter/rule-fixer.js +163 -0
  180. package/packages/config-eslint/node_modules/eslint/lib/linter/rules.js +71 -0
  181. package/packages/config-eslint/node_modules/eslint/lib/linter/safe-emitter.js +52 -0
  182. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-fixer.js +152 -0
  183. package/packages/config-eslint/node_modules/eslint/lib/linter/timing.js +169 -0
  184. package/packages/config-eslint/node_modules/eslint/lib/linter/vfile.js +111 -0
  185. package/packages/config-eslint/node_modules/eslint/lib/options.js +442 -0
  186. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/index.js +7 -0
  187. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/rule-tester.js +1286 -0
  188. package/packages/config-eslint/node_modules/eslint/lib/rules/accessor-pairs.js +346 -0
  189. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-newline.js +261 -0
  190. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-spacing.js +244 -0
  191. package/packages/config-eslint/node_modules/eslint/lib/rules/array-callback-return.js +446 -0
  192. package/packages/config-eslint/node_modules/eslint/lib/rules/array-element-newline.js +311 -0
  193. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-body-style.js +296 -0
  194. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-parens.js +186 -0
  195. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-spacing.js +164 -0
  196. package/packages/config-eslint/node_modules/eslint/lib/rules/block-scoped-var.js +135 -0
  197. package/packages/config-eslint/node_modules/eslint/lib/rules/block-spacing.js +174 -0
  198. package/packages/config-eslint/node_modules/eslint/lib/rules/brace-style.js +197 -0
  199. package/packages/config-eslint/node_modules/eslint/lib/rules/callback-return.js +187 -0
  200. package/packages/config-eslint/node_modules/eslint/lib/rules/camelcase.js +397 -0
  201. package/packages/config-eslint/node_modules/eslint/lib/rules/capitalized-comments.js +303 -0
  202. package/packages/config-eslint/node_modules/eslint/lib/rules/class-methods-use-this.js +187 -0
  203. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-dangle.js +373 -0
  204. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-spacing.js +192 -0
  205. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-style.js +314 -0
  206. package/packages/config-eslint/node_modules/eslint/lib/rules/complexity.js +178 -0
  207. package/packages/config-eslint/node_modules/eslint/lib/rules/computed-property-spacing.js +208 -0
  208. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-return.js +210 -0
  209. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-this.js +153 -0
  210. package/packages/config-eslint/node_modules/eslint/lib/rules/constructor-super.js +445 -0
  211. package/packages/config-eslint/node_modules/eslint/lib/rules/curly.js +486 -0
  212. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case-last.js +44 -0
  213. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case.js +97 -0
  214. package/packages/config-eslint/node_modules/eslint/lib/rules/default-param-last.js +62 -0
  215. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-location.js +108 -0
  216. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-notation.js +176 -0
  217. package/packages/config-eslint/node_modules/eslint/lib/rules/eol-last.js +115 -0
  218. package/packages/config-eslint/node_modules/eslint/lib/rules/eqeqeq.js +174 -0
  219. package/packages/config-eslint/node_modules/eslint/lib/rules/for-direction.js +140 -0
  220. package/packages/config-eslint/node_modules/eslint/lib/rules/func-call-spacing.js +233 -0
  221. package/packages/config-eslint/node_modules/eslint/lib/rules/func-name-matching.js +253 -0
  222. package/packages/config-eslint/node_modules/eslint/lib/rules/func-names.js +191 -0
  223. package/packages/config-eslint/node_modules/eslint/lib/rules/func-style.js +136 -0
  224. package/packages/config-eslint/node_modules/eslint/lib/rules/function-call-argument-newline.js +125 -0
  225. package/packages/config-eslint/node_modules/eslint/lib/rules/function-paren-newline.js +292 -0
  226. package/packages/config-eslint/node_modules/eslint/lib/rules/generator-star-spacing.js +209 -0
  227. package/packages/config-eslint/node_modules/eslint/lib/rules/getter-return.js +204 -0
  228. package/packages/config-eslint/node_modules/eslint/lib/rules/global-require.js +90 -0
  229. package/packages/config-eslint/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +215 -0
  230. package/packages/config-eslint/node_modules/eslint/lib/rules/guard-for-in.js +76 -0
  231. package/packages/config-eslint/node_modules/eslint/lib/rules/handle-callback-err.js +101 -0
  232. package/packages/config-eslint/node_modules/eslint/lib/rules/id-blacklist.js +246 -0
  233. package/packages/config-eslint/node_modules/eslint/lib/rules/id-denylist.js +228 -0
  234. package/packages/config-eslint/node_modules/eslint/lib/rules/id-length.js +177 -0
  235. package/packages/config-eslint/node_modules/eslint/lib/rules/id-match.js +299 -0
  236. package/packages/config-eslint/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +84 -0
  237. package/packages/config-eslint/node_modules/eslint/lib/rules/indent-legacy.js +1126 -0
  238. package/packages/config-eslint/node_modules/eslint/lib/rules/indent.js +1803 -0
  239. package/packages/config-eslint/node_modules/eslint/lib/rules/index.js +305 -0
  240. package/packages/config-eslint/node_modules/eslint/lib/rules/init-declarations.js +139 -0
  241. package/packages/config-eslint/node_modules/eslint/lib/rules/jsx-quotes.js +98 -0
  242. package/packages/config-eslint/node_modules/eslint/lib/rules/key-spacing.js +687 -0
  243. package/packages/config-eslint/node_modules/eslint/lib/rules/keyword-spacing.js +640 -0
  244. package/packages/config-eslint/node_modules/eslint/lib/rules/line-comment-position.js +125 -0
  245. package/packages/config-eslint/node_modules/eslint/lib/rules/linebreak-style.js +108 -0
  246. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-comment.js +471 -0
  247. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-directive.js +201 -0
  248. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-between-class-members.js +269 -0
  249. package/packages/config-eslint/node_modules/eslint/lib/rules/logical-assignment-operators.js +504 -0
  250. package/packages/config-eslint/node_modules/eslint/lib/rules/max-classes-per-file.js +89 -0
  251. package/packages/config-eslint/node_modules/eslint/lib/rules/max-depth.js +156 -0
  252. package/packages/config-eslint/node_modules/eslint/lib/rules/max-len.js +440 -0
  253. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines-per-function.js +213 -0
  254. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines.js +193 -0
  255. package/packages/config-eslint/node_modules/eslint/lib/rules/max-nested-callbacks.js +117 -0
  256. package/packages/config-eslint/node_modules/eslint/lib/rules/max-params.js +102 -0
  257. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements-per-line.js +199 -0
  258. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements.js +184 -0
  259. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-comment-style.js +476 -0
  260. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-ternary.js +174 -0
  261. package/packages/config-eslint/node_modules/eslint/lib/rules/new-cap.js +276 -0
  262. package/packages/config-eslint/node_modules/eslint/lib/rules/new-parens.js +93 -0
  263. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-after-var.js +253 -0
  264. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-before-return.js +217 -0
  265. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-per-chained-call.js +126 -0
  266. package/packages/config-eslint/node_modules/eslint/lib/rules/no-alert.js +138 -0
  267. package/packages/config-eslint/node_modules/eslint/lib/rules/no-array-constructor.js +133 -0
  268. package/packages/config-eslint/node_modules/eslint/lib/rules/no-async-promise-executor.js +39 -0
  269. package/packages/config-eslint/node_modules/eslint/lib/rules/no-await-in-loop.js +106 -0
  270. package/packages/config-eslint/node_modules/eslint/lib/rules/no-bitwise.js +119 -0
  271. package/packages/config-eslint/node_modules/eslint/lib/rules/no-buffer-constructor.js +50 -0
  272. package/packages/config-eslint/node_modules/eslint/lib/rules/no-caller.js +46 -0
  273. package/packages/config-eslint/node_modules/eslint/lib/rules/no-case-declarations.js +76 -0
  274. package/packages/config-eslint/node_modules/eslint/lib/rules/no-catch-shadow.js +82 -0
  275. package/packages/config-eslint/node_modules/eslint/lib/rules/no-class-assign.js +63 -0
  276. package/packages/config-eslint/node_modules/eslint/lib/rules/no-compare-neg-zero.js +60 -0
  277. package/packages/config-eslint/node_modules/eslint/lib/rules/no-cond-assign.js +159 -0
  278. package/packages/config-eslint/node_modules/eslint/lib/rules/no-confusing-arrow.js +92 -0
  279. package/packages/config-eslint/node_modules/eslint/lib/rules/no-console.js +207 -0
  280. package/packages/config-eslint/node_modules/eslint/lib/rules/no-const-assign.js +56 -0
  281. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-binary-expression.js +508 -0
  282. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-condition.js +161 -0
  283. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constructor-return.js +62 -0
  284. package/packages/config-eslint/node_modules/eslint/lib/rules/no-continue.js +39 -0
  285. package/packages/config-eslint/node_modules/eslint/lib/rules/no-control-regex.js +138 -0
  286. package/packages/config-eslint/node_modules/eslint/lib/rules/no-debugger.js +43 -0
  287. package/packages/config-eslint/node_modules/eslint/lib/rules/no-delete-var.js +42 -0
  288. package/packages/config-eslint/node_modules/eslint/lib/rules/no-div-regex.js +53 -0
  289. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-args.js +82 -0
  290. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-class-members.js +104 -0
  291. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-else-if.js +122 -0
  292. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-keys.js +142 -0
  293. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-case.js +71 -0
  294. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-imports.js +290 -0
  295. package/packages/config-eslint/node_modules/eslint/lib/rules/no-else-return.js +405 -0
  296. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-character-class.js +76 -0
  297. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-function.js +167 -0
  298. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-pattern.js +78 -0
  299. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-static-block.js +47 -0
  300. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty.js +103 -0
  301. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eq-null.js +46 -0
  302. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eval.js +286 -0
  303. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ex-assign.js +54 -0
  304. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extend-native.js +178 -0
  305. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-bind.js +213 -0
  306. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +369 -0
  307. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-label.js +149 -0
  308. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-parens.js +1322 -0
  309. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-semi.js +147 -0
  310. package/packages/config-eslint/node_modules/eslint/lib/rules/no-fallthrough.js +221 -0
  311. package/packages/config-eslint/node_modules/eslint/lib/rules/no-floating-decimal.js +73 -0
  312. package/packages/config-eslint/node_modules/eslint/lib/rules/no-func-assign.js +78 -0
  313. package/packages/config-eslint/node_modules/eslint/lib/rules/no-global-assign.js +95 -0
  314. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-coercion.js +422 -0
  315. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-globals.js +146 -0
  316. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implied-eval.js +132 -0
  317. package/packages/config-eslint/node_modules/eslint/lib/rules/no-import-assign.js +241 -0
  318. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inline-comments.js +110 -0
  319. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inner-declarations.js +131 -0
  320. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-regexp.js +194 -0
  321. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-this.js +150 -0
  322. package/packages/config-eslint/node_modules/eslint/lib/rules/no-irregular-whitespace.js +276 -0
  323. package/packages/config-eslint/node_modules/eslint/lib/rules/no-iterator.js +52 -0
  324. package/packages/config-eslint/node_modules/eslint/lib/rules/no-label-var.js +80 -0
  325. package/packages/config-eslint/node_modules/eslint/lib/rules/no-labels.js +149 -0
  326. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lone-blocks.js +136 -0
  327. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lonely-if.js +88 -0
  328. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loop-func.js +238 -0
  329. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loss-of-precision.js +214 -0
  330. package/packages/config-eslint/node_modules/eslint/lib/rules/no-magic-numbers.js +243 -0
  331. package/packages/config-eslint/node_modules/eslint/lib/rules/no-misleading-character-class.js +537 -0
  332. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-operators.js +229 -0
  333. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-requires.js +238 -0
  334. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +116 -0
  335. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-assign.js +67 -0
  336. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-spaces.js +141 -0
  337. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-str.js +65 -0
  338. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +154 -0
  339. package/packages/config-eslint/node_modules/eslint/lib/rules/no-native-reassign.js +98 -0
  340. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-condition.js +95 -0
  341. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-in-lhs.js +46 -0
  342. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nested-ternary.js +44 -0
  343. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-func.js +87 -0
  344. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +66 -0
  345. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-object.js +67 -0
  346. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-require.js +50 -0
  347. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-symbol.js +63 -0
  348. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-wrappers.js +60 -0
  349. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new.js +43 -0
  350. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +148 -0
  351. package/packages/config-eslint/node_modules/eslint/lib/rules/no-obj-calls.js +86 -0
  352. package/packages/config-eslint/node_modules/eslint/lib/rules/no-object-constructor.js +117 -0
  353. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal-escape.js +56 -0
  354. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal.js +45 -0
  355. package/packages/config-eslint/node_modules/eslint/lib/rules/no-param-reassign.js +230 -0
  356. package/packages/config-eslint/node_modules/eslint/lib/rules/no-path-concat.js +64 -0
  357. package/packages/config-eslint/node_modules/eslint/lib/rules/no-plusplus.js +105 -0
  358. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-env.js +51 -0
  359. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-exit.js +47 -0
  360. package/packages/config-eslint/node_modules/eslint/lib/rules/no-promise-executor-return.js +263 -0
  361. package/packages/config-eslint/node_modules/eslint/lib/rules/no-proto.js +48 -0
  362. package/packages/config-eslint/node_modules/eslint/lib/rules/no-prototype-builtins.js +159 -0
  363. package/packages/config-eslint/node_modules/eslint/lib/rules/no-redeclare.js +174 -0
  364. package/packages/config-eslint/node_modules/eslint/lib/rules/no-regex-spaces.js +197 -0
  365. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-exports.js +204 -0
  366. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-globals.js +124 -0
  367. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-imports.js +563 -0
  368. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-modules.js +213 -0
  369. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-properties.js +168 -0
  370. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-syntax.js +70 -0
  371. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-assign.js +80 -0
  372. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-await.js +135 -0
  373. package/packages/config-eslint/node_modules/eslint/lib/rules/no-script-url.js +61 -0
  374. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-assign.js +183 -0
  375. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-compare.js +60 -0
  376. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sequences.js +139 -0
  377. package/packages/config-eslint/node_modules/eslint/lib/rules/no-setter-return.js +226 -0
  378. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +65 -0
  379. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow.js +336 -0
  380. package/packages/config-eslint/node_modules/eslint/lib/rules/no-spaced-func.js +83 -0
  381. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sparse-arrays.js +73 -0
  382. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sync.js +64 -0
  383. package/packages/config-eslint/node_modules/eslint/lib/rules/no-tabs.js +81 -0
  384. package/packages/config-eslint/node_modules/eslint/lib/rules/no-template-curly-in-string.js +44 -0
  385. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ternary.js +41 -0
  386. package/packages/config-eslint/node_modules/eslint/lib/rules/no-this-before-super.js +363 -0
  387. package/packages/config-eslint/node_modules/eslint/lib/rules/no-throw-literal.js +51 -0
  388. package/packages/config-eslint/node_modules/eslint/lib/rules/no-trailing-spaces.js +192 -0
  389. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef-init.js +75 -0
  390. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef.js +79 -0
  391. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undefined.js +86 -0
  392. package/packages/config-eslint/node_modules/eslint/lib/rules/no-underscore-dangle.js +335 -0
  393. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unexpected-multiline.js +120 -0
  394. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +360 -0
  395. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unneeded-ternary.js +166 -0
  396. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable-loop.js +185 -0
  397. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable.js +293 -0
  398. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-finally.js +111 -0
  399. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-negation.js +128 -0
  400. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +205 -0
  401. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-expressions.js +186 -0
  402. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-labels.js +143 -0
  403. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-private-class-members.js +195 -0
  404. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-vars.js +881 -0
  405. package/packages/config-eslint/node_modules/eslint/lib/rules/no-use-before-define.js +348 -0
  406. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-assignment.js +566 -0
  407. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-backreference.js +244 -0
  408. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-call.js +90 -0
  409. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-catch.js +57 -0
  410. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-computed-key.js +168 -0
  411. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-concat.js +115 -0
  412. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-constructor.js +189 -0
  413. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-escape.js +333 -0
  414. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-rename.js +172 -0
  415. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-return.js +369 -0
  416. package/packages/config-eslint/node_modules/eslint/lib/rules/no-var.js +334 -0
  417. package/packages/config-eslint/node_modules/eslint/lib/rules/no-void.js +64 -0
  418. package/packages/config-eslint/node_modules/eslint/lib/rules/no-warning-comments.js +201 -0
  419. package/packages/config-eslint/node_modules/eslint/lib/rules/no-whitespace-before-property.js +116 -0
  420. package/packages/config-eslint/node_modules/eslint/lib/rules/no-with.js +39 -0
  421. package/packages/config-eslint/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +127 -0
  422. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-newline.js +324 -0
  423. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-spacing.js +311 -0
  424. package/packages/config-eslint/node_modules/eslint/lib/rules/object-property-newline.js +102 -0
  425. package/packages/config-eslint/node_modules/eslint/lib/rules/object-shorthand.js +521 -0
  426. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +95 -0
  427. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var.js +567 -0
  428. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-assignment.js +209 -0
  429. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-linebreak.js +253 -0
  430. package/packages/config-eslint/node_modules/eslint/lib/rules/padded-blocks.js +310 -0
  431. package/packages/config-eslint/node_modules/eslint/lib/rules/padding-line-between-statements.js +590 -0
  432. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-arrow-callback.js +381 -0
  433. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-const.js +501 -0
  434. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-destructuring.js +301 -0
  435. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +191 -0
  436. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-named-capture-group.js +178 -0
  437. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-numeric-literals.js +148 -0
  438. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-has-own.js +114 -0
  439. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-spread.js +298 -0
  440. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +132 -0
  441. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-reflect.js +127 -0
  442. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-regex-literals.js +507 -0
  443. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-rest-params.js +118 -0
  444. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-spread.js +87 -0
  445. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-template.js +275 -0
  446. package/packages/config-eslint/node_modules/eslint/lib/rules/quote-props.js +310 -0
  447. package/packages/config-eslint/node_modules/eslint/lib/rules/quotes.js +350 -0
  448. package/packages/config-eslint/node_modules/eslint/lib/rules/radix.js +198 -0
  449. package/packages/config-eslint/node_modules/eslint/lib/rules/require-atomic-updates.js +331 -0
  450. package/packages/config-eslint/node_modules/eslint/lib/rules/require-await.js +147 -0
  451. package/packages/config-eslint/node_modules/eslint/lib/rules/require-unicode-regexp.js +129 -0
  452. package/packages/config-eslint/node_modules/eslint/lib/rules/require-yield.js +77 -0
  453. package/packages/config-eslint/node_modules/eslint/lib/rules/rest-spread-spacing.js +123 -0
  454. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-spacing.js +248 -0
  455. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-style.js +158 -0
  456. package/packages/config-eslint/node_modules/eslint/lib/rules/semi.js +438 -0
  457. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-imports.js +241 -0
  458. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-keys.js +230 -0
  459. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-vars.js +104 -0
  460. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-blocks.js +204 -0
  461. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-function-paren.js +167 -0
  462. package/packages/config-eslint/node_modules/eslint/lib/rules/space-in-parens.js +285 -0
  463. package/packages/config-eslint/node_modules/eslint/lib/rules/space-infix-ops.js +198 -0
  464. package/packages/config-eslint/node_modules/eslint/lib/rules/space-unary-ops.js +324 -0
  465. package/packages/config-eslint/node_modules/eslint/lib/rules/spaced-comment.js +385 -0
  466. package/packages/config-eslint/node_modules/eslint/lib/rules/strict.js +277 -0
  467. package/packages/config-eslint/node_modules/eslint/lib/rules/switch-colon-spacing.js +132 -0
  468. package/packages/config-eslint/node_modules/eslint/lib/rules/symbol-description.js +73 -0
  469. package/packages/config-eslint/node_modules/eslint/lib/rules/template-curly-spacing.js +144 -0
  470. package/packages/config-eslint/node_modules/eslint/lib/rules/template-tag-spacing.js +93 -0
  471. package/packages/config-eslint/node_modules/eslint/lib/rules/unicode-bom.js +73 -0
  472. package/packages/config-eslint/node_modules/eslint/lib/rules/use-isnan.js +235 -0
  473. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/ast-utils.js +2292 -0
  474. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/char-source.js +240 -0
  475. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/fix-tracker.js +114 -0
  476. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/keywords.js +67 -0
  477. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +115 -0
  478. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/regular-expressions.js +42 -0
  479. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/index.js +16 -0
  480. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +13 -0
  481. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +13 -0
  482. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +13 -0
  483. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +14 -0
  484. package/packages/config-eslint/node_modules/eslint/lib/rules/valid-typeof.js +127 -0
  485. package/packages/config-eslint/node_modules/eslint/lib/rules/vars-on-top.js +157 -0
  486. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-iife.js +207 -0
  487. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-regex.js +61 -0
  488. package/packages/config-eslint/node_modules/eslint/lib/rules/yield-star-spacing.js +130 -0
  489. package/packages/config-eslint/node_modules/eslint/lib/rules/yoda.js +353 -0
  490. package/packages/config-eslint/node_modules/eslint/lib/shared/ajv.js +34 -0
  491. package/packages/config-eslint/node_modules/eslint/lib/shared/ast-utils.js +29 -0
  492. package/packages/config-eslint/node_modules/eslint/lib/shared/directives.js +15 -0
  493. package/packages/config-eslint/node_modules/eslint/lib/shared/flags.js +27 -0
  494. package/packages/config-eslint/node_modules/eslint/lib/shared/logging.js +39 -0
  495. package/packages/config-eslint/node_modules/eslint/lib/shared/runtime-info.js +168 -0
  496. package/packages/config-eslint/node_modules/eslint/lib/shared/serialization.js +55 -0
  497. package/packages/config-eslint/node_modules/eslint/lib/shared/severity.js +49 -0
  498. package/packages/config-eslint/node_modules/eslint/lib/shared/stats.js +30 -0
  499. package/packages/config-eslint/node_modules/eslint/lib/shared/string-utils.js +58 -0
  500. package/packages/config-eslint/node_modules/eslint/lib/shared/traverser.js +195 -0
  501. package/packages/config-eslint/node_modules/eslint/lib/shared/types.js +250 -0
  502. package/packages/config-eslint/node_modules/eslint/lib/unsupported-api.js +28 -0
  503. package/packages/config-eslint/node_modules/eslint/messages/all-files-ignored.js +16 -0
  504. package/packages/config-eslint/node_modules/eslint/messages/all-matched-files-ignored.js +21 -0
  505. package/packages/config-eslint/node_modules/eslint/messages/config-file-missing.js +16 -0
  506. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-incompat.js +119 -0
  507. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-plugins.js +24 -0
  508. package/packages/config-eslint/node_modules/eslint/messages/extend-config-missing.js +13 -0
  509. package/packages/config-eslint/node_modules/eslint/messages/failed-to-read-json.js +11 -0
  510. package/packages/config-eslint/node_modules/eslint/messages/file-not-found.js +10 -0
  511. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-options.js +17 -0
  512. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-severity.js +13 -0
  513. package/packages/config-eslint/node_modules/eslint/messages/no-config-found.js +15 -0
  514. package/packages/config-eslint/node_modules/eslint/messages/plugin-conflict.js +22 -0
  515. package/packages/config-eslint/node_modules/eslint/messages/plugin-invalid.js +16 -0
  516. package/packages/config-eslint/node_modules/eslint/messages/plugin-missing.js +19 -0
  517. package/packages/config-eslint/node_modules/eslint/messages/print-config-with-directory-path.js +8 -0
  518. package/packages/config-eslint/node_modules/eslint/messages/shared.js +18 -0
  519. package/packages/config-eslint/node_modules/eslint/messages/whitespace-found.js +11 -0
  520. package/packages/config-eslint/node_modules/eslint/package.json +188 -0
  521. package/packages/config-eslint/node_modules/eslint-scope/LICENSE +22 -0
  522. package/packages/config-eslint/node_modules/eslint-scope/README.md +91 -0
  523. package/packages/config-eslint/node_modules/eslint-scope/dist/eslint-scope.cjs +2266 -0
  524. package/packages/config-eslint/node_modules/eslint-scope/lib/definition.js +85 -0
  525. package/packages/config-eslint/node_modules/eslint-scope/lib/index.js +169 -0
  526. package/packages/config-eslint/node_modules/eslint-scope/lib/pattern-visitor.js +154 -0
  527. package/packages/config-eslint/node_modules/eslint-scope/lib/reference.js +166 -0
  528. package/packages/config-eslint/node_modules/eslint-scope/lib/referencer.js +656 -0
  529. package/packages/config-eslint/node_modules/eslint-scope/lib/scope-manager.js +249 -0
  530. package/packages/config-eslint/node_modules/eslint-scope/lib/scope.js +793 -0
  531. package/packages/config-eslint/node_modules/eslint-scope/lib/variable.js +87 -0
  532. package/packages/config-eslint/node_modules/eslint-scope/lib/version.js +3 -0
  533. package/packages/config-eslint/node_modules/eslint-scope/package.json +65 -0
  534. package/packages/config-eslint/node_modules/file-entry-cache/LICENSE +22 -0
  535. package/packages/config-eslint/node_modules/file-entry-cache/README.md +115 -0
  536. package/packages/config-eslint/node_modules/file-entry-cache/cache.js +291 -0
  537. package/packages/config-eslint/node_modules/file-entry-cache/package.json +56 -0
  538. package/packages/config-eslint/node_modules/find-up/index.d.ts +138 -0
  539. package/packages/config-eslint/node_modules/find-up/index.js +89 -0
  540. package/packages/config-eslint/node_modules/find-up/license +9 -0
  541. package/packages/config-eslint/node_modules/find-up/package.json +54 -0
  542. package/packages/config-eslint/node_modules/find-up/readme.md +151 -0
  543. package/packages/config-eslint/node_modules/flat-cache/LICENSE +22 -0
  544. package/packages/config-eslint/node_modules/flat-cache/README.md +77 -0
  545. package/packages/config-eslint/node_modules/flat-cache/changelog.md +278 -0
  546. package/packages/config-eslint/node_modules/flat-cache/package.json +63 -0
  547. package/packages/config-eslint/node_modules/flat-cache/src/cache.js +214 -0
  548. package/packages/config-eslint/node_modules/flat-cache/src/del.js +30 -0
  549. package/packages/config-eslint/node_modules/flat-cache/src/utils.js +42 -0
  550. package/packages/config-eslint/node_modules/glob-parent/LICENSE +15 -0
  551. package/packages/config-eslint/node_modules/glob-parent/README.md +134 -0
  552. package/packages/config-eslint/node_modules/glob-parent/index.js +75 -0
  553. package/packages/config-eslint/node_modules/glob-parent/package.json +54 -0
  554. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  555. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +8 -0
  556. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +21 -0
  557. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +83 -0
  558. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +89 -0
  559. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +43 -0
  560. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  561. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  562. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  563. package/packages/config-eslint/node_modules/locate-path/index.d.ts +83 -0
  564. package/packages/config-eslint/node_modules/locate-path/index.js +68 -0
  565. package/packages/config-eslint/node_modules/locate-path/license +9 -0
  566. package/packages/config-eslint/node_modules/locate-path/package.json +46 -0
  567. package/packages/config-eslint/node_modules/locate-path/readme.md +125 -0
  568. package/packages/config-eslint/node_modules/p-limit/index.d.ts +42 -0
  569. package/packages/config-eslint/node_modules/p-limit/index.js +71 -0
  570. package/packages/config-eslint/node_modules/p-limit/license +9 -0
  571. package/packages/config-eslint/node_modules/p-limit/package.json +52 -0
  572. package/packages/config-eslint/node_modules/p-limit/readme.md +101 -0
  573. package/packages/config-eslint/node_modules/p-locate/index.d.ts +53 -0
  574. package/packages/config-eslint/node_modules/p-locate/index.js +50 -0
  575. package/packages/config-eslint/node_modules/p-locate/license +9 -0
  576. package/packages/config-eslint/node_modules/p-locate/package.json +54 -0
  577. package/packages/config-eslint/node_modules/p-locate/readme.md +93 -0
  578. package/packages/config-eslint/node_modules/path-exists/index.d.ts +28 -0
  579. package/packages/config-eslint/node_modules/path-exists/index.js +23 -0
  580. package/packages/config-eslint/node_modules/path-exists/license +9 -0
  581. package/packages/config-eslint/node_modules/path-exists/package.json +39 -0
  582. package/packages/config-eslint/node_modules/path-exists/readme.md +52 -0
  583. package/packages/config-eslint/node_modules/yocto-queue/index.d.ts +56 -0
  584. package/packages/config-eslint/node_modules/yocto-queue/index.js +68 -0
  585. package/packages/config-eslint/node_modules/yocto-queue/license +9 -0
  586. package/packages/config-eslint/node_modules/yocto-queue/package.json +43 -0
  587. package/packages/config-eslint/node_modules/yocto-queue/readme.md +64 -0
  588. package/packages/config-eslint/package.json +3 -3
  589. package/packages/config-hooks/package.json +2 -2
  590. package/packages/config-stylelint/package.json +2 -2
@@ -0,0 +1,1318 @@
1
+ /**
2
+ * @fileoverview Abstraction of JavaScript source code.
3
+ * @author Nicholas C. Zakas
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Requirements
9
+ //------------------------------------------------------------------------------
10
+
11
+ const
12
+ { isCommentToken } = require("@eslint-community/eslint-utils"),
13
+ TokenStore = require("./token-store"),
14
+ astUtils = require("../../../shared/ast-utils"),
15
+ Traverser = require("../../../shared/traverser"),
16
+ globals = require("../../../../conf/globals"),
17
+ {
18
+ directivesPattern
19
+ } = require("../../../shared/directives"),
20
+
21
+ CodePathAnalyzer = require("../../../linter/code-path-analysis/code-path-analyzer"),
22
+ createEmitter = require("../../../linter/safe-emitter"),
23
+ ConfigCommentParser = require("../../../linter/config-comment-parser"),
24
+
25
+ eslintScope = require("eslint-scope");
26
+
27
+ //------------------------------------------------------------------------------
28
+ // Type Definitions
29
+ //------------------------------------------------------------------------------
30
+
31
+ /** @typedef {import("eslint-scope").Variable} Variable */
32
+ /** @typedef {import("eslint-scope").Scope} Scope */
33
+ /** @typedef {import("@eslint/core").SourceCode} ISourceCode */
34
+ /** @typedef {import("@eslint/core").Directive} IDirective */
35
+ /** @typedef {import("@eslint/core").TraversalStep} ITraversalStep */
36
+
37
+ //------------------------------------------------------------------------------
38
+ // Private
39
+ //------------------------------------------------------------------------------
40
+
41
+ const commentParser = new ConfigCommentParser();
42
+
43
+ const CODE_PATH_EVENTS = [
44
+ "onCodePathStart",
45
+ "onCodePathEnd",
46
+ "onCodePathSegmentStart",
47
+ "onCodePathSegmentEnd",
48
+ "onCodePathSegmentLoop",
49
+ "onUnreachableCodePathSegmentStart",
50
+ "onUnreachableCodePathSegmentEnd"
51
+ ];
52
+
53
+ /**
54
+ * Validates that the given AST has the required information.
55
+ * @param {ASTNode} ast The Program node of the AST to check.
56
+ * @throws {Error} If the AST doesn't contain the correct information.
57
+ * @returns {void}
58
+ * @private
59
+ */
60
+ function validate(ast) {
61
+ if (!ast.tokens) {
62
+ throw new Error("AST is missing the tokens array.");
63
+ }
64
+
65
+ if (!ast.comments) {
66
+ throw new Error("AST is missing the comments array.");
67
+ }
68
+
69
+ if (!ast.loc) {
70
+ throw new Error("AST is missing location information.");
71
+ }
72
+
73
+ if (!ast.range) {
74
+ throw new Error("AST is missing range information");
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Retrieves globals for the given ecmaVersion.
80
+ * @param {number} ecmaVersion The version to retrieve globals for.
81
+ * @returns {Object} The globals for the given ecmaVersion.
82
+ */
83
+ function getGlobalsForEcmaVersion(ecmaVersion) {
84
+
85
+ switch (ecmaVersion) {
86
+ case 3:
87
+ return globals.es3;
88
+
89
+ case 5:
90
+ return globals.es5;
91
+
92
+ default:
93
+ if (ecmaVersion < 2015) {
94
+ return globals[`es${ecmaVersion + 2009}`];
95
+ }
96
+
97
+ return globals[`es${ecmaVersion}`];
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Check to see if its a ES6 export declaration.
103
+ * @param {ASTNode} astNode An AST node.
104
+ * @returns {boolean} whether the given node represents an export declaration.
105
+ * @private
106
+ */
107
+ function looksLikeExport(astNode) {
108
+ return astNode.type === "ExportDefaultDeclaration" || astNode.type === "ExportNamedDeclaration" ||
109
+ astNode.type === "ExportAllDeclaration" || astNode.type === "ExportSpecifier";
110
+ }
111
+
112
+ /**
113
+ * Merges two sorted lists into a larger sorted list in O(n) time.
114
+ * @param {Token[]} tokens The list of tokens.
115
+ * @param {Token[]} comments The list of comments.
116
+ * @returns {Token[]} A sorted list of tokens and comments.
117
+ * @private
118
+ */
119
+ function sortedMerge(tokens, comments) {
120
+ const result = [];
121
+ let tokenIndex = 0;
122
+ let commentIndex = 0;
123
+
124
+ while (tokenIndex < tokens.length || commentIndex < comments.length) {
125
+ if (commentIndex >= comments.length || tokenIndex < tokens.length && tokens[tokenIndex].range[0] < comments[commentIndex].range[0]) {
126
+ result.push(tokens[tokenIndex++]);
127
+ } else {
128
+ result.push(comments[commentIndex++]);
129
+ }
130
+ }
131
+
132
+ return result;
133
+ }
134
+
135
+ /**
136
+ * Normalizes a value for a global in a config
137
+ * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in
138
+ * a global directive comment
139
+ * @returns {("readable"|"writeable"|"off")} The value normalized as a string
140
+ * @throws Error if global value is invalid
141
+ */
142
+ function normalizeConfigGlobal(configuredValue) {
143
+ switch (configuredValue) {
144
+ case "off":
145
+ return "off";
146
+
147
+ case true:
148
+ case "true":
149
+ case "writeable":
150
+ case "writable":
151
+ return "writable";
152
+
153
+ case null:
154
+ case false:
155
+ case "false":
156
+ case "readable":
157
+ case "readonly":
158
+ return "readonly";
159
+
160
+ default:
161
+ throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Determines if two nodes or tokens overlap.
167
+ * @param {ASTNode|Token} first The first node or token to check.
168
+ * @param {ASTNode|Token} second The second node or token to check.
169
+ * @returns {boolean} True if the two nodes or tokens overlap.
170
+ * @private
171
+ */
172
+ function nodesOrTokensOverlap(first, second) {
173
+ return (first.range[0] <= second.range[0] && first.range[1] >= second.range[0]) ||
174
+ (second.range[0] <= first.range[0] && second.range[1] >= first.range[0]);
175
+ }
176
+
177
+ /**
178
+ * Determines if two nodes or tokens have at least one whitespace character
179
+ * between them. Order does not matter. Returns false if the given nodes or
180
+ * tokens overlap.
181
+ * @param {SourceCode} sourceCode The source code object.
182
+ * @param {ASTNode|Token} first The first node or token to check between.
183
+ * @param {ASTNode|Token} second The second node or token to check between.
184
+ * @param {boolean} checkInsideOfJSXText If `true` is present, check inside of JSXText tokens for backward compatibility.
185
+ * @returns {boolean} True if there is a whitespace character between
186
+ * any of the tokens found between the two given nodes or tokens.
187
+ * @public
188
+ */
189
+ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) {
190
+ if (nodesOrTokensOverlap(first, second)) {
191
+ return false;
192
+ }
193
+
194
+ const [startingNodeOrToken, endingNodeOrToken] = first.range[1] <= second.range[0]
195
+ ? [first, second]
196
+ : [second, first];
197
+ const firstToken = sourceCode.getLastToken(startingNodeOrToken) || startingNodeOrToken;
198
+ const finalToken = sourceCode.getFirstToken(endingNodeOrToken) || endingNodeOrToken;
199
+ let currentToken = firstToken;
200
+
201
+ while (currentToken !== finalToken) {
202
+ const nextToken = sourceCode.getTokenAfter(currentToken, { includeComments: true });
203
+
204
+ if (
205
+ currentToken.range[1] !== nextToken.range[0] ||
206
+
207
+ /*
208
+ * For backward compatibility, check spaces in JSXText.
209
+ * https://github.com/eslint/eslint/issues/12614
210
+ */
211
+ (
212
+ checkInsideOfJSXText &&
213
+ nextToken !== finalToken &&
214
+ nextToken.type === "JSXText" &&
215
+ /\s/u.test(nextToken.value)
216
+ )
217
+ ) {
218
+ return true;
219
+ }
220
+
221
+ currentToken = nextToken;
222
+ }
223
+
224
+ return false;
225
+ }
226
+
227
+ //-----------------------------------------------------------------------------
228
+ // Directive Comments
229
+ //-----------------------------------------------------------------------------
230
+
231
+ /**
232
+ * Ensures that variables representing built-in properties of the Global Object,
233
+ * and any globals declared by special block comments, are present in the global
234
+ * scope.
235
+ * @param {Scope} globalScope The global scope.
236
+ * @param {Object|undefined} configGlobals The globals declared in configuration
237
+ * @param {Object|undefined} inlineGlobals The globals declared in the source code
238
+ * @returns {void}
239
+ */
240
+ function addDeclaredGlobals(globalScope, configGlobals = {}, inlineGlobals = {}) {
241
+
242
+ // Define configured global variables.
243
+ for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(inlineGlobals)])) {
244
+
245
+ /*
246
+ * `normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would
247
+ * typically be caught when validating a config anyway (validity for inline global comments is checked separately).
248
+ */
249
+ const configValue = configGlobals[id] === void 0 ? void 0 : normalizeConfigGlobal(configGlobals[id]);
250
+ const commentValue = inlineGlobals[id] && inlineGlobals[id].value;
251
+ const value = commentValue || configValue;
252
+ const sourceComments = inlineGlobals[id] && inlineGlobals[id].comments;
253
+
254
+ if (value === "off") {
255
+ continue;
256
+ }
257
+
258
+ let variable = globalScope.set.get(id);
259
+
260
+ if (!variable) {
261
+ variable = new eslintScope.Variable(id, globalScope);
262
+
263
+ globalScope.variables.push(variable);
264
+ globalScope.set.set(id, variable);
265
+ }
266
+
267
+ variable.eslintImplicitGlobalSetting = configValue;
268
+ variable.eslintExplicitGlobal = sourceComments !== void 0;
269
+ variable.eslintExplicitGlobalComments = sourceComments;
270
+ variable.writeable = (value === "writable");
271
+ }
272
+
273
+ /*
274
+ * "through" contains all references which definitions cannot be found.
275
+ * Since we augment the global scope using configuration, we need to update
276
+ * references and remove the ones that were added by configuration.
277
+ */
278
+ globalScope.through = globalScope.through.filter(reference => {
279
+ const name = reference.identifier.name;
280
+ const variable = globalScope.set.get(name);
281
+
282
+ if (variable) {
283
+
284
+ /*
285
+ * Links the variable and the reference.
286
+ * And this reference is removed from `Scope#through`.
287
+ */
288
+ reference.resolved = variable;
289
+ variable.references.push(reference);
290
+
291
+ return false;
292
+ }
293
+
294
+ return true;
295
+ });
296
+ }
297
+
298
+ /**
299
+ * Sets the given variable names as exported so they won't be triggered by
300
+ * the `no-unused-vars` rule.
301
+ * @param {eslint.Scope} globalScope The global scope to define exports in.
302
+ * @param {Record<string,string>} variables An object whose keys are the variable
303
+ * names to export.
304
+ * @returns {void}
305
+ */
306
+ function markExportedVariables(globalScope, variables) {
307
+
308
+ Object.keys(variables).forEach(name => {
309
+ const variable = globalScope.set.get(name);
310
+
311
+ if (variable) {
312
+ variable.eslintUsed = true;
313
+ variable.eslintExported = true;
314
+ }
315
+ });
316
+
317
+ }
318
+
319
+ const STEP_KIND = {
320
+ visit: 1,
321
+ call: 2
322
+ };
323
+
324
+ /**
325
+ * A class to represent a step in the traversal process.
326
+ */
327
+ class TraversalStep {
328
+
329
+ /**
330
+ * The type of the step.
331
+ * @type {string}
332
+ */
333
+ type;
334
+
335
+ /**
336
+ * The kind of the step. Represents the same data as the `type` property
337
+ * but it's a number for performance.
338
+ * @type {number}
339
+ */
340
+ kind;
341
+
342
+ /**
343
+ * The target of the step.
344
+ * @type {ASTNode|string}
345
+ */
346
+ target;
347
+
348
+ /**
349
+ * The phase of the step.
350
+ * @type {number|undefined}
351
+ */
352
+ phase;
353
+
354
+ /**
355
+ * The arguments of the step.
356
+ * @type {Array<any>}
357
+ */
358
+ args;
359
+
360
+ /**
361
+ * Creates a new instance.
362
+ * @param {Object} options The options for the step.
363
+ * @param {string} options.type The type of the step.
364
+ * @param {ASTNode|string} options.target The target of the step.
365
+ * @param {number|undefined} [options.phase] The phase of the step.
366
+ * @param {Array<any>} options.args The arguments of the step.
367
+ * @returns {void}
368
+ */
369
+ constructor({ type, target, phase, args }) {
370
+ this.type = type;
371
+ this.kind = STEP_KIND[type];
372
+ this.target = target;
373
+ this.phase = phase;
374
+ this.args = args;
375
+ }
376
+ }
377
+
378
+ /**
379
+ * A class to represent a directive comment.
380
+ * @implements {IDirective}
381
+ */
382
+ class Directive {
383
+
384
+ /**
385
+ * The type of directive.
386
+ * @type {"disable"|"enable"|"disable-next-line"|"disable-line"}
387
+ * @readonly
388
+ */
389
+ type;
390
+
391
+ /**
392
+ * The node representing the directive.
393
+ * @type {ASTNode|Comment}
394
+ * @readonly
395
+ */
396
+ node;
397
+
398
+ /**
399
+ * Everything after the "eslint-disable" portion of the directive,
400
+ * but before the "--" that indicates the justification.
401
+ * @type {string}
402
+ * @readonly
403
+ */
404
+ value;
405
+
406
+ /**
407
+ * The justification for the directive.
408
+ * @type {string}
409
+ * @readonly
410
+ */
411
+ justification;
412
+
413
+ /**
414
+ * Creates a new instance.
415
+ * @param {Object} options The options for the directive.
416
+ * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
417
+ * @param {ASTNode|Comment} options.node The node representing the directive.
418
+ * @param {string} options.value The value of the directive.
419
+ * @param {string} options.justification The justification for the directive.
420
+ */
421
+ constructor({ type, node, value, justification }) {
422
+ this.type = type;
423
+ this.node = node;
424
+ this.value = value;
425
+ this.justification = justification;
426
+ }
427
+ }
428
+
429
+ //------------------------------------------------------------------------------
430
+ // Public Interface
431
+ //------------------------------------------------------------------------------
432
+
433
+ const caches = Symbol("caches");
434
+
435
+ /**
436
+ * Represents parsed source code.
437
+ * @implements {ISourceCode}
438
+ */
439
+ class SourceCode extends TokenStore {
440
+
441
+ /**
442
+ * The cache of steps that were taken while traversing the source code.
443
+ * @type {Array<ITraversalStep>}
444
+ */
445
+ #steps;
446
+
447
+ /**
448
+ * Creates a new instance.
449
+ * @param {string|Object} textOrConfig The source code text or config object.
450
+ * @param {string} textOrConfig.text The source code text.
451
+ * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
452
+ * @param {boolean} textOrConfig.hasBOM Indicates if the text has a Unicode BOM.
453
+ * @param {Object|null} textOrConfig.parserServices The parser services.
454
+ * @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code.
455
+ * @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST.
456
+ * @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
457
+ */
458
+ constructor(textOrConfig, astIfNoConfig) {
459
+ let text, hasBOM, ast, parserServices, scopeManager, visitorKeys;
460
+
461
+ // Process overloading of arguments
462
+ if (typeof textOrConfig === "string") {
463
+ text = textOrConfig;
464
+ ast = astIfNoConfig;
465
+ hasBOM = false;
466
+ } else if (typeof textOrConfig === "object" && textOrConfig !== null) {
467
+ text = textOrConfig.text;
468
+ ast = textOrConfig.ast;
469
+ hasBOM = textOrConfig.hasBOM;
470
+ parserServices = textOrConfig.parserServices;
471
+ scopeManager = textOrConfig.scopeManager;
472
+ visitorKeys = textOrConfig.visitorKeys;
473
+ }
474
+
475
+ validate(ast);
476
+ super(ast.tokens, ast.comments);
477
+
478
+ /**
479
+ * General purpose caching for the class.
480
+ */
481
+ this[caches] = new Map([
482
+ ["scopes", new WeakMap()],
483
+ ["vars", new Map()],
484
+ ["configNodes", void 0]
485
+ ]);
486
+
487
+ /**
488
+ * Indicates if the AST is ESTree compatible.
489
+ * @type {boolean}
490
+ */
491
+ this.isESTree = ast.type === "Program";
492
+
493
+ /*
494
+ * Backwards compatibility for BOM handling.
495
+ *
496
+ * The `hasBOM` property has been available on the `SourceCode` object
497
+ * for a long time and is used to indicate if the source contains a BOM.
498
+ * The linter strips the BOM and just passes the `hasBOM` property to the
499
+ * `SourceCode` constructor to make it easier for languages to not deal with
500
+ * the BOM.
501
+ *
502
+ * However, the text passed in to the `SourceCode` constructor might still
503
+ * have a BOM if the constructor is called outside of the linter, so we still
504
+ * need to check for the BOM in the text.
505
+ */
506
+ const textHasBOM = text.charCodeAt(0) === 0xFEFF;
507
+
508
+ /**
509
+ * The flag to indicate that the source code has Unicode BOM.
510
+ * @type {boolean}
511
+ */
512
+ this.hasBOM = textHasBOM || !!hasBOM;
513
+
514
+ /**
515
+ * The original text source code.
516
+ * BOM was stripped from this text.
517
+ * @type {string}
518
+ */
519
+ this.text = (textHasBOM ? text.slice(1) : text);
520
+
521
+ /**
522
+ * The parsed AST for the source code.
523
+ * @type {ASTNode}
524
+ */
525
+ this.ast = ast;
526
+
527
+ /**
528
+ * The parser services of this source code.
529
+ * @type {Object}
530
+ */
531
+ this.parserServices = parserServices || {};
532
+
533
+ /**
534
+ * The scope of this source code.
535
+ * @type {ScopeManager|null}
536
+ */
537
+ this.scopeManager = scopeManager || null;
538
+
539
+ /**
540
+ * The visitor keys to traverse AST.
541
+ * @type {Object}
542
+ */
543
+ this.visitorKeys = visitorKeys || Traverser.DEFAULT_VISITOR_KEYS;
544
+
545
+ // Check the source text for the presence of a shebang since it is parsed as a standard line comment.
546
+ const shebangMatched = this.text.match(astUtils.shebangPattern);
547
+ const hasShebang = shebangMatched && ast.comments.length && ast.comments[0].value === shebangMatched[1];
548
+
549
+ if (hasShebang) {
550
+ ast.comments[0].type = "Shebang";
551
+ }
552
+
553
+ this.tokensAndComments = sortedMerge(ast.tokens, ast.comments);
554
+
555
+ /**
556
+ * The source code split into lines according to ECMA-262 specification.
557
+ * This is done to avoid each rule needing to do so separately.
558
+ * @type {string[]}
559
+ */
560
+ this.lines = [];
561
+ this.lineStartIndices = [0];
562
+
563
+ const lineEndingPattern = astUtils.createGlobalLinebreakMatcher();
564
+ let match;
565
+
566
+ /*
567
+ * Previously, this was implemented using a regex that
568
+ * matched a sequence of non-linebreak characters followed by a
569
+ * linebreak, then adding the lengths of the matches. However,
570
+ * this caused a catastrophic backtracking issue when the end
571
+ * of a file contained a large number of non-newline characters.
572
+ * To avoid this, the current implementation just matches newlines
573
+ * and uses match.index to get the correct line start indices.
574
+ */
575
+ while ((match = lineEndingPattern.exec(this.text))) {
576
+ this.lines.push(this.text.slice(this.lineStartIndices.at(-1), match.index));
577
+ this.lineStartIndices.push(match.index + match[0].length);
578
+ }
579
+ this.lines.push(this.text.slice(this.lineStartIndices.at(-1)));
580
+
581
+ // don't allow further modification of this object
582
+ Object.freeze(this);
583
+ Object.freeze(this.lines);
584
+ }
585
+
586
+ /**
587
+ * Split the source code into multiple lines based on the line delimiters.
588
+ * @param {string} text Source code as a string.
589
+ * @returns {string[]} Array of source code lines.
590
+ * @public
591
+ */
592
+ static splitLines(text) {
593
+ return text.split(astUtils.createGlobalLinebreakMatcher());
594
+ }
595
+
596
+ /**
597
+ * Gets the source code for the given node.
598
+ * @param {ASTNode} [node] The AST node to get the text for.
599
+ * @param {int} [beforeCount] The number of characters before the node to retrieve.
600
+ * @param {int} [afterCount] The number of characters after the node to retrieve.
601
+ * @returns {string} The text representing the AST node.
602
+ * @public
603
+ */
604
+ getText(node, beforeCount, afterCount) {
605
+ if (node) {
606
+ return this.text.slice(Math.max(node.range[0] - (beforeCount || 0), 0),
607
+ node.range[1] + (afterCount || 0));
608
+ }
609
+ return this.text;
610
+ }
611
+
612
+ /**
613
+ * Gets the entire source text split into an array of lines.
614
+ * @returns {Array} The source text as an array of lines.
615
+ * @public
616
+ */
617
+ getLines() {
618
+ return this.lines;
619
+ }
620
+
621
+ /**
622
+ * Retrieves an array containing all comments in the source code.
623
+ * @returns {ASTNode[]} An array of comment nodes.
624
+ * @public
625
+ */
626
+ getAllComments() {
627
+ return this.ast.comments;
628
+ }
629
+
630
+ /**
631
+ * Retrieves the JSDoc comment for a given node.
632
+ * @param {ASTNode} node The AST node to get the comment for.
633
+ * @returns {Token|null} The Block comment token containing the JSDoc comment
634
+ * for the given node or null if not found.
635
+ * @public
636
+ * @deprecated
637
+ */
638
+ getJSDocComment(node) {
639
+
640
+ /**
641
+ * Checks for the presence of a JSDoc comment for the given node and returns it.
642
+ * @param {ASTNode} astNode The AST node to get the comment for.
643
+ * @returns {Token|null} The Block comment token containing the JSDoc comment
644
+ * for the given node or null if not found.
645
+ * @private
646
+ */
647
+ const findJSDocComment = astNode => {
648
+ const tokenBefore = this.getTokenBefore(astNode, { includeComments: true });
649
+
650
+ if (
651
+ tokenBefore &&
652
+ isCommentToken(tokenBefore) &&
653
+ tokenBefore.type === "Block" &&
654
+ tokenBefore.value.charAt(0) === "*" &&
655
+ astNode.loc.start.line - tokenBefore.loc.end.line <= 1
656
+ ) {
657
+ return tokenBefore;
658
+ }
659
+
660
+ return null;
661
+ };
662
+ let parent = node.parent;
663
+
664
+ switch (node.type) {
665
+ case "ClassDeclaration":
666
+ case "FunctionDeclaration":
667
+ return findJSDocComment(looksLikeExport(parent) ? parent : node);
668
+
669
+ case "ClassExpression":
670
+ return findJSDocComment(parent.parent);
671
+
672
+ case "ArrowFunctionExpression":
673
+ case "FunctionExpression":
674
+ if (parent.type !== "CallExpression" && parent.type !== "NewExpression") {
675
+ while (
676
+ !this.getCommentsBefore(parent).length &&
677
+ !/Function/u.test(parent.type) &&
678
+ parent.type !== "MethodDefinition" &&
679
+ parent.type !== "Property"
680
+ ) {
681
+ parent = parent.parent;
682
+
683
+ if (!parent) {
684
+ break;
685
+ }
686
+ }
687
+
688
+ if (parent && parent.type !== "FunctionDeclaration" && parent.type !== "Program") {
689
+ return findJSDocComment(parent);
690
+ }
691
+ }
692
+
693
+ return findJSDocComment(node);
694
+
695
+ // falls through
696
+ default:
697
+ return null;
698
+ }
699
+ }
700
+
701
+ /**
702
+ * Gets the deepest node containing a range index.
703
+ * @param {int} index Range index of the desired node.
704
+ * @returns {ASTNode} The node if found or null if not found.
705
+ * @public
706
+ */
707
+ getNodeByRangeIndex(index) {
708
+ let result = null;
709
+
710
+ Traverser.traverse(this.ast, {
711
+ visitorKeys: this.visitorKeys,
712
+ enter(node) {
713
+ if (node.range[0] <= index && index < node.range[1]) {
714
+ result = node;
715
+ } else {
716
+ this.skip();
717
+ }
718
+ },
719
+ leave(node) {
720
+ if (node === result) {
721
+ this.break();
722
+ }
723
+ }
724
+ });
725
+
726
+ return result;
727
+ }
728
+
729
+ /**
730
+ * Determines if two nodes or tokens have at least one whitespace character
731
+ * between them. Order does not matter. Returns false if the given nodes or
732
+ * tokens overlap.
733
+ * @param {ASTNode|Token} first The first node or token to check between.
734
+ * @param {ASTNode|Token} second The second node or token to check between.
735
+ * @returns {boolean} True if there is a whitespace character between
736
+ * any of the tokens found between the two given nodes or tokens.
737
+ * @public
738
+ */
739
+ isSpaceBetween(first, second) {
740
+ return isSpaceBetween(this, first, second, false);
741
+ }
742
+
743
+ /**
744
+ * Determines if two nodes or tokens have at least one whitespace character
745
+ * between them. Order does not matter. Returns false if the given nodes or
746
+ * tokens overlap.
747
+ * For backward compatibility, this method returns true if there are
748
+ * `JSXText` tokens that contain whitespaces between the two.
749
+ * @param {ASTNode|Token} first The first node or token to check between.
750
+ * @param {ASTNode|Token} second The second node or token to check between.
751
+ * @returns {boolean} True if there is a whitespace character between
752
+ * any of the tokens found between the two given nodes or tokens.
753
+ * @deprecated in favor of isSpaceBetween().
754
+ * @public
755
+ */
756
+ isSpaceBetweenTokens(first, second) {
757
+ return isSpaceBetween(this, first, second, true);
758
+ }
759
+
760
+ /**
761
+ * Converts a source text index into a (line, column) pair.
762
+ * @param {number} index The index of a character in a file
763
+ * @throws {TypeError} If non-numeric index or index out of range.
764
+ * @returns {Object} A {line, column} location object with a 0-indexed column
765
+ * @public
766
+ */
767
+ getLocFromIndex(index) {
768
+ if (typeof index !== "number") {
769
+ throw new TypeError("Expected `index` to be a number.");
770
+ }
771
+
772
+ if (index < 0 || index > this.text.length) {
773
+ throw new RangeError(`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`);
774
+ }
775
+
776
+ /*
777
+ * For an argument of this.text.length, return the location one "spot" past the last character
778
+ * of the file. If the last character is a linebreak, the location will be column 0 of the next
779
+ * line; otherwise, the location will be in the next column on the same line.
780
+ *
781
+ * See getIndexFromLoc for the motivation for this special case.
782
+ */
783
+ if (index === this.text.length) {
784
+ return { line: this.lines.length, column: this.lines.at(-1).length };
785
+ }
786
+
787
+ /*
788
+ * To figure out which line index is on, determine the last place at which index could
789
+ * be inserted into lineStartIndices to keep the list sorted.
790
+ */
791
+ const lineNumber = index >= this.lineStartIndices.at(-1)
792
+ ? this.lineStartIndices.length
793
+ : this.lineStartIndices.findIndex(el => index < el);
794
+
795
+ return { line: lineNumber, column: index - this.lineStartIndices[lineNumber - 1] };
796
+ }
797
+
798
+ /**
799
+ * Converts a (line, column) pair into a range index.
800
+ * @param {Object} loc A line/column location
801
+ * @param {number} loc.line The line number of the location (1-indexed)
802
+ * @param {number} loc.column The column number of the location (0-indexed)
803
+ * @throws {TypeError|RangeError} If `loc` is not an object with a numeric
804
+ * `line` and `column`, if the `line` is less than or equal to zero or
805
+ * the line or column is out of the expected range.
806
+ * @returns {number} The range index of the location in the file.
807
+ * @public
808
+ */
809
+ getIndexFromLoc(loc) {
810
+ if (typeof loc !== "object" || typeof loc.line !== "number" || typeof loc.column !== "number") {
811
+ throw new TypeError("Expected `loc` to be an object with numeric `line` and `column` properties.");
812
+ }
813
+
814
+ if (loc.line <= 0) {
815
+ throw new RangeError(`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`);
816
+ }
817
+
818
+ if (loc.line > this.lineStartIndices.length) {
819
+ throw new RangeError(`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`);
820
+ }
821
+
822
+ const lineStartIndex = this.lineStartIndices[loc.line - 1];
823
+ const lineEndIndex = loc.line === this.lineStartIndices.length ? this.text.length : this.lineStartIndices[loc.line];
824
+ const positionIndex = lineStartIndex + loc.column;
825
+
826
+ /*
827
+ * By design, getIndexFromLoc({ line: lineNum, column: 0 }) should return the start index of
828
+ * the given line, provided that the line number is valid element of this.lines. Since the
829
+ * last element of this.lines is an empty string for files with trailing newlines, add a
830
+ * special case where getting the index for the first location after the end of the file
831
+ * will return the length of the file, rather than throwing an error. This allows rules to
832
+ * use getIndexFromLoc consistently without worrying about edge cases at the end of a file.
833
+ */
834
+ if (
835
+ loc.line === this.lineStartIndices.length && positionIndex > lineEndIndex ||
836
+ loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex
837
+ ) {
838
+ throw new RangeError(`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`);
839
+ }
840
+
841
+ return positionIndex;
842
+ }
843
+
844
+ /**
845
+ * Gets the scope for the given node
846
+ * @param {ASTNode} currentNode The node to get the scope of
847
+ * @returns {Scope} The scope information for this node
848
+ * @throws {TypeError} If the `currentNode` argument is missing.
849
+ */
850
+ getScope(currentNode) {
851
+
852
+ if (!currentNode) {
853
+ throw new TypeError("Missing required argument: node.");
854
+ }
855
+
856
+ // check cache first
857
+ const cache = this[caches].get("scopes");
858
+ const cachedScope = cache.get(currentNode);
859
+
860
+ if (cachedScope) {
861
+ return cachedScope;
862
+ }
863
+
864
+ // On Program node, get the outermost scope to avoid return Node.js special function scope or ES modules scope.
865
+ const inner = currentNode.type !== "Program";
866
+
867
+ for (let node = currentNode; node; node = node.parent) {
868
+ const scope = this.scopeManager.acquire(node, inner);
869
+
870
+ if (scope) {
871
+ if (scope.type === "function-expression-name") {
872
+ cache.set(currentNode, scope.childScopes[0]);
873
+ return scope.childScopes[0];
874
+ }
875
+
876
+ cache.set(currentNode, scope);
877
+ return scope;
878
+ }
879
+ }
880
+
881
+ cache.set(currentNode, this.scopeManager.scopes[0]);
882
+ return this.scopeManager.scopes[0];
883
+ }
884
+
885
+ /**
886
+ * Get the variables that `node` defines.
887
+ * This is a convenience method that passes through
888
+ * to the same method on the `scopeManager`.
889
+ * @param {ASTNode} node The node for which the variables are obtained.
890
+ * @returns {Array<Variable>} An array of variable nodes representing
891
+ * the variables that `node` defines.
892
+ */
893
+ getDeclaredVariables(node) {
894
+ return this.scopeManager.getDeclaredVariables(node);
895
+ }
896
+
897
+ /* eslint-disable class-methods-use-this -- node is owned by SourceCode */
898
+ /**
899
+ * Gets all the ancestors of a given node
900
+ * @param {ASTNode} node The node
901
+ * @returns {Array<ASTNode>} All the ancestor nodes in the AST, not including the provided node, starting
902
+ * from the root node at index 0 and going inwards to the parent node.
903
+ * @throws {TypeError} When `node` is missing.
904
+ */
905
+ getAncestors(node) {
906
+
907
+ if (!node) {
908
+ throw new TypeError("Missing required argument: node.");
909
+ }
910
+
911
+ const ancestorsStartingAtParent = [];
912
+
913
+ for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
914
+ ancestorsStartingAtParent.push(ancestor);
915
+ }
916
+
917
+ return ancestorsStartingAtParent.reverse();
918
+ }
919
+
920
+ /**
921
+ * Returns the location of the given node or token.
922
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the location of.
923
+ * @returns {SourceLocation} The location of the node or token.
924
+ */
925
+ getLoc(nodeOrToken) {
926
+ return nodeOrToken.loc;
927
+ }
928
+
929
+ /**
930
+ * Returns the range of the given node or token.
931
+ * @param {ASTNode|Token} nodeOrToken The node or token to get the range of.
932
+ * @returns {[number, number]} The range of the node or token.
933
+ */
934
+ getRange(nodeOrToken) {
935
+ return nodeOrToken.range;
936
+ }
937
+
938
+ /* eslint-enable class-methods-use-this -- node is owned by SourceCode */
939
+
940
+ /**
941
+ * Marks a variable as used in the current scope
942
+ * @param {string} name The name of the variable to mark as used.
943
+ * @param {ASTNode} [refNode] The closest node to the variable reference.
944
+ * @returns {boolean} True if the variable was found and marked as used, false if not.
945
+ */
946
+ markVariableAsUsed(name, refNode = this.ast) {
947
+
948
+ const currentScope = this.getScope(refNode);
949
+ let initialScope = currentScope;
950
+
951
+ /*
952
+ * When we are in an ESM or CommonJS module, we need to start searching
953
+ * from the top-level scope, not the global scope. For ESM the top-level
954
+ * scope is the module scope; for CommonJS the top-level scope is the
955
+ * outer function scope.
956
+ *
957
+ * Without this check, we might miss a variable declared with `var` at
958
+ * the top-level because it won't exist in the global scope.
959
+ */
960
+ if (
961
+ currentScope.type === "global" &&
962
+ currentScope.childScopes.length > 0 &&
963
+
964
+ // top-level scopes refer to a `Program` node
965
+ currentScope.childScopes[0].block === this.ast
966
+ ) {
967
+ initialScope = currentScope.childScopes[0];
968
+ }
969
+
970
+ for (let scope = initialScope; scope; scope = scope.upper) {
971
+ const variable = scope.variables.find(scopeVar => scopeVar.name === name);
972
+
973
+ if (variable) {
974
+ variable.eslintUsed = true;
975
+ return true;
976
+ }
977
+ }
978
+
979
+ return false;
980
+ }
981
+
982
+
983
+ /**
984
+ * Returns an array of all inline configuration nodes found in the
985
+ * source code.
986
+ * @returns {Array<Token>} An array of all inline configuration nodes.
987
+ */
988
+ getInlineConfigNodes() {
989
+
990
+ // check the cache first
991
+ let configNodes = this[caches].get("configNodes");
992
+
993
+ if (configNodes) {
994
+ return configNodes;
995
+ }
996
+
997
+ // calculate fresh config nodes
998
+ configNodes = this.ast.comments.filter(comment => {
999
+
1000
+ // shebang comments are never directives
1001
+ if (comment.type === "Shebang") {
1002
+ return false;
1003
+ }
1004
+
1005
+ const { directivePart } = commentParser.extractDirectiveComment(comment.value);
1006
+
1007
+ const directiveMatch = directivesPattern.exec(directivePart);
1008
+
1009
+ if (!directiveMatch) {
1010
+ return false;
1011
+ }
1012
+
1013
+ // only certain comment types are supported as line comments
1014
+ return comment.type !== "Line" || !!/^eslint-disable-(next-)?line$/u.test(directiveMatch[1]);
1015
+ });
1016
+
1017
+ this[caches].set("configNodes", configNodes);
1018
+
1019
+ return configNodes;
1020
+ }
1021
+
1022
+ /**
1023
+ * Returns an all directive nodes that enable or disable rules along with any problems
1024
+ * encountered while parsing the directives.
1025
+ * @returns {{problems:Array<Problem>,directives:Array<Directive>}} Information
1026
+ * that ESLint needs to further process the directives.
1027
+ */
1028
+ getDisableDirectives() {
1029
+
1030
+ // check the cache first
1031
+ const cachedDirectives = this[caches].get("disableDirectives");
1032
+
1033
+ if (cachedDirectives) {
1034
+ return cachedDirectives;
1035
+ }
1036
+
1037
+ const problems = [];
1038
+ const directives = [];
1039
+
1040
+ this.getInlineConfigNodes().forEach(comment => {
1041
+ const { directivePart, justificationPart } = commentParser.extractDirectiveComment(comment.value);
1042
+
1043
+ // Step 1: Extract the directive text
1044
+ const match = directivesPattern.exec(directivePart);
1045
+
1046
+ if (!match) {
1047
+ return;
1048
+ }
1049
+
1050
+ const directiveText = match[1];
1051
+
1052
+ // Step 2: Extract the directive value
1053
+ const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(directiveText);
1054
+
1055
+ if (comment.type === "Line" && !lineCommentSupported) {
1056
+ return;
1057
+ }
1058
+
1059
+ // Step 3: Validate the directive does not span multiple lines
1060
+ if (directiveText === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) {
1061
+ const message = `${directiveText} comment should not span multiple lines.`;
1062
+
1063
+ problems.push({
1064
+ ruleId: null,
1065
+ message,
1066
+ loc: comment.loc
1067
+ });
1068
+ return;
1069
+ }
1070
+
1071
+ // Step 4: Extract the directive value and create the Directive object
1072
+ const directiveValue = directivePart.slice(match.index + directiveText.length);
1073
+
1074
+ switch (directiveText) {
1075
+ case "eslint-disable":
1076
+ case "eslint-enable":
1077
+ case "eslint-disable-next-line":
1078
+ case "eslint-disable-line": {
1079
+ const directiveType = directiveText.slice("eslint-".length);
1080
+
1081
+ directives.push(new Directive({
1082
+ type: directiveType,
1083
+ node: comment,
1084
+ value: directiveValue,
1085
+ justification: justificationPart
1086
+ }));
1087
+ }
1088
+
1089
+ // no default
1090
+ }
1091
+ });
1092
+
1093
+ const result = { problems, directives };
1094
+
1095
+ this[caches].set("disableDirectives", result);
1096
+
1097
+ return result;
1098
+ }
1099
+
1100
+ /**
1101
+ * Applies language options sent in from the core.
1102
+ * @param {Object} languageOptions The language options for this run.
1103
+ * @returns {void}
1104
+ */
1105
+ applyLanguageOptions(languageOptions) {
1106
+
1107
+ /*
1108
+ * Add configured globals and language globals
1109
+ *
1110
+ * Using Object.assign instead of object spread for performance reasons
1111
+ * https://github.com/eslint/eslint/issues/16302
1112
+ */
1113
+ const configGlobals = Object.assign(
1114
+ Object.create(null), // https://github.com/eslint/eslint/issues/18363
1115
+ getGlobalsForEcmaVersion(languageOptions.ecmaVersion),
1116
+ languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0,
1117
+ languageOptions.globals
1118
+ );
1119
+ const varsCache = this[caches].get("vars");
1120
+
1121
+ varsCache.set("configGlobals", configGlobals);
1122
+ }
1123
+
1124
+ /**
1125
+ * Applies configuration found inside of the source code. This method is only
1126
+ * called when ESLint is running with inline configuration allowed.
1127
+ * @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,loc:Location}}} Information
1128
+ * that ESLint needs to further process the inline configuration.
1129
+ */
1130
+ applyInlineConfig() {
1131
+
1132
+ const problems = [];
1133
+ const configs = [];
1134
+ const exportedVariables = {};
1135
+ const inlineGlobals = Object.create(null);
1136
+
1137
+ this.getInlineConfigNodes().forEach(comment => {
1138
+
1139
+ const { directiveText, directiveValue } = commentParser.parseDirective(comment);
1140
+
1141
+ switch (directiveText) {
1142
+ case "exported":
1143
+ Object.assign(exportedVariables, commentParser.parseListConfig(directiveValue, comment));
1144
+ break;
1145
+
1146
+ case "globals":
1147
+ case "global":
1148
+ for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) {
1149
+ let normalizedValue;
1150
+
1151
+ try {
1152
+ normalizedValue = normalizeConfigGlobal(value);
1153
+ } catch (err) {
1154
+ problems.push({
1155
+ ruleId: null,
1156
+ loc: comment.loc,
1157
+ message: err.message
1158
+ });
1159
+ continue;
1160
+ }
1161
+
1162
+ if (inlineGlobals[id]) {
1163
+ inlineGlobals[id].comments.push(comment);
1164
+ inlineGlobals[id].value = normalizedValue;
1165
+ } else {
1166
+ inlineGlobals[id] = {
1167
+ comments: [comment],
1168
+ value: normalizedValue
1169
+ };
1170
+ }
1171
+ }
1172
+ break;
1173
+
1174
+ case "eslint": {
1175
+ const parseResult = commentParser.parseJsonConfig(directiveValue);
1176
+
1177
+ if (parseResult.success) {
1178
+ configs.push({
1179
+ config: {
1180
+ rules: parseResult.config
1181
+ },
1182
+ loc: comment.loc
1183
+ });
1184
+ } else {
1185
+ problems.push({
1186
+ ruleId: null,
1187
+ loc: comment.loc,
1188
+ message: parseResult.error.message
1189
+ });
1190
+ }
1191
+
1192
+ break;
1193
+ }
1194
+
1195
+ // no default
1196
+ }
1197
+ });
1198
+
1199
+ // save all the new variables for later
1200
+ const varsCache = this[caches].get("vars");
1201
+
1202
+ varsCache.set("inlineGlobals", inlineGlobals);
1203
+ varsCache.set("exportedVariables", exportedVariables);
1204
+
1205
+ return {
1206
+ configs,
1207
+ problems
1208
+ };
1209
+ }
1210
+
1211
+ /**
1212
+ * Called by ESLint core to indicate that it has finished providing
1213
+ * information. We now add in all the missing variables and ensure that
1214
+ * state-changing methods cannot be called by rules.
1215
+ * @returns {void}
1216
+ */
1217
+ finalize() {
1218
+
1219
+ const varsCache = this[caches].get("vars");
1220
+ const configGlobals = varsCache.get("configGlobals");
1221
+ const inlineGlobals = varsCache.get("inlineGlobals");
1222
+ const exportedVariables = varsCache.get("exportedVariables");
1223
+ const globalScope = this.scopeManager.scopes[0];
1224
+
1225
+ addDeclaredGlobals(globalScope, configGlobals, inlineGlobals);
1226
+
1227
+ if (exportedVariables) {
1228
+ markExportedVariables(globalScope, exportedVariables);
1229
+ }
1230
+
1231
+ }
1232
+
1233
+ /**
1234
+ * Traverse the source code and return the steps that were taken.
1235
+ * @returns {Array<TraversalStep>} The steps that were taken while traversing the source code.
1236
+ */
1237
+ traverse() {
1238
+
1239
+ // Because the AST doesn't mutate, we can cache the steps
1240
+ if (this.#steps) {
1241
+ return this.#steps;
1242
+ }
1243
+
1244
+ const steps = this.#steps = [];
1245
+
1246
+ /*
1247
+ * This logic works for any AST, not just ESTree. Because ESLint has allowed
1248
+ * custom parsers to return any AST, we need to ensure that the traversal
1249
+ * logic works for any AST.
1250
+ */
1251
+ const emitter = createEmitter();
1252
+ let analyzer = {
1253
+ enterNode(node) {
1254
+ steps.push(new TraversalStep({
1255
+ type: "visit",
1256
+ target: node,
1257
+ phase: 1,
1258
+ args: [node, node.parent]
1259
+ }));
1260
+ },
1261
+ leaveNode(node) {
1262
+ steps.push(new TraversalStep({
1263
+ type: "visit",
1264
+ target: node,
1265
+ phase: 2,
1266
+ args: [node, node.parent]
1267
+ }));
1268
+ },
1269
+ emitter
1270
+ };
1271
+
1272
+ /*
1273
+ * We do code path analysis for ESTree only. Code path analysis is not
1274
+ * necessary for other ASTs, and it's also not possible to do for other
1275
+ * ASTs because the necessary information is not available.
1276
+ *
1277
+ * Generally speaking, we can tell that the AST is an ESTree if it has a
1278
+ * Program node at the top level. This is not a perfect heuristic, but it
1279
+ * is good enough for now.
1280
+ */
1281
+ if (this.isESTree) {
1282
+ analyzer = new CodePathAnalyzer(analyzer);
1283
+
1284
+ CODE_PATH_EVENTS.forEach(eventName => {
1285
+ emitter.on(eventName, (...args) => {
1286
+ steps.push(new TraversalStep({
1287
+ type: "call",
1288
+ target: eventName,
1289
+ args
1290
+ }));
1291
+ });
1292
+ });
1293
+ }
1294
+
1295
+ /*
1296
+ * The actual AST traversal is done by the `Traverser` class. This class
1297
+ * is responsible for walking the AST and calling the appropriate methods
1298
+ * on the `analyzer` object, which is appropriate for the given AST.
1299
+ */
1300
+ Traverser.traverse(this.ast, {
1301
+ enter(node, parent) {
1302
+
1303
+ // save the parent node on a property for backwards compatibility
1304
+ node.parent = parent;
1305
+
1306
+ analyzer.enterNode(node);
1307
+ },
1308
+ leave(node) {
1309
+ analyzer.leaveNode(node);
1310
+ },
1311
+ visitorKeys: this.visitorKeys
1312
+ });
1313
+
1314
+ return steps;
1315
+ }
1316
+ }
1317
+
1318
+ module.exports = SourceCode;