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