@alexlit/lint-kit 173.3.0 → 175.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 (670) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/node_modules/@eslint/config-array/LICENSE +201 -0
  3. package/packages/config-eslint/node_modules/@eslint/config-array/README.md +368 -0
  4. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs +1536 -0
  5. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.d.cts +144 -0
  6. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs +1336 -0
  7. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs +1678 -0
  8. package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/types.cts +29 -0
  9. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.d.ts +144 -0
  10. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.js +1511 -0
  11. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/posix.js +1314 -0
  12. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/windows.js +1656 -0
  13. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.d.ts +23 -0
  14. package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.ts +29 -0
  15. package/packages/config-eslint/node_modules/@eslint/config-array/package.json +65 -0
  16. package/packages/config-eslint/node_modules/@eslint/config-helpers/LICENSE +201 -0
  17. package/packages/config-eslint/node_modules/@eslint/config-helpers/README.md +97 -0
  18. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.cjs +588 -0
  19. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts +26 -0
  20. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/types.cts +29 -0
  21. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.d.ts +26 -0
  22. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.js +586 -0
  23. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.d.ts +23 -0
  24. package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.ts +29 -0
  25. package/packages/config-eslint/node_modules/@eslint/config-helpers/package.json +60 -0
  26. package/packages/config-eslint/node_modules/@eslint/js/LICENSE +19 -0
  27. package/packages/config-eslint/node_modules/@eslint/js/README.md +103 -0
  28. package/packages/config-eslint/node_modules/@eslint/js/package.json +44 -0
  29. package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-all.js +210 -0
  30. package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-recommended.js +75 -0
  31. package/packages/config-eslint/node_modules/@eslint/js/src/index.js +23 -0
  32. package/packages/config-eslint/node_modules/@eslint/js/types/index.d.ts +14 -0
  33. package/packages/config-eslint/node_modules/@eslint/object-schema/LICENSE +201 -0
  34. package/packages/config-eslint/node_modules/@eslint/object-schema/README.md +243 -0
  35. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.cjs +459 -0
  36. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.d.cts +127 -0
  37. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/types.cts +57 -0
  38. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.d.ts +127 -0
  39. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.js +456 -0
  40. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.d.ts +40 -0
  41. package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.ts +57 -0
  42. package/packages/config-eslint/node_modules/@eslint/object-schema/package.json +62 -0
  43. package/packages/config-eslint/node_modules/@eslint/plugin-kit/LICENSE +201 -0
  44. package/packages/config-eslint/node_modules/@eslint/plugin-kit/README.md +273 -0
  45. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +895 -0
  46. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +329 -0
  47. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/types.cts +81 -0
  48. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +329 -0
  49. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.js +890 -0
  50. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +46 -0
  51. package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.ts +81 -0
  52. package/packages/config-eslint/node_modules/@eslint/plugin-kit/package.json +62 -0
  53. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +20 -0
  54. package/packages/config-eslint/node_modules/ajv/LICENSE +22 -0
  55. package/packages/config-eslint/node_modules/ajv/README.md +1497 -0
  56. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +7189 -0
  57. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +3 -0
  58. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +1 -0
  59. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +397 -0
  60. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +506 -0
  61. package/packages/config-eslint/node_modules/ajv/lib/cache.js +26 -0
  62. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +90 -0
  63. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +5 -0
  64. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +34 -0
  65. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +142 -0
  66. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +387 -0
  67. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +270 -0
  68. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +66 -0
  69. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +9 -0
  70. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +20 -0
  71. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +239 -0
  72. package/packages/config-eslint/node_modules/ajv/lib/data.js +49 -0
  73. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +37 -0
  74. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +113 -0
  75. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
  76. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
  77. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
  78. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +32 -0
  79. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +46 -0
  80. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +51 -0
  81. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +9 -0
  82. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +11 -0
  83. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +55 -0
  84. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +191 -0
  85. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +47 -0
  86. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +203 -0
  87. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +79 -0
  88. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +30 -0
  89. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +194 -0
  90. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +106 -0
  91. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +73 -0
  92. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +98 -0
  93. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +39 -0
  94. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
  95. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +43 -0
  96. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +54 -0
  97. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +14 -0
  98. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +245 -0
  99. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
  100. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +85 -0
  101. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +108 -0
  102. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
  103. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +276 -0
  104. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +3 -0
  105. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +163 -0
  106. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
  107. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
  108. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
  109. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +42 -0
  110. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
  111. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +14 -0
  112. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +56 -0
  113. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +81 -0
  114. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +228 -0
  115. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
  116. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +66 -0
  117. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +150 -0
  118. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +103 -0
  119. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +33 -0
  120. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +140 -0
  121. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
  122. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +84 -0
  123. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
  124. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +75 -0
  125. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +335 -0
  126. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
  127. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +124 -0
  128. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +270 -0
  129. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
  130. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +482 -0
  131. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +146 -0
  132. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +17 -0
  133. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
  134. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
  135. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
  136. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
  137. package/packages/config-eslint/node_modules/ajv/package.json +106 -0
  138. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +3 -0
  139. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +61 -0
  140. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +73 -0
  141. package/packages/config-eslint/node_modules/ajv/scripts/info +10 -0
  142. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +12 -0
  143. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +32 -0
  144. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +23 -0
  145. package/packages/config-eslint/node_modules/eslint/LICENSE +19 -0
  146. package/packages/config-eslint/node_modules/eslint/README.md +363 -0
  147. package/packages/config-eslint/node_modules/eslint/bin/eslint.js +195 -0
  148. package/packages/config-eslint/node_modules/eslint/conf/ecma-version.js +16 -0
  149. package/packages/config-eslint/node_modules/eslint/conf/globals.js +169 -0
  150. package/packages/config-eslint/node_modules/eslint/conf/replacements.json +26 -0
  151. package/packages/config-eslint/node_modules/eslint/conf/rule-type-list.json +91 -0
  152. package/packages/config-eslint/node_modules/eslint/lib/api.js +39 -0
  153. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json +18 -0
  154. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/html.js +359 -0
  155. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +16 -0
  156. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json.js +13 -0
  157. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/stylish.js +153 -0
  158. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/hash.js +35 -0
  159. package/packages/config-eslint/node_modules/eslint/lib/cli-engine/lint-result-cache.js +220 -0
  160. package/packages/config-eslint/node_modules/eslint/lib/cli.js +521 -0
  161. package/packages/config-eslint/node_modules/eslint/lib/config/config-loader.js +668 -0
  162. package/packages/config-eslint/node_modules/eslint/lib/config/config.js +674 -0
  163. package/packages/config-eslint/node_modules/eslint/lib/config/default-config.js +78 -0
  164. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-array.js +217 -0
  165. package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-schema.js +598 -0
  166. package/packages/config-eslint/node_modules/eslint/lib/config-api.js +12 -0
  167. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint-helpers.js +1462 -0
  168. package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint.js +1364 -0
  169. package/packages/config-eslint/node_modules/eslint/lib/eslint/index.js +7 -0
  170. package/packages/config-eslint/node_modules/eslint/lib/eslint/worker.js +173 -0
  171. package/packages/config-eslint/node_modules/eslint/lib/languages/js/index.js +336 -0
  172. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/index.js +7 -0
  173. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js +1178 -0
  174. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +61 -0
  175. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js +57 -0
  176. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js +76 -0
  177. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js +120 -0
  178. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js +38 -0
  179. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js +42 -0
  180. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +65 -0
  181. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js +62 -0
  182. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/index.js +695 -0
  183. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js +39 -0
  184. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js +45 -0
  185. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js +41 -0
  186. package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js +131 -0
  187. package/packages/config-eslint/node_modules/eslint/lib/languages/js/validate-language-options.js +196 -0
  188. package/packages/config-eslint/node_modules/eslint/lib/linter/apply-disable-directives.js +583 -0
  189. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +828 -0
  190. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +262 -0
  191. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +2370 -0
  192. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +332 -0
  193. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +223 -0
  194. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +374 -0
  195. package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +44 -0
  196. package/packages/config-eslint/node_modules/eslint/lib/linter/esquery.js +332 -0
  197. package/packages/config-eslint/node_modules/eslint/lib/linter/file-context.js +88 -0
  198. package/packages/config-eslint/node_modules/eslint/lib/linter/file-report.js +604 -0
  199. package/packages/config-eslint/node_modules/eslint/lib/linter/index.js +11 -0
  200. package/packages/config-eslint/node_modules/eslint/lib/linter/interpolate.js +50 -0
  201. package/packages/config-eslint/node_modules/eslint/lib/linter/linter.js +1614 -0
  202. package/packages/config-eslint/node_modules/eslint/lib/linter/rule-fixer.js +199 -0
  203. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-fixer.js +154 -0
  204. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-traverser.js +333 -0
  205. package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-visitor.js +81 -0
  206. package/packages/config-eslint/node_modules/eslint/lib/linter/timing.js +209 -0
  207. package/packages/config-eslint/node_modules/eslint/lib/linter/vfile.js +115 -0
  208. package/packages/config-eslint/node_modules/eslint/lib/options.js +416 -0
  209. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/index.js +7 -0
  210. package/packages/config-eslint/node_modules/eslint/lib/rule-tester/rule-tester.js +1996 -0
  211. package/packages/config-eslint/node_modules/eslint/lib/rules/accessor-pairs.js +420 -0
  212. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-newline.js +291 -0
  213. package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-spacing.js +301 -0
  214. package/packages/config-eslint/node_modules/eslint/lib/rules/array-callback-return.js +510 -0
  215. package/packages/config-eslint/node_modules/eslint/lib/rules/array-element-newline.js +374 -0
  216. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-body-style.js +418 -0
  217. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-parens.js +237 -0
  218. package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-spacing.js +188 -0
  219. package/packages/config-eslint/node_modules/eslint/lib/rules/block-scoped-var.js +137 -0
  220. package/packages/config-eslint/node_modules/eslint/lib/rules/block-spacing.js +202 -0
  221. package/packages/config-eslint/node_modules/eslint/lib/rules/brace-style.js +278 -0
  222. package/packages/config-eslint/node_modules/eslint/lib/rules/callback-return.js +216 -0
  223. package/packages/config-eslint/node_modules/eslint/lib/rules/camelcase.js +422 -0
  224. package/packages/config-eslint/node_modules/eslint/lib/rules/capitalized-comments.js +325 -0
  225. package/packages/config-eslint/node_modules/eslint/lib/rules/class-methods-use-this.js +250 -0
  226. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-dangle.js +424 -0
  227. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-spacing.js +205 -0
  228. package/packages/config-eslint/node_modules/eslint/lib/rules/comma-style.js +391 -0
  229. package/packages/config-eslint/node_modules/eslint/lib/rules/complexity.js +201 -0
  230. package/packages/config-eslint/node_modules/eslint/lib/rules/computed-property-spacing.js +251 -0
  231. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-return.js +221 -0
  232. package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-this.js +179 -0
  233. package/packages/config-eslint/node_modules/eslint/lib/rules/constructor-super.js +453 -0
  234. package/packages/config-eslint/node_modules/eslint/lib/rules/curly.js +425 -0
  235. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case-last.js +51 -0
  236. package/packages/config-eslint/node_modules/eslint/lib/rules/default-case.js +103 -0
  237. package/packages/config-eslint/node_modules/eslint/lib/rules/default-param-last.js +78 -0
  238. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-location.js +138 -0
  239. package/packages/config-eslint/node_modules/eslint/lib/rules/dot-notation.js +216 -0
  240. package/packages/config-eslint/node_modules/eslint/lib/rules/eol-last.js +135 -0
  241. package/packages/config-eslint/node_modules/eslint/lib/rules/eqeqeq.js +210 -0
  242. package/packages/config-eslint/node_modules/eslint/lib/rules/for-direction.js +168 -0
  243. package/packages/config-eslint/node_modules/eslint/lib/rules/func-call-spacing.js +281 -0
  244. package/packages/config-eslint/node_modules/eslint/lib/rules/func-name-matching.js +338 -0
  245. package/packages/config-eslint/node_modules/eslint/lib/rules/func-names.js +194 -0
  246. package/packages/config-eslint/node_modules/eslint/lib/rules/func-style.js +221 -0
  247. package/packages/config-eslint/node_modules/eslint/lib/rules/function-call-argument-newline.js +166 -0
  248. package/packages/config-eslint/node_modules/eslint/lib/rules/function-paren-newline.js +368 -0
  249. package/packages/config-eslint/node_modules/eslint/lib/rules/generator-star-spacing.js +246 -0
  250. package/packages/config-eslint/node_modules/eslint/lib/rules/getter-return.js +242 -0
  251. package/packages/config-eslint/node_modules/eslint/lib/rules/global-require.js +117 -0
  252. package/packages/config-eslint/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +268 -0
  253. package/packages/config-eslint/node_modules/eslint/lib/rules/guard-for-in.js +85 -0
  254. package/packages/config-eslint/node_modules/eslint/lib/rules/handle-callback-err.js +122 -0
  255. package/packages/config-eslint/node_modules/eslint/lib/rules/id-blacklist.js +241 -0
  256. package/packages/config-eslint/node_modules/eslint/lib/rules/id-denylist.js +223 -0
  257. package/packages/config-eslint/node_modules/eslint/lib/rules/id-length.js +217 -0
  258. package/packages/config-eslint/node_modules/eslint/lib/rules/id-match.js +363 -0
  259. package/packages/config-eslint/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +125 -0
  260. package/packages/config-eslint/node_modules/eslint/lib/rules/indent-legacy.js +1369 -0
  261. package/packages/config-eslint/node_modules/eslint/lib/rules/indent.js +2334 -0
  262. package/packages/config-eslint/node_modules/eslint/lib/rules/index.js +332 -0
  263. package/packages/config-eslint/node_modules/eslint/lib/rules/init-declarations.js +172 -0
  264. package/packages/config-eslint/node_modules/eslint/lib/rules/jsx-quotes.js +128 -0
  265. package/packages/config-eslint/node_modules/eslint/lib/rules/key-spacing.js +822 -0
  266. package/packages/config-eslint/node_modules/eslint/lib/rules/keyword-spacing.js +701 -0
  267. package/packages/config-eslint/node_modules/eslint/lib/rules/line-comment-position.js +157 -0
  268. package/packages/config-eslint/node_modules/eslint/lib/rules/linebreak-style.js +135 -0
  269. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-comment.js +581 -0
  270. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-directive.js +249 -0
  271. package/packages/config-eslint/node_modules/eslint/lib/rules/lines-between-class-members.js +358 -0
  272. package/packages/config-eslint/node_modules/eslint/lib/rules/logical-assignment-operators.js +688 -0
  273. package/packages/config-eslint/node_modules/eslint/lib/rules/max-classes-per-file.js +90 -0
  274. package/packages/config-eslint/node_modules/eslint/lib/rules/max-depth.js +159 -0
  275. package/packages/config-eslint/node_modules/eslint/lib/rules/max-len.js +497 -0
  276. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines-per-function.js +238 -0
  277. package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines.js +189 -0
  278. package/packages/config-eslint/node_modules/eslint/lib/rules/max-nested-callbacks.js +115 -0
  279. package/packages/config-eslint/node_modules/eslint/lib/rules/max-params.js +148 -0
  280. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements-per-line.js +224 -0
  281. package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements.js +188 -0
  282. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-comment-style.js +652 -0
  283. package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-ternary.js +257 -0
  284. package/packages/config-eslint/node_modules/eslint/lib/rules/new-cap.js +277 -0
  285. package/packages/config-eslint/node_modules/eslint/lib/rules/new-parens.js +120 -0
  286. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-after-var.js +307 -0
  287. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-before-return.js +242 -0
  288. package/packages/config-eslint/node_modules/eslint/lib/rules/newline-per-chained-call.js +159 -0
  289. package/packages/config-eslint/node_modules/eslint/lib/rules/no-alert.js +149 -0
  290. package/packages/config-eslint/node_modules/eslint/lib/rules/no-array-constructor.js +195 -0
  291. package/packages/config-eslint/node_modules/eslint/lib/rules/no-async-promise-executor.js +45 -0
  292. package/packages/config-eslint/node_modules/eslint/lib/rules/no-await-in-loop.js +115 -0
  293. package/packages/config-eslint/node_modules/eslint/lib/rules/no-bitwise.js +145 -0
  294. package/packages/config-eslint/node_modules/eslint/lib/rules/no-buffer-constructor.js +74 -0
  295. package/packages/config-eslint/node_modules/eslint/lib/rules/no-caller.js +52 -0
  296. package/packages/config-eslint/node_modules/eslint/lib/rules/no-case-declarations.js +80 -0
  297. package/packages/config-eslint/node_modules/eslint/lib/rules/no-catch-shadow.js +96 -0
  298. package/packages/config-eslint/node_modules/eslint/lib/rules/no-class-assign.js +66 -0
  299. package/packages/config-eslint/node_modules/eslint/lib/rules/no-compare-neg-zero.js +74 -0
  300. package/packages/config-eslint/node_modules/eslint/lib/rules/no-cond-assign.js +175 -0
  301. package/packages/config-eslint/node_modules/eslint/lib/rules/no-confusing-arrow.js +127 -0
  302. package/packages/config-eslint/node_modules/eslint/lib/rules/no-console.js +221 -0
  303. package/packages/config-eslint/node_modules/eslint/lib/rules/no-const-assign.js +73 -0
  304. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-binary-expression.js +603 -0
  305. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-condition.js +177 -0
  306. package/packages/config-eslint/node_modules/eslint/lib/rules/no-constructor-return.js +62 -0
  307. package/packages/config-eslint/node_modules/eslint/lib/rules/no-continue.js +38 -0
  308. package/packages/config-eslint/node_modules/eslint/lib/rules/no-control-regex.js +142 -0
  309. package/packages/config-eslint/node_modules/eslint/lib/rules/no-debugger.js +41 -0
  310. package/packages/config-eslint/node_modules/eslint/lib/rules/no-delete-var.js +42 -0
  311. package/packages/config-eslint/node_modules/eslint/lib/rules/no-div-regex.js +60 -0
  312. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-args.js +92 -0
  313. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-class-members.js +117 -0
  314. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-else-if.js +145 -0
  315. package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-keys.js +165 -0
  316. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-case.js +78 -0
  317. package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-imports.js +368 -0
  318. package/packages/config-eslint/node_modules/eslint/lib/rules/no-else-return.js +450 -0
  319. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-character-class.js +83 -0
  320. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-function.js +236 -0
  321. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-pattern.js +85 -0
  322. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-static-block.js +73 -0
  323. package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty.js +153 -0
  324. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eq-null.js +51 -0
  325. package/packages/config-eslint/node_modules/eslint/lib/rules/no-eval.js +295 -0
  326. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ex-assign.js +57 -0
  327. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extend-native.js +180 -0
  328. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-bind.js +224 -0
  329. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +420 -0
  330. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-label.js +169 -0
  331. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-parens.js +1669 -0
  332. package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-semi.js +167 -0
  333. package/packages/config-eslint/node_modules/eslint/lib/rules/no-fallthrough.js +260 -0
  334. package/packages/config-eslint/node_modules/eslint/lib/rules/no-floating-decimal.js +99 -0
  335. package/packages/config-eslint/node_modules/eslint/lib/rules/no-func-assign.js +77 -0
  336. package/packages/config-eslint/node_modules/eslint/lib/rules/no-global-assign.js +101 -0
  337. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-coercion.js +468 -0
  338. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-globals.js +187 -0
  339. package/packages/config-eslint/node_modules/eslint/lib/rules/no-implied-eval.js +171 -0
  340. package/packages/config-eslint/node_modules/eslint/lib/rules/no-import-assign.js +227 -0
  341. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inline-comments.js +115 -0
  342. package/packages/config-eslint/node_modules/eslint/lib/rules/no-inner-declarations.js +147 -0
  343. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-regexp.js +244 -0
  344. package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-this.js +178 -0
  345. package/packages/config-eslint/node_modules/eslint/lib/rules/no-irregular-whitespace.js +292 -0
  346. package/packages/config-eslint/node_modules/eslint/lib/rules/no-iterator.js +48 -0
  347. package/packages/config-eslint/node_modules/eslint/lib/rules/no-label-var.js +78 -0
  348. package/packages/config-eslint/node_modules/eslint/lib/rules/no-labels.js +156 -0
  349. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lone-blocks.js +140 -0
  350. package/packages/config-eslint/node_modules/eslint/lib/rules/no-lonely-if.js +126 -0
  351. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loop-func.js +267 -0
  352. package/packages/config-eslint/node_modules/eslint/lib/rules/no-loss-of-precision.js +249 -0
  353. package/packages/config-eslint/node_modules/eslint/lib/rules/no-magic-numbers.js +365 -0
  354. package/packages/config-eslint/node_modules/eslint/lib/rules/no-misleading-character-class.js +595 -0
  355. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-operators.js +253 -0
  356. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-requires.js +267 -0
  357. package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +148 -0
  358. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-assign.js +66 -0
  359. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-spaces.js +179 -0
  360. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-str.js +67 -0
  361. package/packages/config-eslint/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +210 -0
  362. package/packages/config-eslint/node_modules/eslint/lib/rules/no-native-reassign.js +114 -0
  363. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-condition.js +100 -0
  364. package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-in-lhs.js +59 -0
  365. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nested-ternary.js +46 -0
  366. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-func.js +96 -0
  367. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +70 -0
  368. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-object.js +76 -0
  369. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-require.js +67 -0
  370. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-symbol.js +74 -0
  371. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-wrappers.js +62 -0
  372. package/packages/config-eslint/node_modules/eslint/lib/rules/no-new.js +42 -0
  373. package/packages/config-eslint/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +176 -0
  374. package/packages/config-eslint/node_modules/eslint/lib/rules/no-obj-calls.js +99 -0
  375. package/packages/config-eslint/node_modules/eslint/lib/rules/no-object-constructor.js +124 -0
  376. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal-escape.js +53 -0
  377. package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal.js +42 -0
  378. package/packages/config-eslint/node_modules/eslint/lib/rules/no-param-reassign.js +248 -0
  379. package/packages/config-eslint/node_modules/eslint/lib/rules/no-path-concat.js +79 -0
  380. package/packages/config-eslint/node_modules/eslint/lib/rules/no-plusplus.js +102 -0
  381. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-env.js +68 -0
  382. package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-exit.js +67 -0
  383. package/packages/config-eslint/node_modules/eslint/lib/rules/no-promise-executor-return.js +264 -0
  384. package/packages/config-eslint/node_modules/eslint/lib/rules/no-proto.js +45 -0
  385. package/packages/config-eslint/node_modules/eslint/lib/rules/no-prototype-builtins.js +181 -0
  386. package/packages/config-eslint/node_modules/eslint/lib/rules/no-redeclare.js +173 -0
  387. package/packages/config-eslint/node_modules/eslint/lib/rules/no-regex-spaces.js +219 -0
  388. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-exports.js +227 -0
  389. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-globals.js +266 -0
  390. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-imports.js +892 -0
  391. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-modules.js +249 -0
  392. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-properties.js +233 -0
  393. package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-syntax.js +74 -0
  394. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-assign.js +87 -0
  395. package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-await.js +162 -0
  396. package/packages/config-eslint/node_modules/eslint/lib/rules/no-script-url.js +68 -0
  397. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-assign.js +186 -0
  398. package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-compare.js +77 -0
  399. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sequences.js +158 -0
  400. package/packages/config-eslint/node_modules/eslint/lib/rules/no-setter-return.js +224 -0
  401. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +113 -0
  402. package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow.js +689 -0
  403. package/packages/config-eslint/node_modules/eslint/lib/rules/no-spaced-func.js +105 -0
  404. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sparse-arrays.js +68 -0
  405. package/packages/config-eslint/node_modules/eslint/lib/rules/no-sync.js +81 -0
  406. package/packages/config-eslint/node_modules/eslint/lib/rules/no-tabs.js +110 -0
  407. package/packages/config-eslint/node_modules/eslint/lib/rules/no-template-curly-in-string.js +45 -0
  408. package/packages/config-eslint/node_modules/eslint/lib/rules/no-ternary.js +38 -0
  409. package/packages/config-eslint/node_modules/eslint/lib/rules/no-this-before-super.js +365 -0
  410. package/packages/config-eslint/node_modules/eslint/lib/rules/no-throw-literal.js +46 -0
  411. package/packages/config-eslint/node_modules/eslint/lib/rules/no-trailing-spaces.js +227 -0
  412. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unassigned-vars.js +80 -0
  413. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef-init.js +101 -0
  414. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef.js +84 -0
  415. package/packages/config-eslint/node_modules/eslint/lib/rules/no-undefined.js +85 -0
  416. package/packages/config-eslint/node_modules/eslint/lib/rules/no-underscore-dangle.js +383 -0
  417. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unexpected-multiline.js +130 -0
  418. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +360 -0
  419. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unneeded-ternary.js +232 -0
  420. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable-loop.js +190 -0
  421. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable.js +300 -0
  422. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-finally.js +119 -0
  423. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-negation.js +152 -0
  424. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +221 -0
  425. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-expressions.js +227 -0
  426. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-labels.js +158 -0
  427. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-private-class-members.js +219 -0
  428. package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-vars.js +1739 -0
  429. package/packages/config-eslint/node_modules/eslint/lib/rules/no-use-before-define.js +446 -0
  430. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-assignment.js +657 -0
  431. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-backreference.js +263 -0
  432. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-call.js +95 -0
  433. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-catch.js +57 -0
  434. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-computed-key.js +204 -0
  435. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-concat.js +121 -0
  436. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-constructor.js +262 -0
  437. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-escape.js +406 -0
  438. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-rename.js +202 -0
  439. package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-return.js +401 -0
  440. package/packages/config-eslint/node_modules/eslint/lib/rules/no-var.js +367 -0
  441. package/packages/config-eslint/node_modules/eslint/lib/rules/no-void.js +69 -0
  442. package/packages/config-eslint/node_modules/eslint/lib/rules/no-warning-comments.js +209 -0
  443. package/packages/config-eslint/node_modules/eslint/lib/rules/no-whitespace-before-property.js +150 -0
  444. package/packages/config-eslint/node_modules/eslint/lib/rules/no-with.js +37 -0
  445. package/packages/config-eslint/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +164 -0
  446. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-newline.js +383 -0
  447. package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-spacing.js +369 -0
  448. package/packages/config-eslint/node_modules/eslint/lib/rules/object-property-newline.js +151 -0
  449. package/packages/config-eslint/node_modules/eslint/lib/rules/object-shorthand.js +652 -0
  450. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +117 -0
  451. package/packages/config-eslint/node_modules/eslint/lib/rules/one-var.js +717 -0
  452. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-assignment.js +270 -0
  453. package/packages/config-eslint/node_modules/eslint/lib/rules/operator-linebreak.js +315 -0
  454. package/packages/config-eslint/node_modules/eslint/lib/rules/padded-blocks.js +366 -0
  455. package/packages/config-eslint/node_modules/eslint/lib/rules/padding-line-between-statements.js +612 -0
  456. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-arrow-callback.js +437 -0
  457. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-const.js +546 -0
  458. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-destructuring.js +332 -0
  459. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +235 -0
  460. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-named-capture-group.js +197 -0
  461. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-numeric-literals.js +157 -0
  462. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-has-own.js +148 -0
  463. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-spread.js +319 -0
  464. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +154 -0
  465. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-reflect.js +150 -0
  466. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-regex-literals.js +605 -0
  467. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-rest-params.js +117 -0
  468. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-spread.js +91 -0
  469. package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-template.js +347 -0
  470. package/packages/config-eslint/node_modules/eslint/lib/rules/preserve-caught-error.js +535 -0
  471. package/packages/config-eslint/node_modules/eslint/lib/rules/quote-props.js +394 -0
  472. package/packages/config-eslint/node_modules/eslint/lib/rules/quotes.js +416 -0
  473. package/packages/config-eslint/node_modules/eslint/lib/rules/radix.js +193 -0
  474. package/packages/config-eslint/node_modules/eslint/lib/rules/require-atomic-updates.js +365 -0
  475. package/packages/config-eslint/node_modules/eslint/lib/rules/require-await.js +184 -0
  476. package/packages/config-eslint/node_modules/eslint/lib/rules/require-unicode-regexp.js +317 -0
  477. package/packages/config-eslint/node_modules/eslint/lib/rules/require-yield.js +86 -0
  478. package/packages/config-eslint/node_modules/eslint/lib/rules/rest-spread-spacing.js +150 -0
  479. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-spacing.js +297 -0
  480. package/packages/config-eslint/node_modules/eslint/lib/rules/semi-style.js +218 -0
  481. package/packages/config-eslint/node_modules/eslint/lib/rules/semi.js +476 -0
  482. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-imports.js +319 -0
  483. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-keys.js +268 -0
  484. package/packages/config-eslint/node_modules/eslint/lib/rules/sort-vars.js +140 -0
  485. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-blocks.js +232 -0
  486. package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-function-paren.js +202 -0
  487. package/packages/config-eslint/node_modules/eslint/lib/rules/space-in-parens.js +374 -0
  488. package/packages/config-eslint/node_modules/eslint/lib/rules/space-infix-ops.js +249 -0
  489. package/packages/config-eslint/node_modules/eslint/lib/rules/space-unary-ops.js +400 -0
  490. package/packages/config-eslint/node_modules/eslint/lib/rules/spaced-comment.js +447 -0
  491. package/packages/config-eslint/node_modules/eslint/lib/rules/strict.js +324 -0
  492. package/packages/config-eslint/node_modules/eslint/lib/rules/switch-colon-spacing.js +158 -0
  493. package/packages/config-eslint/node_modules/eslint/lib/rules/symbol-description.js +70 -0
  494. package/packages/config-eslint/node_modules/eslint/lib/rules/template-curly-spacing.js +168 -0
  495. package/packages/config-eslint/node_modules/eslint/lib/rules/template-tag-spacing.js +121 -0
  496. package/packages/config-eslint/node_modules/eslint/lib/rules/unicode-bom.js +73 -0
  497. package/packages/config-eslint/node_modules/eslint/lib/rules/use-isnan.js +268 -0
  498. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/ast-utils.js +2841 -0
  499. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/char-source.js +247 -0
  500. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/fix-tracker.js +125 -0
  501. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/keywords.js +67 -0
  502. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +118 -0
  503. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/regular-expressions.js +58 -0
  504. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/index.js +16 -0
  505. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +13 -0
  506. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +13 -0
  507. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +13 -0
  508. package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +14 -0
  509. package/packages/config-eslint/node_modules/eslint/lib/rules/valid-typeof.js +171 -0
  510. package/packages/config-eslint/node_modules/eslint/lib/rules/vars-on-top.js +165 -0
  511. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-iife.js +238 -0
  512. package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-regex.js +91 -0
  513. package/packages/config-eslint/node_modules/eslint/lib/rules/yield-star-spacing.js +158 -0
  514. package/packages/config-eslint/node_modules/eslint/lib/rules/yoda.js +362 -0
  515. package/packages/config-eslint/node_modules/eslint/lib/services/parser-service.js +64 -0
  516. package/packages/config-eslint/node_modules/eslint/lib/services/processor-service.js +100 -0
  517. package/packages/config-eslint/node_modules/eslint/lib/services/suppressions-service.js +302 -0
  518. package/packages/config-eslint/node_modules/eslint/lib/services/warning-service.js +87 -0
  519. package/packages/config-eslint/node_modules/eslint/lib/shared/ajv.js +34 -0
  520. package/packages/config-eslint/node_modules/eslint/lib/shared/assert.js +21 -0
  521. package/packages/config-eslint/node_modules/eslint/lib/shared/ast-utils.js +30 -0
  522. package/packages/config-eslint/node_modules/eslint/lib/shared/deep-merge-arrays.js +62 -0
  523. package/packages/config-eslint/node_modules/eslint/lib/shared/directives.js +16 -0
  524. package/packages/config-eslint/node_modules/eslint/lib/shared/flags.js +89 -0
  525. package/packages/config-eslint/node_modules/eslint/lib/shared/logging.js +38 -0
  526. package/packages/config-eslint/node_modules/eslint/lib/shared/naming.js +109 -0
  527. package/packages/config-eslint/node_modules/eslint/lib/shared/option-utils.js +63 -0
  528. package/packages/config-eslint/node_modules/eslint/lib/shared/relative-module-resolver.js +28 -0
  529. package/packages/config-eslint/node_modules/eslint/lib/shared/runtime-info.js +177 -0
  530. package/packages/config-eslint/node_modules/eslint/lib/shared/serialization.js +78 -0
  531. package/packages/config-eslint/node_modules/eslint/lib/shared/severity.js +49 -0
  532. package/packages/config-eslint/node_modules/eslint/lib/shared/stats.js +30 -0
  533. package/packages/config-eslint/node_modules/eslint/lib/shared/string-utils.js +58 -0
  534. package/packages/config-eslint/node_modules/eslint/lib/shared/text-table.js +68 -0
  535. package/packages/config-eslint/node_modules/eslint/lib/shared/translate-cli-options.js +223 -0
  536. package/packages/config-eslint/node_modules/eslint/lib/shared/traverser.js +202 -0
  537. package/packages/config-eslint/node_modules/eslint/lib/types/config-api.d.ts +12 -0
  538. package/packages/config-eslint/node_modules/eslint/lib/types/index.d.ts +1475 -0
  539. package/packages/config-eslint/node_modules/eslint/lib/types/rules.d.ts +5603 -0
  540. package/packages/config-eslint/node_modules/eslint/lib/types/universal.d.ts +6 -0
  541. package/packages/config-eslint/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +34 -0
  542. package/packages/config-eslint/node_modules/eslint/lib/universal.js +10 -0
  543. package/packages/config-eslint/node_modules/eslint/lib/unsupported-api.js +21 -0
  544. package/packages/config-eslint/node_modules/eslint/messages/all-files-ignored.js +16 -0
  545. package/packages/config-eslint/node_modules/eslint/messages/all-matched-files-ignored.js +21 -0
  546. package/packages/config-eslint/node_modules/eslint/messages/config-file-missing.js +16 -0
  547. package/packages/config-eslint/node_modules/eslint/messages/config-plugin-missing.js +14 -0
  548. package/packages/config-eslint/node_modules/eslint/messages/config-serialize-function.js +30 -0
  549. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-incompat.js +117 -0
  550. package/packages/config-eslint/node_modules/eslint/messages/eslintrc-plugins.js +27 -0
  551. package/packages/config-eslint/node_modules/eslint/messages/extend-config-missing.js +13 -0
  552. package/packages/config-eslint/node_modules/eslint/messages/failed-to-read-json.js +11 -0
  553. package/packages/config-eslint/node_modules/eslint/messages/file-not-found.js +10 -0
  554. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-options.js +17 -0
  555. package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-severity.js +13 -0
  556. package/packages/config-eslint/node_modules/eslint/messages/no-config-found.js +15 -0
  557. package/packages/config-eslint/node_modules/eslint/messages/plugin-conflict.js +22 -0
  558. package/packages/config-eslint/node_modules/eslint/messages/plugin-invalid.js +16 -0
  559. package/packages/config-eslint/node_modules/eslint/messages/plugin-missing.js +19 -0
  560. package/packages/config-eslint/node_modules/eslint/messages/print-config-with-directory-path.js +8 -0
  561. package/packages/config-eslint/node_modules/eslint/messages/shared.js +23 -0
  562. package/packages/config-eslint/node_modules/eslint/messages/whitespace-found.js +11 -0
  563. package/packages/config-eslint/node_modules/eslint/package.json +220 -0
  564. package/packages/config-eslint/node_modules/eslint-scope/LICENSE +22 -0
  565. package/packages/config-eslint/node_modules/eslint-scope/README.md +206 -0
  566. package/packages/config-eslint/node_modules/eslint-scope/dist/eslint-scope.cjs +2420 -0
  567. package/packages/config-eslint/node_modules/eslint-scope/lib/assert.js +17 -0
  568. package/packages/config-eslint/node_modules/eslint-scope/lib/definition.js +89 -0
  569. package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.cts +1069 -0
  570. package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.ts +6 -0
  571. package/packages/config-eslint/node_modules/eslint-scope/lib/index.js +170 -0
  572. package/packages/config-eslint/node_modules/eslint-scope/lib/pattern-visitor.js +157 -0
  573. package/packages/config-eslint/node_modules/eslint-scope/lib/reference.js +165 -0
  574. package/packages/config-eslint/node_modules/eslint-scope/lib/referencer.js +712 -0
  575. package/packages/config-eslint/node_modules/eslint-scope/lib/scope-manager.js +271 -0
  576. package/packages/config-eslint/node_modules/eslint-scope/lib/scope.js +839 -0
  577. package/packages/config-eslint/node_modules/eslint-scope/lib/variable.js +91 -0
  578. package/packages/config-eslint/node_modules/eslint-scope/package.json +69 -0
  579. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +201 -0
  580. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +121 -0
  581. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +396 -0
  582. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +28 -0
  583. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
  584. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
  585. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +67 -0
  586. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +327 -0
  587. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +59 -0
  588. package/packages/config-eslint/node_modules/espree/LICENSE +25 -0
  589. package/packages/config-eslint/node_modules/espree/README.md +262 -0
  590. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +1272 -0
  591. package/packages/config-eslint/node_modules/espree/dist/espree.d.cts +3 -0
  592. package/packages/config-eslint/node_modules/espree/dist/espree.d.cts.map +1 -0
  593. package/packages/config-eslint/node_modules/espree/dist/espree.d.ts +71 -0
  594. package/packages/config-eslint/node_modules/espree/dist/espree.d.ts.map +1 -0
  595. package/packages/config-eslint/node_modules/espree/espree.js +291 -0
  596. package/packages/config-eslint/node_modules/espree/lib/espree.js +482 -0
  597. package/packages/config-eslint/node_modules/espree/lib/features.js +21 -0
  598. package/packages/config-eslint/node_modules/espree/lib/options.js +164 -0
  599. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +306 -0
  600. package/packages/config-eslint/node_modules/espree/lib/types.js +118 -0
  601. package/packages/config-eslint/node_modules/espree/package.json +72 -0
  602. package/packages/config-eslint/node_modules/ignore/LICENSE-MIT +21 -0
  603. package/packages/config-eslint/node_modules/ignore/README.md +412 -0
  604. package/packages/config-eslint/node_modules/ignore/index.d.ts +61 -0
  605. package/packages/config-eslint/node_modules/ignore/index.js +636 -0
  606. package/packages/config-eslint/node_modules/ignore/legacy.js +559 -0
  607. package/packages/config-eslint/node_modules/ignore/package.json +74 -0
  608. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  609. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +8 -0
  610. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +21 -0
  611. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +83 -0
  612. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +89 -0
  613. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +43 -0
  614. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  615. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  616. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  617. package/packages/config-eslint/node_modules/minimatch/LICENSE.md +55 -0
  618. package/packages/config-eslint/node_modules/minimatch/README.md +453 -0
  619. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  620. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  621. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  622. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  623. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
  624. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  625. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js +591 -0
  626. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  627. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  628. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  629. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  630. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  631. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  632. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  633. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  634. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  635. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
  636. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  637. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js +1029 -0
  638. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  639. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/package.json +3 -0
  640. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  641. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  642. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  643. package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  644. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  645. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  646. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  647. package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  648. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
  649. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  650. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js +587 -0
  651. package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  652. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  653. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  654. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
  655. package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  656. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  657. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  658. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js +26 -0
  659. package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  660. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts +94 -0
  661. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  662. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js +1016 -0
  663. package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js.map +1 -0
  664. package/packages/config-eslint/node_modules/minimatch/dist/esm/package.json +3 -0
  665. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  666. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  667. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js +34 -0
  668. package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  669. package/packages/config-eslint/node_modules/minimatch/package.json +67 -0
  670. package/packages/config-eslint/package.json +7 -7
@@ -0,0 +1,2420 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var estraverse = require('estraverse');
6
+ var esrecurse = require('esrecurse');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var estraverse__default = /*#__PURE__*/_interopDefaultLegacy(estraverse);
11
+ var esrecurse__default = /*#__PURE__*/_interopDefaultLegacy(esrecurse);
12
+
13
+ /**
14
+ * @fileoverview Assertion utilities.
15
+ * @author Nicholas C. Zakas
16
+ */
17
+
18
+ /**
19
+ * Throws an error if the given condition is not truthy.
20
+ * @param {boolean} condition The condition to check.
21
+ * @param {string} message The message to include with the error.
22
+ * @returns {void}
23
+ * @throws {Error} When the condition is not truthy.
24
+ */
25
+ function assert(condition, message = "Assertion failed.") {
26
+ if (!condition) {
27
+ throw new Error(message);
28
+ }
29
+ }
30
+
31
+ /*
32
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
33
+
34
+ Redistribution and use in source and binary forms, with or without
35
+ modification, are permitted provided that the following conditions are met:
36
+
37
+ * Redistributions of source code must retain the above copyright
38
+ notice, this list of conditions and the following disclaimer.
39
+ * Redistributions in binary form must reproduce the above copyright
40
+ notice, this list of conditions and the following disclaimer in the
41
+ documentation and/or other materials provided with the distribution.
42
+
43
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
47
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
48
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
49
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53
+ */
54
+
55
+ /** @import * as types from "eslint-scope" */
56
+
57
+ const READ = 0x1;
58
+ const WRITE = 0x2;
59
+ const RW = READ | WRITE;
60
+
61
+ /**
62
+ * A Reference represents a single occurrence of an identifier in code.
63
+ * @constructor Reference
64
+ * @implements {types.Reference}
65
+ */
66
+ class Reference {
67
+ constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) {
68
+
69
+ /**
70
+ * Identifier syntax node.
71
+ * @member {espreeIdentifier} Reference#identifier
72
+ */
73
+ this.identifier = ident;
74
+
75
+ /**
76
+ * Reference to the enclosing Scope.
77
+ * @member {Scope} Reference#from
78
+ */
79
+ this.from = scope;
80
+
81
+ /**
82
+ * Whether the reference comes from a dynamic scope (such as 'eval',
83
+ * 'with', etc.), and may be trapped by dynamic scopes.
84
+ * @member {boolean} Reference#tainted
85
+ */
86
+ this.tainted = false;
87
+
88
+ /**
89
+ * The variable this reference is resolved with.
90
+ * @member {Variable} Reference#resolved
91
+ */
92
+ this.resolved = null;
93
+
94
+ /**
95
+ * The read-write mode of the reference. (Value is one of {@link
96
+ * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}).
97
+ * @member {number} Reference#flag
98
+ */
99
+ this.flag = flag;
100
+ if (this.isWrite()) {
101
+
102
+ /**
103
+ * If reference is writeable, this is the tree being written to it.
104
+ * @member {espreeNode} Reference#writeExpr
105
+ */
106
+ this.writeExpr = writeExpr;
107
+
108
+ /**
109
+ * Whether the Reference might refer to a partial value of writeExpr.
110
+ * @member {boolean} Reference#partial
111
+ */
112
+ this.partial = partial;
113
+
114
+ /**
115
+ * Whether the Reference is to write of initialization.
116
+ * @member {boolean} Reference#init
117
+ */
118
+ this.init = init;
119
+ }
120
+ this.__maybeImplicitGlobal = maybeImplicitGlobal;
121
+ }
122
+
123
+ /**
124
+ * Whether the reference is static.
125
+ * @function Reference#isStatic
126
+ * @returns {boolean} static
127
+ */
128
+ isStatic() {
129
+ return !this.tainted && !!this.resolved && this.resolved.scope.isStatic();
130
+ }
131
+
132
+ /**
133
+ * Whether the reference is writeable.
134
+ * @function Reference#isWrite
135
+ * @returns {boolean} write
136
+ */
137
+ isWrite() {
138
+ return !!(this.flag & Reference.WRITE);
139
+ }
140
+
141
+ /**
142
+ * Whether the reference is readable.
143
+ * @function Reference#isRead
144
+ * @returns {boolean} read
145
+ */
146
+ isRead() {
147
+ return !!(this.flag & Reference.READ);
148
+ }
149
+
150
+ /**
151
+ * Whether the reference is read-only.
152
+ * @function Reference#isReadOnly
153
+ * @returns {boolean} read only
154
+ */
155
+ isReadOnly() {
156
+ return this.flag === Reference.READ;
157
+ }
158
+
159
+ /**
160
+ * Whether the reference is write-only.
161
+ * @function Reference#isWriteOnly
162
+ * @returns {boolean} write only
163
+ */
164
+ isWriteOnly() {
165
+ return this.flag === Reference.WRITE;
166
+ }
167
+
168
+ /**
169
+ * Whether the reference is read-write.
170
+ * @function Reference#isReadWrite
171
+ * @returns {boolean} read write
172
+ */
173
+ isReadWrite() {
174
+ return this.flag === Reference.RW;
175
+ }
176
+ }
177
+
178
+ /**
179
+ * @constant Reference.READ
180
+ */
181
+ Reference.READ = READ;
182
+
183
+ /**
184
+ * @constant Reference.WRITE
185
+ */
186
+ Reference.WRITE = WRITE;
187
+
188
+ /**
189
+ * @constant Reference.RW
190
+ */
191
+ Reference.RW = RW;
192
+
193
+ /* vim: set sw=4 ts=4 et tw=80 : */
194
+
195
+ /*
196
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
197
+
198
+ Redistribution and use in source and binary forms, with or without
199
+ modification, are permitted provided that the following conditions are met:
200
+
201
+ * Redistributions of source code must retain the above copyright
202
+ notice, this list of conditions and the following disclaimer.
203
+ * Redistributions in binary form must reproduce the above copyright
204
+ notice, this list of conditions and the following disclaimer in the
205
+ documentation and/or other materials provided with the distribution.
206
+
207
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
208
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
209
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
210
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
211
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
212
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
213
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
214
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
215
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
216
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
217
+ */
218
+
219
+ /** @import * as types from "eslint-scope" */
220
+ /** @import Reference from "./reference.js" */
221
+
222
+ /**
223
+ * A Variable represents a locally scoped identifier. These include arguments to
224
+ * functions.
225
+ * @constructor Variable
226
+ * @implements {types.Variable}
227
+ */
228
+ class Variable {
229
+ constructor(name, scope) {
230
+
231
+ /**
232
+ * The variable name, as given in the source code.
233
+ * @member {string} Variable#name
234
+ */
235
+ this.name = name;
236
+
237
+ /**
238
+ * List of defining occurrences of this variable (like in 'var ...'
239
+ * statements or as parameter), as AST nodes.
240
+ * @member {espree.Identifier[]} Variable#identifiers
241
+ */
242
+ this.identifiers = [];
243
+
244
+ /**
245
+ * List of {@link Reference|references} of this variable (excluding parameter entries)
246
+ * in its defining scope and all nested scopes. For defining
247
+ * occurrences only see {@link Variable#defs}.
248
+ * @member {Reference[]} Variable#references
249
+ */
250
+ this.references = [];
251
+
252
+ /**
253
+ * List of defining occurrences of this variable (like in 'var ...'
254
+ * statements or as parameter), as custom objects.
255
+ * @member {Definition[]} Variable#defs
256
+ */
257
+ this.defs = [];
258
+
259
+ this.tainted = false;
260
+
261
+ /**
262
+ * Whether this is a stack variable.
263
+ * @member {boolean} Variable#stack
264
+ */
265
+ this.stack = true;
266
+
267
+ /**
268
+ * Reference to the enclosing Scope.
269
+ * @member {Scope} Variable#scope
270
+ */
271
+ this.scope = scope;
272
+ }
273
+ }
274
+
275
+ Variable.CatchClause = "CatchClause";
276
+ Variable.Parameter = "Parameter";
277
+ Variable.FunctionName = "FunctionName";
278
+ Variable.ClassName = "ClassName";
279
+ Variable.Variable = "Variable";
280
+ Variable.ImportBinding = "ImportBinding";
281
+ Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable";
282
+
283
+ /* vim: set sw=4 ts=4 et tw=80 : */
284
+
285
+ /*
286
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
287
+
288
+ Redistribution and use in source and binary forms, with or without
289
+ modification, are permitted provided that the following conditions are met:
290
+
291
+ * Redistributions of source code must retain the above copyright
292
+ notice, this list of conditions and the following disclaimer.
293
+ * Redistributions in binary form must reproduce the above copyright
294
+ notice, this list of conditions and the following disclaimer in the
295
+ documentation and/or other materials provided with the distribution.
296
+
297
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
298
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
299
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
300
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
301
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
302
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
303
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
304
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
305
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
306
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
307
+ */
308
+
309
+ /** @import * as types from "eslint-scope" */
310
+
311
+ // Cannot implement `types.Definition` directly because it contains a union.
312
+ /**
313
+ * @constructor Definition
314
+ * @implements {Omit<types.Definition, never>}
315
+ */
316
+ class Definition {
317
+ constructor(type, name, node, parent, index, kind) {
318
+
319
+ /**
320
+ * @member {string} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
321
+ */
322
+ this.type = type;
323
+
324
+ /**
325
+ * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence.
326
+ */
327
+ this.name = name;
328
+
329
+ /**
330
+ * @member {espree.Node} Definition#node - the enclosing node of the identifier.
331
+ */
332
+ this.node = node;
333
+
334
+ /**
335
+ * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier.
336
+ */
337
+ this.parent = parent;
338
+
339
+ /**
340
+ * @member {number?} Definition#index - the index in the declaration statement.
341
+ */
342
+ this.index = index;
343
+
344
+ /**
345
+ * @member {string?} Definition#kind - the kind of the declaration statement.
346
+ */
347
+ this.kind = kind;
348
+ }
349
+ }
350
+
351
+ /**
352
+ * @constructor ParameterDefinition
353
+ */
354
+ class ParameterDefinition extends Definition {
355
+ constructor(name, node, index, rest) {
356
+ super(Variable.Parameter, name, node, null, index, null);
357
+
358
+ /**
359
+ * Whether the parameter definition is a part of a rest parameter.
360
+ * @member {boolean} ParameterDefinition#rest
361
+ */
362
+ this.rest = rest;
363
+ }
364
+ }
365
+
366
+ /* vim: set sw=4 ts=4 et tw=80 : */
367
+
368
+ /*
369
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
370
+
371
+ Redistribution and use in source and binary forms, with or without
372
+ modification, are permitted provided that the following conditions are met:
373
+
374
+ * Redistributions of source code must retain the above copyright
375
+ notice, this list of conditions and the following disclaimer.
376
+ * Redistributions in binary form must reproduce the above copyright
377
+ notice, this list of conditions and the following disclaimer in the
378
+ documentation and/or other materials provided with the distribution.
379
+
380
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
381
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
382
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
383
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
384
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
385
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
386
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
387
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
388
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
389
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
390
+ */
391
+
392
+ /** @import * as types from "eslint-scope" */
393
+ /** @import ESTree from "estree" */
394
+ /** @import ScopeManager from "./scope-manager.js" */
395
+ /** @typedef {ESTree.Function | ESTree.Program | ESTree.StaticBlock} Block */
396
+ /** @typedef {{pattern: unknown, node: unknown}} MaybeImplicitGlobal */
397
+
398
+ const { Syntax: Syntax$2 } = estraverse__default["default"];
399
+
400
+ /**
401
+ * Test if scope is struct
402
+ * @param {Scope} scope scope
403
+ * @param {Block} block block
404
+ * @param {boolean} isMethodDefinition is method definition
405
+ * @returns {boolean} is strict scope
406
+ */
407
+ function isStrictScope(scope, block, isMethodDefinition) {
408
+ let body;
409
+
410
+ // When upper scope is exists and strict, inner scope is also strict.
411
+ if (scope.upper && scope.upper.isStrict) {
412
+ return true;
413
+ }
414
+
415
+ if (isMethodDefinition) {
416
+ return true;
417
+ }
418
+
419
+ if (scope.type === "class" || scope.type === "module") {
420
+ return true;
421
+ }
422
+
423
+ if (scope.type === "block" || scope.type === "switch") {
424
+ return false;
425
+ }
426
+
427
+ if (scope.type === "function") {
428
+
429
+ // @ts-ignore -- when block is ArrowFunctionExpression
430
+ if (block.type === Syntax$2.ArrowFunctionExpression && block.body.type !== Syntax$2.BlockStatement) {
431
+ return false;
432
+ }
433
+
434
+ if (block.type === Syntax$2.Program) {
435
+ body = block;
436
+ } else {
437
+ body = block.body;
438
+ }
439
+
440
+ if (!body) {
441
+ return false;
442
+ }
443
+ } else if (scope.type === "global") {
444
+ body = block;
445
+ } else {
446
+ return false;
447
+ }
448
+
449
+ // Search for a 'use strict' directive.
450
+ // @ts-ignore -- body is a function body
451
+ for (let i = 0, iz = body.body.length; i < iz; ++i) {
452
+
453
+ // @ts-ignore -- body is a function body
454
+ const stmt = body.body[i];
455
+
456
+ /*
457
+ * Check if the current statement is a directive.
458
+ * If it isn't, then we're past the directive prologue
459
+ * so stop the search because directives cannot
460
+ * appear after this point.
461
+ *
462
+ * Some parsers set `directive:null` on non-directive
463
+ * statements, so the `typeof` check is safer than
464
+ * checking for property existence.
465
+ */
466
+ if (typeof stmt.directive !== "string") {
467
+ break;
468
+ }
469
+
470
+ if (stmt.directive === "use strict") {
471
+ return true;
472
+ }
473
+ }
474
+
475
+ return false;
476
+ }
477
+
478
+ /**
479
+ * Register scope
480
+ * @param {ScopeManager} scopeManager scope manager
481
+ * @param {Scope} scope scope
482
+ * @returns {void}
483
+ */
484
+ function registerScope(scopeManager, scope) {
485
+ scopeManager.scopes.push(scope);
486
+
487
+ const scopes = scopeManager.__nodeToScope.get(scope.block);
488
+
489
+ if (scopes) {
490
+ scopes.push(scope);
491
+ } else {
492
+ scopeManager.__nodeToScope.set(scope.block, [scope]);
493
+ }
494
+ }
495
+
496
+ /**
497
+ * @constructor Scope
498
+ * @implements {types.Scope}
499
+ */
500
+ class Scope {
501
+ constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
502
+
503
+ /**
504
+ * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
505
+ * "class", "class-field-initializer", "class-static-block".
506
+ * @member {string} Scope#type
507
+ */
508
+ this.type = type;
509
+
510
+ /**
511
+ * The scoped {@link Variable}s of this scope, as <code>{ Variable.name
512
+ * : Variable }</code>.
513
+ * @member {Map} Scope#set
514
+ */
515
+ this.set = new Map();
516
+
517
+ /**
518
+ * The tainted variables of this scope, as <code>{ Variable.name :
519
+ * boolean }</code>.
520
+ * @member {Map} Scope#taints
521
+ */
522
+ this.taints = new Map();
523
+
524
+ /**
525
+ * Generally, through the lexical scoping of JS you can always know
526
+ * which variable an identifier in the source code refers to. There are
527
+ * a few exceptions to this rule. With 'global' and 'with' scopes you
528
+ * can only decide at runtime which variable a reference refers to.
529
+ * Moreover, if 'eval()' is used in a scope, it might introduce new
530
+ * bindings in this or its parent scopes.
531
+ * All those scopes are considered 'dynamic'.
532
+ * @member {boolean} Scope#dynamic
533
+ */
534
+ this.dynamic = this.type === "global" || this.type === "with";
535
+
536
+ /**
537
+ * A reference to the scope-defining syntax node.
538
+ * @member {espree.Node} Scope#block
539
+ */
540
+ this.block = block;
541
+
542
+ /**
543
+ * The {@link Reference|references} that are not resolved with this scope.
544
+ * @member {Reference[]} Scope#through
545
+ */
546
+ this.through = [];
547
+
548
+ /**
549
+ * The scoped {@link Variable}s of this scope. In the case of a
550
+ * 'function' scope this includes the automatic argument <em>arguments</em> as
551
+ * its first element, as well as all further formal arguments.
552
+ * @member {Variable[]} Scope#variables
553
+ */
554
+ this.variables = [];
555
+
556
+ /**
557
+ * Any variable {@link Reference|reference} found in this scope. This
558
+ * includes occurrences of local variables as well as variables from
559
+ * parent scopes (including the global scope). For local variables
560
+ * this also includes defining occurrences (like in a 'var' statement).
561
+ * In a 'function' scope this does not include the occurrences of the
562
+ * formal parameter in the parameter list.
563
+ * @member {Reference[]} Scope#references
564
+ */
565
+ this.references = [];
566
+
567
+ /**
568
+ * For 'global' and 'function' scopes, this is a self-reference. For
569
+ * other scope types this is the <em>variableScope</em> value of the
570
+ * parent scope.
571
+ * @member {Scope} Scope#variableScope
572
+ */
573
+ this.variableScope =
574
+ this.type === "global" ||
575
+ this.type === "module" ||
576
+ this.type === "function" ||
577
+ this.type === "class-field-initializer" ||
578
+ this.type === "class-static-block"
579
+ ? this
580
+ : upperScope.variableScope;
581
+
582
+ /**
583
+ * Whether this scope is created by a FunctionExpression.
584
+ * @member {boolean} Scope#functionExpressionScope
585
+ */
586
+ this.functionExpressionScope = /** @type {any} */ (false);
587
+
588
+ /**
589
+ * Whether this is a scope that contains an 'eval()' invocation.
590
+ * @member {boolean} Scope#directCallToEvalScope
591
+ */
592
+ this.directCallToEvalScope = false;
593
+
594
+ /**
595
+ * @member {boolean} Scope#thisFound
596
+ */
597
+ this.thisFound = false;
598
+
599
+ /** @type {?Reference[]} */
600
+ this.__left = [];
601
+
602
+ /**
603
+ * Reference to the parent {@link Scope|scope}.
604
+ * @member {Scope} Scope#upper
605
+ */
606
+ this.upper = upperScope;
607
+
608
+ /**
609
+ * Whether 'use strict' is in effect in this scope.
610
+ * @member {boolean} Scope#isStrict
611
+ */
612
+ this.isStrict = scopeManager.isStrictModeSupported()
613
+ ? isStrictScope(this, block, isMethodDefinition)
614
+ : false;
615
+
616
+ /**
617
+ * List of nested {@link Scope}s.
618
+ * @member {Scope[]} Scope#childScopes
619
+ */
620
+ this.childScopes = [];
621
+ if (this.upper) {
622
+ this.upper.childScopes.push(this);
623
+ }
624
+
625
+ this.__declaredVariables = scopeManager.__declaredVariables;
626
+
627
+ registerScope(scopeManager, this);
628
+ }
629
+
630
+ __shouldStaticallyClose(scopeManager) {
631
+ return (!this.dynamic || scopeManager.__isOptimistic() || this.type === "global");
632
+ }
633
+
634
+ __staticCloseRef(ref) {
635
+ if (!this.__resolve(ref)) {
636
+ this.__delegateToUpperScope(ref);
637
+ }
638
+ }
639
+
640
+ __dynamicCloseRef(ref) {
641
+
642
+ // notify all names are through to global
643
+ let current = this;
644
+
645
+ do {
646
+ current.through.push(ref);
647
+ current = current.upper;
648
+ } while (current);
649
+ }
650
+
651
+ __close(scopeManager) {
652
+ let closeRef;
653
+
654
+ if (this.__shouldStaticallyClose(scopeManager)) {
655
+ closeRef = this.__staticCloseRef;
656
+ } else {
657
+ closeRef = this.__dynamicCloseRef;
658
+ }
659
+
660
+ // Try Resolving all references in this scope.
661
+ // @ts-ignore -- __left should be an array here
662
+ for (let i = 0, iz = this.__left.length; i < iz; ++i) {
663
+
664
+ // @ts-ignore -- __left should be an array here
665
+ const ref = this.__left[i];
666
+
667
+ closeRef.call(this, ref);
668
+ }
669
+ this.__left = null;
670
+
671
+ return this.upper;
672
+ }
673
+
674
+ // To override by function scopes.
675
+ // References in default parameters isn't resolved to variables which are in their function body.
676
+ __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars -- Desired as instance method with signature
677
+ return true;
678
+ }
679
+
680
+ __resolve(ref) {
681
+ const name = ref.identifier.name;
682
+
683
+ if (!this.set.has(name)) {
684
+ return false;
685
+ }
686
+ const variable = this.set.get(name);
687
+
688
+ if (!this.__isValidResolution(ref, variable)) {
689
+ return false;
690
+ }
691
+ variable.references.push(ref);
692
+ variable.stack = variable.stack && ref.from.variableScope === this.variableScope;
693
+ if (ref.tainted) {
694
+ variable.tainted = true;
695
+ this.taints.set(variable.name, true);
696
+ }
697
+ ref.resolved = variable;
698
+
699
+ return true;
700
+ }
701
+
702
+ __delegateToUpperScope(ref) {
703
+ if (this.upper) {
704
+ this.upper.__left.push(ref);
705
+ }
706
+ this.through.push(ref);
707
+ }
708
+
709
+ __addDeclaredVariablesOfNode(variable, node) {
710
+ if (node === null || node === void 0) {
711
+ return;
712
+ }
713
+
714
+ let variables = this.__declaredVariables.get(node);
715
+
716
+ if (variables === null || variables === void 0) {
717
+ variables = [];
718
+ this.__declaredVariables.set(node, variables);
719
+ }
720
+ if (!variables.includes(variable)) {
721
+ variables.push(variable);
722
+ }
723
+ }
724
+
725
+ __defineGeneric(name, set, variables, node, def) {
726
+ let variable;
727
+
728
+ variable = set.get(name);
729
+ if (!variable) {
730
+ variable = new Variable(name, this);
731
+ set.set(name, variable);
732
+ variables.push(variable);
733
+ }
734
+
735
+ if (def) {
736
+ variable.defs.push(def);
737
+ this.__addDeclaredVariablesOfNode(variable, def.node);
738
+ this.__addDeclaredVariablesOfNode(variable, def.parent);
739
+ }
740
+ if (node) {
741
+ variable.identifiers.push(node);
742
+ }
743
+ }
744
+
745
+ __define(node, def) {
746
+ if (node && node.type === Syntax$2.Identifier) {
747
+ this.__defineGeneric(
748
+ node.name,
749
+ this.set,
750
+ this.variables,
751
+ node,
752
+ def
753
+ );
754
+ }
755
+ }
756
+
757
+ __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) {
758
+
759
+ // because Array element may be null
760
+ if (!node || (node.type !== Syntax$2.Identifier && node.type !== "JSXIdentifier")) {
761
+ return;
762
+ }
763
+
764
+ // Specially handle like `this`.
765
+ if (node.name === "super") {
766
+ return;
767
+ }
768
+
769
+ const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init);
770
+
771
+ this.references.push(ref);
772
+
773
+ // @ts-ignore -- __left should be an array here
774
+ this.__left.push(ref);
775
+ }
776
+
777
+ __detectEval() {
778
+ let current = this;
779
+
780
+ this.directCallToEvalScope = true;
781
+ do {
782
+ current.dynamic = true;
783
+ current = current.upper;
784
+ } while (current);
785
+ }
786
+
787
+ __detectThis() {
788
+ this.thisFound = true;
789
+ }
790
+
791
+ __isClosed() {
792
+ return this.__left === null;
793
+ }
794
+
795
+ /**
796
+ * returns resolved {Reference}
797
+ * @function Scope#resolve
798
+ * @param {ESTree.Identifier} ident identifier to be resolved.
799
+ * @returns {?Reference} reference
800
+ */
801
+ resolve(ident) {
802
+ let ref, i, iz;
803
+
804
+ assert(this.__isClosed(), "Scope should be closed.");
805
+ assert(ident.type === Syntax$2.Identifier, "Target should be identifier.");
806
+ for (i = 0, iz = this.references.length; i < iz; ++i) {
807
+ ref = this.references[i];
808
+ if (ref.identifier === ident) {
809
+ return ref;
810
+ }
811
+ }
812
+ return null;
813
+ }
814
+
815
+ /**
816
+ * returns this scope is static
817
+ * @function Scope#isStatic
818
+ * @returns {boolean} static
819
+ */
820
+ isStatic() {
821
+ return !this.dynamic;
822
+ }
823
+
824
+ /**
825
+ * returns this scope has materialized arguments
826
+ * @function Scope#isArgumentsMaterialized
827
+ * @returns {any} arguments materialized
828
+ */
829
+ isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this -- Desired as instance method
830
+ return true;
831
+ }
832
+
833
+ /**
834
+ * returns this scope has materialized `this` reference
835
+ * @function Scope#isThisMaterialized
836
+ * @returns {any} this materialized
837
+ */
838
+ isThisMaterialized() { // eslint-disable-line class-methods-use-this -- Desired as instance method
839
+ return true;
840
+ }
841
+
842
+ isUsedName(name) {
843
+ if (this.set.has(name)) {
844
+ return true;
845
+ }
846
+ for (let i = 0, iz = this.through.length; i < iz; ++i) {
847
+ if (this.through[i].identifier.name === name) {
848
+ return true;
849
+ }
850
+ }
851
+ return false;
852
+ }
853
+ }
854
+
855
+ /**
856
+ * Global scope.
857
+ * @implements {types.GlobalScope}
858
+ */
859
+ class GlobalScope extends Scope {
860
+ constructor(scopeManager, block) {
861
+ super(scopeManager, "global", null, block, false);
862
+ this.implicit = {
863
+ set: new Map(),
864
+
865
+ /** @type {Variable[]} */
866
+ variables: [],
867
+
868
+ /**
869
+ * List of {@link Reference}s that are left to be resolved (i.e. which
870
+ * need to be linked to the variable they refer to).
871
+ * @member {Reference[]} Scope#implicit#left
872
+ * @type {Reference[]}
873
+ */
874
+ left: []
875
+ };
876
+ }
877
+
878
+ __close(scopeManager) {
879
+ const implicit = [];
880
+
881
+ // @ts-ignore -- __left should be an array here
882
+ for (let i = 0, iz = this.__left.length; i < iz; ++i) {
883
+
884
+ // @ts-ignore -- __left should be an array here
885
+ const ref = this.__left[i];
886
+
887
+ if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
888
+ implicit.push(ref.__maybeImplicitGlobal);
889
+ }
890
+ }
891
+
892
+ // create an implicit global variable from assignment expression
893
+ for (let i = 0, iz = implicit.length; i < iz; ++i) {
894
+ const info = implicit[i];
895
+
896
+ this.__defineImplicit(info.pattern,
897
+ new Definition(
898
+ Variable.ImplicitGlobalVariable,
899
+ info.pattern,
900
+ info.node,
901
+ null,
902
+ null,
903
+ null
904
+ ));
905
+
906
+ }
907
+
908
+ super.__close(scopeManager);
909
+
910
+ this.implicit.left = [...this.through];
911
+
912
+ return null;
913
+ }
914
+
915
+ __defineImplicit(node, def) {
916
+ if (node && node.type === Syntax$2.Identifier) {
917
+ this.__defineGeneric(
918
+ node.name,
919
+ this.implicit.set,
920
+ this.implicit.variables,
921
+ node,
922
+ def
923
+ );
924
+ }
925
+ }
926
+
927
+ __addVariables(names) {
928
+ for (const name of names) {
929
+ this.__defineGeneric(
930
+ name,
931
+ this.set,
932
+ this.variables,
933
+ null,
934
+ null
935
+ );
936
+ }
937
+
938
+ const namesSet = new Set(names);
939
+
940
+ this.through = this.through.filter(reference => {
941
+ const name = reference.identifier.name;
942
+
943
+ if (namesSet.has(name)) {
944
+ const variable = this.set.get(name);
945
+
946
+ reference.resolved = variable;
947
+ variable.references.push(reference);
948
+
949
+ return false;
950
+ }
951
+
952
+ return true;
953
+ });
954
+
955
+ this.implicit.variables = this.implicit.variables.filter(variable => {
956
+ const name = variable.name;
957
+
958
+ if (namesSet.has(name)) {
959
+ this.implicit.set.delete(name);
960
+
961
+ return false;
962
+ }
963
+
964
+ return true;
965
+ });
966
+
967
+ this.implicit.left = this.implicit.left.filter(
968
+ reference => !namesSet.has(reference.identifier.name)
969
+ );
970
+ }
971
+ }
972
+
973
+ /**
974
+ * Module scope.
975
+ * @implements {types.ModuleScope}
976
+ */
977
+ class ModuleScope extends Scope {
978
+ constructor(scopeManager, upperScope, block) {
979
+ super(scopeManager, "module", upperScope, block, false);
980
+ }
981
+ }
982
+
983
+ /**
984
+ * Function expression name scope.
985
+ * @implements {types.FunctionExpressionNameScope}
986
+ */
987
+ class FunctionExpressionNameScope extends Scope {
988
+ constructor(scopeManager, upperScope, block) {
989
+ super(scopeManager, "function-expression-name", upperScope, block, false);
990
+ this.__define(block.id,
991
+ new Definition(
992
+ Variable.FunctionName,
993
+ block.id,
994
+ block,
995
+ null,
996
+ null,
997
+ null
998
+ ));
999
+ this.functionExpressionScope = /** @type {const} */ (true);
1000
+ }
1001
+ }
1002
+
1003
+ /**
1004
+ * Catch scope.
1005
+ * @implements {types.CatchScope}
1006
+ */
1007
+ class CatchScope extends Scope {
1008
+ constructor(scopeManager, upperScope, block) {
1009
+ super(scopeManager, "catch", upperScope, block, false);
1010
+ }
1011
+ }
1012
+
1013
+ /**
1014
+ * With statement scope.
1015
+ * @implements {types.WithScope}
1016
+ */
1017
+ class WithScope extends Scope {
1018
+ constructor(scopeManager, upperScope, block) {
1019
+ super(scopeManager, "with", upperScope, block, false);
1020
+ }
1021
+
1022
+ __close(scopeManager) {
1023
+ if (this.__shouldStaticallyClose(scopeManager)) {
1024
+ return super.__close(scopeManager);
1025
+ }
1026
+
1027
+ // @ts-ignore -- __left should be an array here
1028
+ for (let i = 0, iz = this.__left.length; i < iz; ++i) {
1029
+
1030
+ // @ts-ignore -- __left should be an array here
1031
+ const ref = this.__left[i];
1032
+
1033
+ ref.tainted = true;
1034
+ this.__delegateToUpperScope(ref);
1035
+ }
1036
+ this.__left = null;
1037
+
1038
+ return this.upper;
1039
+ }
1040
+ }
1041
+
1042
+ /**
1043
+ * Block scope.
1044
+ * @implements {types.BlockScope}
1045
+ */
1046
+ class BlockScope extends Scope {
1047
+ constructor(scopeManager, upperScope, block) {
1048
+ super(scopeManager, "block", upperScope, block, false);
1049
+ }
1050
+ }
1051
+
1052
+ /**
1053
+ * Switch scope.
1054
+ * @implements {types.SwitchScope}
1055
+ */
1056
+ class SwitchScope extends Scope {
1057
+ constructor(scopeManager, upperScope, block) {
1058
+ super(scopeManager, "switch", upperScope, block, false);
1059
+ }
1060
+ }
1061
+
1062
+ /**
1063
+ * Function scope.
1064
+ * @implements {types.FunctionScope}
1065
+ */
1066
+ class FunctionScope extends Scope {
1067
+ constructor(scopeManager, upperScope, block, isMethodDefinition) {
1068
+ super(scopeManager, "function", upperScope, block, isMethodDefinition);
1069
+
1070
+ // section 9.2.13, FunctionDeclarationInstantiation.
1071
+ // NOTE Arrow functions never have an arguments objects.
1072
+ if (this.block.type !== Syntax$2.ArrowFunctionExpression) {
1073
+ this.__defineArguments();
1074
+ }
1075
+ }
1076
+
1077
+ isArgumentsMaterialized() {
1078
+
1079
+ // TODO(Constellation)
1080
+ // We can more aggressive on this condition like this.
1081
+ //
1082
+ // function t() {
1083
+ // // arguments of t is always hidden.
1084
+ // function arguments() {
1085
+ // }
1086
+ // }
1087
+ if (this.block.type === Syntax$2.ArrowFunctionExpression) {
1088
+ return false;
1089
+ }
1090
+
1091
+ if (!this.isStatic()) {
1092
+ return true;
1093
+ }
1094
+
1095
+ const variable = this.set.get("arguments");
1096
+
1097
+ assert(variable, "Always have arguments variable.");
1098
+ return variable.tainted || variable.references.length !== 0;
1099
+ }
1100
+
1101
+ isThisMaterialized() {
1102
+ if (!this.isStatic()) {
1103
+ return true;
1104
+ }
1105
+ return this.thisFound;
1106
+ }
1107
+
1108
+ __defineArguments() {
1109
+ this.__defineGeneric(
1110
+ "arguments",
1111
+ this.set,
1112
+ this.variables,
1113
+ null,
1114
+ null
1115
+ );
1116
+ this.taints.set("arguments", true);
1117
+ }
1118
+
1119
+ // References in default parameters isn't resolved to variables which are in their function body.
1120
+ // const x = 1
1121
+ // function f(a = x) { // This `x` is resolved to the `x` in the outer scope.
1122
+ // const x = 2
1123
+ // console.log(a)
1124
+ // }
1125
+ __isValidResolution(ref, variable) {
1126
+
1127
+ // If `options.nodejsScope` is true, `this.block` becomes a Program node.
1128
+ if (this.block.type === "Program") {
1129
+ return true;
1130
+ }
1131
+
1132
+ const bodyStart = this.block.body.range[0];
1133
+
1134
+ // It's invalid resolution in the following case:
1135
+ return !(
1136
+ variable.scope === this &&
1137
+ ref.identifier.range[0] < bodyStart && // the reference is in the parameter part.
1138
+ variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body.
1139
+ );
1140
+ }
1141
+ }
1142
+
1143
+ /**
1144
+ * Scope of for, for-in, and for-of statements.
1145
+ * @implements {types.ForScope}
1146
+ */
1147
+ class ForScope extends Scope {
1148
+ constructor(scopeManager, upperScope, block) {
1149
+ super(scopeManager, "for", upperScope, block, false);
1150
+ }
1151
+ }
1152
+
1153
+ /**
1154
+ * Class scope.
1155
+ * @implements {types.ClassScope}
1156
+ */
1157
+ class ClassScope extends Scope {
1158
+ constructor(scopeManager, upperScope, block) {
1159
+ super(scopeManager, "class", upperScope, block, false);
1160
+ }
1161
+ }
1162
+
1163
+ /**
1164
+ * Class field initializer scope.
1165
+ * @implements {types.ClassFieldInitializerScope}
1166
+ */
1167
+ class ClassFieldInitializerScope extends Scope {
1168
+ constructor(scopeManager, upperScope, block) {
1169
+ super(scopeManager, "class-field-initializer", upperScope, block, true);
1170
+ }
1171
+ }
1172
+
1173
+ /**
1174
+ * Class static block scope.
1175
+ * @implements {types.ClassStaticBlockScope}
1176
+ */
1177
+ class ClassStaticBlockScope extends Scope {
1178
+ constructor(scopeManager, upperScope, block) {
1179
+ super(scopeManager, "class-static-block", upperScope, block, true);
1180
+ }
1181
+ }
1182
+
1183
+ /* vim: set sw=4 ts=4 et tw=80 : */
1184
+
1185
+ /*
1186
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
1187
+
1188
+ Redistribution and use in source and binary forms, with or without
1189
+ modification, are permitted provided that the following conditions are met:
1190
+
1191
+ * Redistributions of source code must retain the above copyright
1192
+ notice, this list of conditions and the following disclaimer.
1193
+ * Redistributions in binary form must reproduce the above copyright
1194
+ notice, this list of conditions and the following disclaimer in the
1195
+ documentation and/or other materials provided with the distribution.
1196
+
1197
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1198
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1199
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1200
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
1201
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1202
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1203
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1204
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1205
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1206
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1207
+ */
1208
+
1209
+ /** @import * as types from "eslint-scope" */
1210
+ /** @import ESTree from "estree" */
1211
+ /** @import { Scope } from "./scope.js" */
1212
+ /** @import Variable from "./variable.js" */
1213
+
1214
+ /**
1215
+ * @constructor ScopeManager
1216
+ * @implements {types.ScopeManager}
1217
+ */
1218
+ class ScopeManager {
1219
+ constructor(options) {
1220
+ this.scopes = [];
1221
+ this.globalScope = null;
1222
+ this.__nodeToScope = new WeakMap();
1223
+ this.__currentScope = null;
1224
+ this.__options = options;
1225
+ this.__declaredVariables = new WeakMap();
1226
+ }
1227
+
1228
+ __isOptimistic() {
1229
+ return this.__options.optimistic;
1230
+ }
1231
+
1232
+ __ignoreEval() {
1233
+ return this.__options.ignoreEval;
1234
+ }
1235
+
1236
+ __isJSXEnabled() {
1237
+ return this.__options.jsx === true;
1238
+ }
1239
+
1240
+ isGlobalReturn() {
1241
+ return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
1242
+ }
1243
+
1244
+ isModule() {
1245
+ return this.__options.sourceType === "module";
1246
+ }
1247
+
1248
+ isImpliedStrict() {
1249
+ return !!this.__options.impliedStrict;
1250
+ }
1251
+
1252
+ isStrictModeSupported() {
1253
+ return this.__options.ecmaVersion >= 5;
1254
+ }
1255
+
1256
+ // Returns appropriate scope for this node.
1257
+ __get(node) {
1258
+ return this.__nodeToScope.get(node);
1259
+ }
1260
+
1261
+ /**
1262
+ * Get variables that are declared by the node.
1263
+ *
1264
+ * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
1265
+ * If the node declares nothing, this method returns an empty array.
1266
+ * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
1267
+ * @param {ESTree.Node} node a node to get.
1268
+ * @returns {Variable[]} variables that declared by the node.
1269
+ */
1270
+ getDeclaredVariables(node) {
1271
+ return this.__declaredVariables.get(node) || [];
1272
+ }
1273
+
1274
+ /**
1275
+ * acquire scope from node.
1276
+ * @function ScopeManager#acquire
1277
+ * @param {ESTree.Node} node node for the acquired scope.
1278
+ * @param {?boolean} [inner=false] look up the most inner scope, default value is false.
1279
+ * @returns {Scope?} Scope from node
1280
+ */
1281
+ acquire(node, inner) {
1282
+
1283
+ /**
1284
+ * predicate
1285
+ * @param {Scope} testScope scope to test
1286
+ * @returns {boolean} predicate
1287
+ */
1288
+ function predicate(testScope) {
1289
+ if (testScope.type === "function" && testScope.functionExpressionScope) {
1290
+ return false;
1291
+ }
1292
+ return true;
1293
+ }
1294
+
1295
+ const scopes = this.__get(node);
1296
+
1297
+ if (!scopes || scopes.length === 0) {
1298
+ return null;
1299
+ }
1300
+
1301
+ // Heuristic selection from all scopes.
1302
+ // If you would like to get all scopes, please use ScopeManager#acquireAll.
1303
+ if (scopes.length === 1) {
1304
+ return scopes[0];
1305
+ }
1306
+
1307
+ if (inner) {
1308
+ for (let i = scopes.length - 1; i >= 0; --i) {
1309
+ const scope = scopes[i];
1310
+
1311
+ if (predicate(scope)) {
1312
+ return scope;
1313
+ }
1314
+ }
1315
+ } else {
1316
+ for (let i = 0, iz = scopes.length; i < iz; ++i) {
1317
+ const scope = scopes[i];
1318
+
1319
+ if (predicate(scope)) {
1320
+ return scope;
1321
+ }
1322
+ }
1323
+ }
1324
+
1325
+ return null;
1326
+ }
1327
+
1328
+ /**
1329
+ * acquire all scopes from node.
1330
+ * @function ScopeManager#acquireAll
1331
+ * @param {ESTree.Node} node node for the acquired scope.
1332
+ * @returns {Scope[]?} Scope array
1333
+ */
1334
+ acquireAll(node) {
1335
+ return this.__get(node);
1336
+ }
1337
+
1338
+ /**
1339
+ * release the node.
1340
+ * @function ScopeManager#release
1341
+ * @param {ESTree.Node} node releasing node.
1342
+ * @param {?boolean} [inner=false] look up the most inner scope, default value is false.
1343
+ * @returns {Scope?} upper scope for the node.
1344
+ */
1345
+ release(node, inner) {
1346
+ const scopes = this.__get(node);
1347
+
1348
+ if (scopes && scopes.length) {
1349
+ const scope = scopes[0].upper;
1350
+
1351
+ if (!scope) {
1352
+ return null;
1353
+ }
1354
+ return this.acquire(scope.block, inner);
1355
+ }
1356
+ return null;
1357
+ }
1358
+
1359
+ /**
1360
+ * Add global variables and resolve their references.
1361
+ * @function ScopeManager#addGlobals
1362
+ * @param {string[]} names Names of global variables to add.
1363
+ * @returns {void}
1364
+ */
1365
+ addGlobals(names) {
1366
+
1367
+ // @ts-ignore -- globalScope must be set before this method is called.
1368
+ this.globalScope.__addVariables(names);
1369
+ }
1370
+
1371
+ attach() { } // eslint-disable-line class-methods-use-this -- Desired as instance method
1372
+
1373
+ detach() { } // eslint-disable-line class-methods-use-this -- Desired as instance method
1374
+
1375
+ __nestScope(scope) {
1376
+ if (scope instanceof GlobalScope) {
1377
+ assert(this.__currentScope === null);
1378
+ this.globalScope = scope;
1379
+ }
1380
+ this.__currentScope = scope;
1381
+ return scope;
1382
+ }
1383
+
1384
+ __nestGlobalScope(node) {
1385
+ return this.__nestScope(new GlobalScope(this, node));
1386
+ }
1387
+
1388
+ __nestBlockScope(node) {
1389
+ return this.__nestScope(new BlockScope(this, this.__currentScope, node));
1390
+ }
1391
+
1392
+ __nestFunctionScope(node, isMethodDefinition) {
1393
+ return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition));
1394
+ }
1395
+
1396
+ __nestForScope(node) {
1397
+ return this.__nestScope(new ForScope(this, this.__currentScope, node));
1398
+ }
1399
+
1400
+ __nestCatchScope(node) {
1401
+ return this.__nestScope(new CatchScope(this, this.__currentScope, node));
1402
+ }
1403
+
1404
+ __nestWithScope(node) {
1405
+ return this.__nestScope(new WithScope(this, this.__currentScope, node));
1406
+ }
1407
+
1408
+ __nestClassScope(node) {
1409
+ return this.__nestScope(new ClassScope(this, this.__currentScope, node));
1410
+ }
1411
+
1412
+ __nestClassFieldInitializerScope(node) {
1413
+ return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
1414
+ }
1415
+
1416
+ __nestClassStaticBlockScope(node) {
1417
+ return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
1418
+ }
1419
+
1420
+ __nestSwitchScope(node) {
1421
+ return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
1422
+ }
1423
+
1424
+ __nestModuleScope(node) {
1425
+ return this.__nestScope(new ModuleScope(this, this.__currentScope, node));
1426
+ }
1427
+
1428
+ __nestFunctionExpressionNameScope(node) {
1429
+ return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node));
1430
+ }
1431
+
1432
+ __isES6() {
1433
+ return this.__options.ecmaVersion >= 6;
1434
+ }
1435
+ }
1436
+
1437
+ /* vim: set sw=4 ts=4 et tw=80 : */
1438
+
1439
+ /*
1440
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
1441
+
1442
+ Redistribution and use in source and binary forms, with or without
1443
+ modification, are permitted provided that the following conditions are met:
1444
+
1445
+ * Redistributions of source code must retain the above copyright
1446
+ notice, this list of conditions and the following disclaimer.
1447
+ * Redistributions in binary form must reproduce the above copyright
1448
+ notice, this list of conditions and the following disclaimer in the
1449
+ documentation and/or other materials provided with the distribution.
1450
+
1451
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1452
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1453
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1454
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
1455
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1456
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1457
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1458
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1459
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1460
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1461
+ */
1462
+
1463
+ /** @import * as types from "eslint-scope" */
1464
+
1465
+ const { Syntax: Syntax$1 } = estraverse__default["default"];
1466
+
1467
+ /**
1468
+ * Get last array element
1469
+ * @param {Array} xs array
1470
+ * @returns {any} Last elment
1471
+ */
1472
+ function getLast(xs) {
1473
+ return xs.at(-1) || null;
1474
+ }
1475
+
1476
+ /**
1477
+ * Visitor for destructuring patterns.
1478
+ * @implements {types.PatternVisitor}
1479
+ */
1480
+ class PatternVisitor extends esrecurse__default["default"].Visitor {
1481
+ static isPattern(node) {
1482
+ const nodeType = node.type;
1483
+
1484
+ return (
1485
+ nodeType === Syntax$1.Identifier ||
1486
+ nodeType === Syntax$1.ObjectPattern ||
1487
+ nodeType === Syntax$1.ArrayPattern ||
1488
+ nodeType === Syntax$1.SpreadElement ||
1489
+ nodeType === Syntax$1.RestElement ||
1490
+ nodeType === Syntax$1.AssignmentPattern
1491
+ );
1492
+ }
1493
+
1494
+ constructor(options, rootPattern, callback) {
1495
+ super(null, options);
1496
+ this.rootPattern = rootPattern;
1497
+ this.callback = callback;
1498
+ this.assignments = [];
1499
+ this.rightHandNodes = [];
1500
+ this.restElements = [];
1501
+ }
1502
+
1503
+ Identifier(pattern) {
1504
+ const lastRestElement = getLast(this.restElements);
1505
+
1506
+ this.callback(pattern, {
1507
+ topLevel: pattern === this.rootPattern,
1508
+ rest: lastRestElement !== null && lastRestElement !== void 0 && lastRestElement.argument === pattern,
1509
+ assignments: this.assignments
1510
+ });
1511
+ }
1512
+
1513
+ Property(property) {
1514
+
1515
+ // Computed property's key is a right hand node.
1516
+ if (property.computed) {
1517
+ this.rightHandNodes.push(property.key);
1518
+ }
1519
+
1520
+ // If it's shorthand, its key is same as its value.
1521
+ // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern).
1522
+ // If it's not shorthand, the name of new variable is its value's.
1523
+ this.visit(property.value);
1524
+ }
1525
+
1526
+ ArrayPattern(pattern) {
1527
+ for (let i = 0, iz = pattern.elements.length; i < iz; ++i) {
1528
+ const element = pattern.elements[i];
1529
+
1530
+ this.visit(element);
1531
+ }
1532
+ }
1533
+
1534
+ AssignmentPattern(pattern) {
1535
+ this.assignments.push(pattern);
1536
+ this.visit(pattern.left);
1537
+ this.rightHandNodes.push(pattern.right);
1538
+ this.assignments.pop();
1539
+ }
1540
+
1541
+ RestElement(pattern) {
1542
+ this.restElements.push(pattern);
1543
+ this.visit(pattern.argument);
1544
+ this.restElements.pop();
1545
+ }
1546
+
1547
+ MemberExpression(node) {
1548
+
1549
+ // Computed property's key is a right hand node.
1550
+ if (node.computed) {
1551
+ this.rightHandNodes.push(node.property);
1552
+ }
1553
+
1554
+ // the object is only read, write to its property.
1555
+ this.rightHandNodes.push(node.object);
1556
+ }
1557
+
1558
+ //
1559
+ // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
1560
+ // By spec, LeftHandSideExpression is Pattern or MemberExpression.
1561
+ // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
1562
+ // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc...
1563
+ //
1564
+
1565
+ SpreadElement(node) {
1566
+ this.visit(node.argument);
1567
+ }
1568
+
1569
+ ArrayExpression(node) {
1570
+ node.elements.forEach(this.visit, this);
1571
+ }
1572
+
1573
+ AssignmentExpression(node) {
1574
+ this.assignments.push(node);
1575
+ this.visit(node.left);
1576
+ this.rightHandNodes.push(node.right);
1577
+ this.assignments.pop();
1578
+ }
1579
+
1580
+ CallExpression(node) {
1581
+
1582
+ // arguments are right hand nodes.
1583
+ node.arguments.forEach(a => {
1584
+ this.rightHandNodes.push(a);
1585
+ });
1586
+ this.visit(node.callee);
1587
+ }
1588
+ }
1589
+
1590
+ /* vim: set sw=4 ts=4 et tw=80 : */
1591
+
1592
+ /*
1593
+ Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
1594
+
1595
+ Redistribution and use in source and binary forms, with or without
1596
+ modification, are permitted provided that the following conditions are met:
1597
+
1598
+ * Redistributions of source code must retain the above copyright
1599
+ notice, this list of conditions and the following disclaimer.
1600
+ * Redistributions in binary form must reproduce the above copyright
1601
+ notice, this list of conditions and the following disclaimer in the
1602
+ documentation and/or other materials provided with the distribution.
1603
+
1604
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1605
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1606
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1607
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
1608
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1609
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1610
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1611
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1612
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1613
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1614
+ */
1615
+
1616
+ /** @import * as types from "eslint-scope" */
1617
+ /** @import ESTree from "estree" */
1618
+
1619
+ const { Syntax } = estraverse__default["default"];
1620
+
1621
+ /**
1622
+ * Traverse identifier in pattern
1623
+ * @param {Object} options options
1624
+ * @param {ESTree.Pattern} rootPattern root pattern
1625
+ * @param {?Referencer} referencer referencer
1626
+ * @param {types.PatternVisitorCallback} callback callback
1627
+ * @returns {void}
1628
+ */
1629
+ function traverseIdentifierInPattern(options, rootPattern, referencer, callback) {
1630
+
1631
+ // Call the callback at left hand identifier nodes, and Collect right hand nodes.
1632
+ const visitor = new PatternVisitor(options, rootPattern, callback);
1633
+
1634
+ visitor.visit(rootPattern);
1635
+
1636
+ // Process the right hand nodes recursively.
1637
+ if (referencer !== null && referencer !== void 0) {
1638
+ visitor.rightHandNodes.forEach(referencer.visit, referencer);
1639
+ }
1640
+ }
1641
+
1642
+ // Importing ImportDeclaration.
1643
+ // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation
1644
+ // https://github.com/estree/estree/blob/master/es6.md#importdeclaration
1645
+ // FIXME: Now, we don't create module environment, because the context is
1646
+ // implementation dependent.
1647
+
1648
+ /**
1649
+ * Visitor for import specifiers.
1650
+ */
1651
+ class Importer extends esrecurse__default["default"].Visitor {
1652
+ constructor(declaration, referencer) {
1653
+ super(null, referencer.options);
1654
+ this.declaration = declaration;
1655
+ this.referencer = referencer;
1656
+ }
1657
+
1658
+ visitImport(id, specifier) {
1659
+ this.referencer.visitPattern(id, pattern => {
1660
+ this.referencer.currentScope().__define(pattern,
1661
+ new Definition(
1662
+ Variable.ImportBinding,
1663
+ pattern,
1664
+ specifier,
1665
+ this.declaration,
1666
+ null,
1667
+ null
1668
+ ));
1669
+ });
1670
+ }
1671
+
1672
+ ImportNamespaceSpecifier(node) {
1673
+ const local = (node.local || node.id);
1674
+
1675
+ if (local) {
1676
+ this.visitImport(local, node);
1677
+ }
1678
+ }
1679
+
1680
+ ImportDefaultSpecifier(node) {
1681
+ const local = (node.local || node.id);
1682
+
1683
+ this.visitImport(local, node);
1684
+ }
1685
+
1686
+ ImportSpecifier(node) {
1687
+ const local = (node.local || node.id);
1688
+
1689
+ if (node.name) {
1690
+ this.visitImport(node.name, node);
1691
+ } else {
1692
+ this.visitImport(local, node);
1693
+ }
1694
+ }
1695
+ }
1696
+
1697
+ /**
1698
+ * Referencing variables and creating bindings.
1699
+ * @implements {types.Referencer}
1700
+ */
1701
+ class Referencer extends esrecurse__default["default"].Visitor {
1702
+ constructor(options, scopeManager) {
1703
+ super(null, options);
1704
+ this.options = options;
1705
+ this.scopeManager = scopeManager;
1706
+ this.parent = null;
1707
+ this.isInnerMethodDefinition = false;
1708
+ }
1709
+
1710
+ currentScope() {
1711
+ return this.scopeManager.__currentScope;
1712
+ }
1713
+
1714
+ close(node) {
1715
+ while (this.currentScope() && node === this.currentScope().block) {
1716
+ this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager);
1717
+ }
1718
+ }
1719
+
1720
+ pushInnerMethodDefinition(isInnerMethodDefinition) {
1721
+ const previous = this.isInnerMethodDefinition;
1722
+
1723
+ this.isInnerMethodDefinition = isInnerMethodDefinition;
1724
+ return previous;
1725
+ }
1726
+
1727
+ popInnerMethodDefinition(isInnerMethodDefinition) {
1728
+ this.isInnerMethodDefinition = isInnerMethodDefinition;
1729
+ }
1730
+
1731
+ referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) {
1732
+ const scope = this.currentScope();
1733
+
1734
+ assignments.forEach(assignment => {
1735
+ scope.__referencing(
1736
+ pattern,
1737
+ Reference.WRITE,
1738
+ assignment.right,
1739
+ maybeImplicitGlobal,
1740
+ pattern !== assignment.left,
1741
+ init
1742
+ );
1743
+ });
1744
+ }
1745
+
1746
+ visitPattern(node, options, callback) {
1747
+ let visitPatternOptions = options;
1748
+ let visitPatternCallback = callback;
1749
+
1750
+ if (typeof options === "function") {
1751
+ visitPatternCallback = options;
1752
+ visitPatternOptions = { processRightHandNodes: false };
1753
+ }
1754
+
1755
+ traverseIdentifierInPattern(
1756
+ this.options,
1757
+ node,
1758
+ visitPatternOptions.processRightHandNodes ? this : null,
1759
+ visitPatternCallback
1760
+ );
1761
+ }
1762
+
1763
+ visitFunction(node) {
1764
+ let i, iz;
1765
+
1766
+ // FunctionDeclaration name is defined in upper scope
1767
+ // NOTE: Not referring variableScope. It is intended.
1768
+ // Since
1769
+ // in ES5, FunctionDeclaration should be in FunctionBody.
1770
+ // in ES6, FunctionDeclaration should be block scoped.
1771
+
1772
+ if (node.type === Syntax.FunctionDeclaration) {
1773
+
1774
+ // id is defined in upper scope
1775
+ this.currentScope().__define(node.id,
1776
+ new Definition(
1777
+ Variable.FunctionName,
1778
+ node.id,
1779
+ node,
1780
+ null,
1781
+ null,
1782
+ null
1783
+ ));
1784
+ }
1785
+
1786
+ // FunctionExpression with name creates its special scope;
1787
+ // FunctionExpressionNameScope.
1788
+ if (node.type === Syntax.FunctionExpression && node.id) {
1789
+ this.scopeManager.__nestFunctionExpressionNameScope(node);
1790
+ }
1791
+
1792
+ // Consider this function is in the MethodDefinition.
1793
+ this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition);
1794
+
1795
+ const that = this;
1796
+
1797
+ /**
1798
+ * Visit pattern callback
1799
+ * @param {ESTree.Pattern} pattern pattern
1800
+ * @param {Object} info info
1801
+ * @returns {void}
1802
+ */
1803
+ function visitPatternCallback(pattern, info) {
1804
+ that.currentScope().__define(pattern,
1805
+ new ParameterDefinition(
1806
+ pattern,
1807
+ node,
1808
+ i,
1809
+ info.rest
1810
+ ));
1811
+
1812
+ that.referencingDefaultValue(pattern, info.assignments, null, true);
1813
+ }
1814
+
1815
+ // Process parameter declarations.
1816
+ for (i = 0, iz = node.params.length; i < iz; ++i) {
1817
+ this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback);
1818
+ }
1819
+
1820
+ // if there's a rest argument, add that
1821
+ if (node.rest) {
1822
+ this.visitPattern({
1823
+ type: "RestElement",
1824
+ argument: node.rest
1825
+ }, pattern => {
1826
+ this.currentScope().__define(pattern,
1827
+ new ParameterDefinition(
1828
+ pattern,
1829
+ node,
1830
+ node.params.length,
1831
+ true
1832
+ ));
1833
+ });
1834
+ }
1835
+
1836
+ // In TypeScript there are a number of function-like constructs which have no body,
1837
+ // so check it exists before traversing
1838
+ if (node.body) {
1839
+
1840
+ // Skip BlockStatement to prevent creating BlockStatement scope.
1841
+ if (node.body.type === Syntax.BlockStatement) {
1842
+ this.visitChildren(node.body);
1843
+ } else {
1844
+ this.visit(node.body);
1845
+ }
1846
+ }
1847
+
1848
+ this.close(node);
1849
+ }
1850
+
1851
+ visitClass(node) {
1852
+ if (node.type === Syntax.ClassDeclaration) {
1853
+ this.currentScope().__define(node.id,
1854
+ new Definition(
1855
+ Variable.ClassName,
1856
+ node.id,
1857
+ node,
1858
+ null,
1859
+ null,
1860
+ null
1861
+ ));
1862
+ }
1863
+
1864
+ this.scopeManager.__nestClassScope(node);
1865
+
1866
+ if (node.id) {
1867
+ this.currentScope().__define(node.id,
1868
+ new Definition(
1869
+ Variable.ClassName,
1870
+ node.id,
1871
+ node
1872
+ ));
1873
+ }
1874
+
1875
+ this.visit(node.superClass);
1876
+ this.visit(node.body);
1877
+
1878
+ this.close(node);
1879
+ }
1880
+
1881
+ visitProperty(node) {
1882
+ let previous;
1883
+
1884
+ if (node.computed) {
1885
+ this.visit(node.key);
1886
+ }
1887
+
1888
+ const isMethodDefinition = node.type === Syntax.MethodDefinition;
1889
+
1890
+ if (isMethodDefinition) {
1891
+ previous = this.pushInnerMethodDefinition(true);
1892
+ }
1893
+ this.visit(node.value);
1894
+ if (isMethodDefinition) {
1895
+ this.popInnerMethodDefinition(previous);
1896
+ }
1897
+ }
1898
+
1899
+ visitForIn(node) {
1900
+ if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") {
1901
+ this.scopeManager.__nestForScope(node);
1902
+ }
1903
+
1904
+ if (node.left.type === Syntax.VariableDeclaration) {
1905
+ this.visit(node.left);
1906
+ this.visitPattern(node.left.declarations[0].id, pattern => {
1907
+ this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true);
1908
+ });
1909
+ } else {
1910
+ this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
1911
+ let maybeImplicitGlobal = null;
1912
+
1913
+ if (!this.currentScope().isStrict) {
1914
+ maybeImplicitGlobal = {
1915
+ pattern,
1916
+ node
1917
+ };
1918
+ }
1919
+ this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
1920
+ this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false);
1921
+ });
1922
+ }
1923
+ this.visit(node.right);
1924
+ this.visit(node.body);
1925
+
1926
+ this.close(node);
1927
+ }
1928
+
1929
+ visitVariableDeclaration(variableTargetScope, type, node, index) {
1930
+
1931
+ const decl = node.declarations[index];
1932
+ const init = decl.init;
1933
+
1934
+ this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => {
1935
+ variableTargetScope.__define(
1936
+ pattern,
1937
+ new Definition(
1938
+ type,
1939
+ pattern,
1940
+ decl,
1941
+ node,
1942
+ index,
1943
+ node.kind
1944
+ )
1945
+ );
1946
+
1947
+ this.referencingDefaultValue(pattern, info.assignments, null, true);
1948
+ if (init) {
1949
+ this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true);
1950
+ }
1951
+ });
1952
+ }
1953
+
1954
+ AssignmentExpression(node) {
1955
+ if (PatternVisitor.isPattern(node.left)) {
1956
+ if (node.operator === "=") {
1957
+ this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => {
1958
+ let maybeImplicitGlobal = null;
1959
+
1960
+ if (!this.currentScope().isStrict) {
1961
+ maybeImplicitGlobal = {
1962
+ pattern,
1963
+ node
1964
+ };
1965
+ }
1966
+ this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
1967
+ this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false);
1968
+ });
1969
+ } else {
1970
+ this.currentScope().__referencing(node.left, Reference.RW, node.right);
1971
+ }
1972
+ } else {
1973
+ this.visit(node.left);
1974
+ }
1975
+ this.visit(node.right);
1976
+ }
1977
+
1978
+ CatchClause(node) {
1979
+ this.scopeManager.__nestCatchScope(node);
1980
+
1981
+ this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => {
1982
+ this.currentScope().__define(pattern,
1983
+ new Definition(
1984
+ Variable.CatchClause,
1985
+ pattern,
1986
+ node,
1987
+ null,
1988
+ null,
1989
+ null
1990
+ ));
1991
+ this.referencingDefaultValue(pattern, info.assignments, null, true);
1992
+ });
1993
+ this.visit(node.body);
1994
+
1995
+ this.close(node);
1996
+ }
1997
+
1998
+ Program(node) {
1999
+ this.scopeManager.__nestGlobalScope(node);
2000
+
2001
+ if (this.scopeManager.isGlobalReturn()) {
2002
+
2003
+ // Force strictness of GlobalScope to false when using node.js scope.
2004
+ this.currentScope().isStrict = false;
2005
+ this.scopeManager.__nestFunctionScope(node, false);
2006
+ }
2007
+
2008
+ if (this.scopeManager.__isES6() && this.scopeManager.isModule()) {
2009
+ this.scopeManager.__nestModuleScope(node);
2010
+ }
2011
+
2012
+ if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) {
2013
+ this.currentScope().isStrict = true;
2014
+ }
2015
+
2016
+ this.visitChildren(node);
2017
+ this.close(node);
2018
+ }
2019
+
2020
+ Identifier(node) {
2021
+ this.currentScope().__referencing(node);
2022
+ }
2023
+
2024
+ // eslint-disable-next-line class-methods-use-this -- Desired as instance method
2025
+ PrivateIdentifier() {
2026
+
2027
+ // Do nothing.
2028
+ }
2029
+
2030
+ UpdateExpression(node) {
2031
+ if (PatternVisitor.isPattern(node.argument)) {
2032
+ this.currentScope().__referencing(node.argument, Reference.RW, null);
2033
+ } else {
2034
+ this.visitChildren(node);
2035
+ }
2036
+ }
2037
+
2038
+ MemberExpression(node) {
2039
+ this.visit(node.object);
2040
+ if (node.computed) {
2041
+ this.visit(node.property);
2042
+ }
2043
+ }
2044
+
2045
+ Property(node) {
2046
+ this.visitProperty(node);
2047
+ }
2048
+
2049
+ PropertyDefinition(node) {
2050
+ const { computed, key, value } = node;
2051
+
2052
+ if (computed) {
2053
+ this.visit(key);
2054
+ }
2055
+ if (value) {
2056
+ this.scopeManager.__nestClassFieldInitializerScope(value);
2057
+ this.visit(value);
2058
+ this.close(value);
2059
+ }
2060
+ }
2061
+
2062
+ StaticBlock(node) {
2063
+ this.scopeManager.__nestClassStaticBlockScope(node);
2064
+
2065
+ this.visitChildren(node);
2066
+
2067
+ this.close(node);
2068
+ }
2069
+
2070
+ MethodDefinition(node) {
2071
+ this.visitProperty(node);
2072
+ }
2073
+
2074
+ BreakStatement() {} // eslint-disable-line class-methods-use-this -- Desired as instance method
2075
+
2076
+ ContinueStatement() {} // eslint-disable-line class-methods-use-this -- Desired as instance method
2077
+
2078
+ LabeledStatement(node) {
2079
+ this.visit(node.body);
2080
+ }
2081
+
2082
+ ForStatement(node) {
2083
+
2084
+ // Create ForStatement declaration.
2085
+ // NOTE: In ES6, ForStatement dynamically generates
2086
+ // per iteration environment. However, escope is
2087
+ // a static analyzer, we only generate one scope for ForStatement.
2088
+ if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") {
2089
+ this.scopeManager.__nestForScope(node);
2090
+ }
2091
+
2092
+ this.visitChildren(node);
2093
+
2094
+ this.close(node);
2095
+ }
2096
+
2097
+ ClassExpression(node) {
2098
+ this.visitClass(node);
2099
+ }
2100
+
2101
+ ClassDeclaration(node) {
2102
+ this.visitClass(node);
2103
+ }
2104
+
2105
+ CallExpression(node) {
2106
+
2107
+ // Check this is direct call to eval
2108
+ if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") {
2109
+
2110
+ // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
2111
+ // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
2112
+ this.currentScope().variableScope.__detectEval();
2113
+ }
2114
+ this.visitChildren(node);
2115
+ }
2116
+
2117
+ BlockStatement(node) {
2118
+ if (this.scopeManager.__isES6()) {
2119
+ this.scopeManager.__nestBlockScope(node);
2120
+ }
2121
+
2122
+ this.visitChildren(node);
2123
+
2124
+ this.close(node);
2125
+ }
2126
+
2127
+ ThisExpression() {
2128
+ this.currentScope().variableScope.__detectThis();
2129
+ }
2130
+
2131
+ WithStatement(node) {
2132
+ this.visit(node.object);
2133
+
2134
+ // Then nest scope for WithStatement.
2135
+ this.scopeManager.__nestWithScope(node);
2136
+
2137
+ this.visit(node.body);
2138
+
2139
+ this.close(node);
2140
+ }
2141
+
2142
+ VariableDeclaration(node) {
2143
+ const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope();
2144
+
2145
+ for (let i = 0, iz = node.declarations.length; i < iz; ++i) {
2146
+ const decl = node.declarations[i];
2147
+
2148
+ this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i);
2149
+ if (decl.init) {
2150
+ this.visit(decl.init);
2151
+ }
2152
+ }
2153
+ }
2154
+
2155
+ // sec 13.11.8
2156
+ SwitchStatement(node) {
2157
+ this.visit(node.discriminant);
2158
+
2159
+ if (this.scopeManager.__isES6()) {
2160
+ this.scopeManager.__nestSwitchScope(node);
2161
+ }
2162
+
2163
+ for (let i = 0, iz = node.cases.length; i < iz; ++i) {
2164
+ this.visit(node.cases[i]);
2165
+ }
2166
+
2167
+ this.close(node);
2168
+ }
2169
+
2170
+ FunctionDeclaration(node) {
2171
+ this.visitFunction(node);
2172
+ }
2173
+
2174
+ FunctionExpression(node) {
2175
+ this.visitFunction(node);
2176
+ }
2177
+
2178
+ ForOfStatement(node) {
2179
+ this.visitForIn(node);
2180
+ }
2181
+
2182
+ ForInStatement(node) {
2183
+ this.visitForIn(node);
2184
+ }
2185
+
2186
+ ArrowFunctionExpression(node) {
2187
+ this.visitFunction(node);
2188
+ }
2189
+
2190
+ ImportDeclaration(node) {
2191
+ assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
2192
+
2193
+ const importer = new Importer(node, this);
2194
+
2195
+ importer.visit(node);
2196
+ }
2197
+
2198
+ visitExportDeclaration(node) {
2199
+ if (node.source) {
2200
+ return;
2201
+ }
2202
+ if (node.declaration) {
2203
+ this.visit(node.declaration);
2204
+ return;
2205
+ }
2206
+
2207
+ this.visitChildren(node);
2208
+ }
2209
+
2210
+ // TODO: ExportDeclaration doesn't exist. for bc?
2211
+ ExportDeclaration(node) {
2212
+ this.visitExportDeclaration(node);
2213
+ }
2214
+
2215
+ ExportAllDeclaration(node) {
2216
+ this.visitExportDeclaration(node);
2217
+ }
2218
+
2219
+ ExportDefaultDeclaration(node) {
2220
+ this.visitExportDeclaration(node);
2221
+ }
2222
+
2223
+ ExportNamedDeclaration(node) {
2224
+ this.visitExportDeclaration(node);
2225
+ }
2226
+
2227
+ ExportSpecifier(node) {
2228
+
2229
+ // TODO: `node.id` doesn't exist. for bc?
2230
+ const local = (node.id || node.local);
2231
+
2232
+ this.visit(local);
2233
+ }
2234
+
2235
+ MetaProperty() { // eslint-disable-line class-methods-use-this -- Desired as instance method
2236
+
2237
+ // do nothing.
2238
+ }
2239
+
2240
+ JSXIdentifier(node) {
2241
+
2242
+ // Special case: "this" should not count as a reference
2243
+ if (this.scopeManager.__isJSXEnabled() && node.name !== "this") {
2244
+ this.currentScope().__referencing(node);
2245
+ }
2246
+ }
2247
+
2248
+ JSXMemberExpression(node) {
2249
+ this.visit(node.object);
2250
+ }
2251
+
2252
+ JSXElement(node) {
2253
+ if (this.scopeManager.__isJSXEnabled()) {
2254
+ this.visit(node.openingElement);
2255
+ node.children.forEach(this.visit, this);
2256
+ } else {
2257
+ this.visitChildren(node);
2258
+ }
2259
+ }
2260
+
2261
+ JSXOpeningElement(node) {
2262
+ if (this.scopeManager.__isJSXEnabled()) {
2263
+
2264
+ const nameNode = node.name;
2265
+ const isComponentName = nameNode.type === "JSXIdentifier" && nameNode.name[0].toUpperCase() === nameNode.name[0];
2266
+ const isComponent = isComponentName || nameNode.type === "JSXMemberExpression";
2267
+
2268
+ // we only want to visit JSXIdentifier nodes if they are capitalized
2269
+ if (isComponent) {
2270
+ this.visit(nameNode);
2271
+ }
2272
+ }
2273
+
2274
+ node.attributes.forEach(this.visit, this);
2275
+ }
2276
+
2277
+ JSXAttribute(node) {
2278
+ if (node.value) {
2279
+ this.visit(node.value);
2280
+ }
2281
+ }
2282
+
2283
+ JSXExpressionContainer(node) {
2284
+ this.visit(node.expression);
2285
+ }
2286
+
2287
+ JSXNamespacedName(node) {
2288
+ this.visit(node.namespace);
2289
+ this.visit(node.name);
2290
+ }
2291
+ }
2292
+
2293
+ /* vim: set sw=4 ts=4 et tw=80 : */
2294
+
2295
+ /*
2296
+ Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
2297
+ Copyright (C) 2013 Alex Seville <hi@alexanderseville.com>
2298
+ Copyright (C) 2014 Thiago de Arruda <tpadilha84@gmail.com>
2299
+
2300
+ Redistribution and use in source and binary forms, with or without
2301
+ modification, are permitted provided that the following conditions are met:
2302
+
2303
+ * Redistributions of source code must retain the above copyright
2304
+ notice, this list of conditions and the following disclaimer.
2305
+ * Redistributions in binary form must reproduce the above copyright
2306
+ notice, this list of conditions and the following disclaimer in the
2307
+ documentation and/or other materials provided with the distribution.
2308
+
2309
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2310
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2311
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2312
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
2313
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2314
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2315
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2316
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2317
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2318
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2319
+ */
2320
+
2321
+ /** @import ESTree from "estree" */
2322
+
2323
+ /**
2324
+ * Set the default options
2325
+ * @returns {Object} options
2326
+ */
2327
+ function defaultOptions() {
2328
+ return {
2329
+ optimistic: false,
2330
+ nodejsScope: false,
2331
+ impliedStrict: false,
2332
+ sourceType: "script", // one of ['script', 'module', 'commonjs']
2333
+ ecmaVersion: 5,
2334
+ childVisitorKeys: null,
2335
+ fallback: "iteration"
2336
+ };
2337
+ }
2338
+
2339
+ /**
2340
+ * Preform deep update on option object
2341
+ * @param {Record<string, unknown>} target Options
2342
+ * @param {Record<string, unknown>} override Updates
2343
+ * @returns {Record<string, unknown>} Updated options
2344
+ */
2345
+ function updateDeeply(target, override) {
2346
+
2347
+ /**
2348
+ * Is hash object
2349
+ * @param {Object} value Test value
2350
+ * @returns {value is Record<string, unknown>} Result
2351
+ */
2352
+ function isHashObject(value) {
2353
+ return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp);
2354
+ }
2355
+
2356
+ for (const key in override) {
2357
+ if (Object.hasOwn(override, key)) {
2358
+ const val = override[key];
2359
+
2360
+ if (isHashObject(val)) {
2361
+ if (isHashObject(target[key])) {
2362
+ updateDeeply(target[key], val);
2363
+ } else {
2364
+ target[key] = updateDeeply({}, val);
2365
+ }
2366
+ } else {
2367
+ target[key] = val;
2368
+ }
2369
+ }
2370
+ }
2371
+ return target;
2372
+ }
2373
+
2374
+ /**
2375
+ * Main interface function. Takes an Espree syntax tree and returns the
2376
+ * analyzed scopes.
2377
+ * @function analyze
2378
+ * @param {ESTree.Program} tree Abstract Syntax Tree
2379
+ * @param {Object} providedOptions Options that tailor the scope analysis
2380
+ * @param {boolean} [providedOptions.optimistic=false] the optimistic flag
2381
+ * @param {boolean} [providedOptions.ignoreEval=false] whether to check 'eval()' calls
2382
+ * @param {boolean} [providedOptions.nodejsScope=false] whether the whole
2383
+ * script is executed under node.js environment. When enabled, escope adds
2384
+ * a function scope immediately following the global scope.
2385
+ * @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
2386
+ * (if ecmaVersion >= 5).
2387
+ * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
2388
+ * @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
2389
+ * @param {boolean} [providedOptions.jsx=false] support JSX references
2390
+ * @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
2391
+ * @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
2392
+ * @returns {ScopeManager} ScopeManager
2393
+ */
2394
+ function analyze(tree, providedOptions) {
2395
+ const options = updateDeeply(defaultOptions(), providedOptions);
2396
+ const scopeManager = new ScopeManager(options);
2397
+ const referencer = new Referencer(options, scopeManager);
2398
+
2399
+ referencer.visit(tree);
2400
+
2401
+ assert(scopeManager.__currentScope === null, "currentScope should be null.");
2402
+
2403
+ return scopeManager;
2404
+ }
2405
+
2406
+ /** @name module:escope.version */
2407
+ const version = "9.1.0"; // x-release-please-version
2408
+
2409
+ /* vim: set sw=4 ts=4 et tw=80 : */
2410
+
2411
+ exports.Definition = Definition;
2412
+ exports.PatternVisitor = PatternVisitor;
2413
+ exports.Reference = Reference;
2414
+ exports.Referencer = Referencer;
2415
+ exports.Scope = Scope;
2416
+ exports.ScopeManager = ScopeManager;
2417
+ exports.Variable = Variable;
2418
+ exports.analyze = analyze;
2419
+ exports.version = version;
2420
+ //# sourceMappingURL=eslint-scope.cjs.map