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