eslint-plugin-wyrm 0.0.10 → 0.0.13

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 (234) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +114 -58
  3. package/bin/wyrm.mjs +3 -0
  4. package/dist/_virtual/_rolldown/runtime.mjs +14 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.mjs +23 -0
  7. package/dist/configs/index.d.mts +2 -1
  8. package/dist/configs/index.mjs +6 -6
  9. package/dist/index.mjs +1 -4
  10. package/dist/plugin.mjs +1 -3
  11. package/dist/rules/array-from-array.d.mts +9 -0
  12. package/dist/rules/array-from-array.mjs +56 -0
  13. package/dist/rules/as-unknown-as.d.mts +9 -0
  14. package/dist/rules/as-unknown-as.mjs +30 -0
  15. package/dist/rules/await-promise-resolve.d.mts +9 -0
  16. package/dist/rules/await-promise-resolve.mjs +41 -0
  17. package/dist/rules/boolean-coalescing.d.mts +9 -0
  18. package/dist/rules/boolean-coalescing.mjs +141 -0
  19. package/dist/rules/comment-duplicate-leading-space.d.mts +9 -0
  20. package/dist/rules/comment-duplicate-leading-space.mjs +34 -0
  21. package/dist/rules/conditional-boolean.d.mts +9 -0
  22. package/dist/rules/conditional-boolean.mjs +70 -0
  23. package/dist/rules/constant-boolean-cast.d.mts +9 -0
  24. package/dist/rules/constant-boolean-cast.mjs +203 -0
  25. package/dist/rules/de-morgan.d.mts +2 -2
  26. package/dist/rules/de-morgan.mjs +1 -3
  27. package/dist/rules/discarded-expression-statement.d.mts +14 -0
  28. package/dist/rules/discarded-expression-statement.mjs +243 -0
  29. package/dist/rules/distribute-boolean-casts.d.mts +2 -2
  30. package/dist/rules/distribute-boolean-casts.mjs +3 -3
  31. package/dist/rules/duplicate-destructuring.d.mts +2 -2
  32. package/dist/rules/duplicate-destructuring.mjs +1 -3
  33. package/dist/rules/duplicate-object-spread.d.mts +9 -0
  34. package/dist/rules/duplicate-object-spread.mjs +44 -0
  35. package/dist/rules/e.d.mts +11 -0
  36. package/dist/rules/e.mjs +87 -0
  37. package/dist/rules/empty-for.d.mts +9 -0
  38. package/dist/rules/empty-for.mjs +34 -0
  39. package/dist/rules/enum-member.d.mts +9 -0
  40. package/dist/rules/enum-member.mjs +51 -0
  41. package/dist/rules/eqeq-null.d.mts +9 -0
  42. package/dist/rules/eqeq-null.mjs +101 -0
  43. package/dist/rules/exact-string-regex.d.mts +9 -0
  44. package/dist/rules/exact-string-regex.mjs +83 -0
  45. package/dist/rules/export-using.d.mts +9 -0
  46. package/dist/rules/export-using.mjs +58 -0
  47. package/dist/rules/generic-constructor-with-hook.d.mts +11 -0
  48. package/dist/rules/generic-constructor-with-hook.mjs +103 -0
  49. package/dist/rules/idiomatic-cast.mjs +7 -10
  50. package/dist/rules/index.d.mts +112 -57
  51. package/dist/rules/index.mjs +113 -5
  52. package/dist/rules/inferable-type-predicate.d.mts +9 -0
  53. package/dist/rules/inferable-type-predicate.mjs +100 -0
  54. package/dist/rules/inner-as-const.d.mts +9 -0
  55. package/dist/rules/inner-as-const.mjs +70 -0
  56. package/dist/rules/jsx-tostring.d.mts +9 -0
  57. package/dist/rules/jsx-tostring.mjs +120 -0
  58. package/dist/rules/literal-destructuring.d.mts +9 -0
  59. package/dist/rules/literal-destructuring.mjs +102 -0
  60. package/dist/rules/named-export-with-side-effects.d.mts +11 -0
  61. package/dist/rules/named-export-with-side-effects.mjs +72 -0
  62. package/dist/rules/nested-reduce.d.mts +9 -0
  63. package/dist/rules/nested-reduce.mjs +46 -0
  64. package/dist/rules/nested-try-catch.d.mts +9 -0
  65. package/dist/rules/nested-try-catch.mjs +37 -0
  66. package/dist/rules/no-commented-out-comment.d.mts +9 -0
  67. package/dist/rules/no-commented-out-comment.mjs +31 -0
  68. package/dist/rules/no-constant-template-expression.d.mts +3 -4
  69. package/dist/rules/no-constant-template-expression.mjs +12 -9
  70. package/dist/rules/no-constructed-error-cause.d.mts +9 -0
  71. package/dist/rules/no-constructed-error-cause.mjs +75 -0
  72. package/dist/rules/no-convoluted-boolean-expressions.d.mts +9 -0
  73. package/dist/rules/no-convoluted-boolean-expressions.mjs +130 -0
  74. package/dist/rules/no-convoluted-logical-expressions.d.mts +2 -2
  75. package/dist/rules/no-convoluted-logical-expressions.mjs +1 -3
  76. package/dist/rules/no-custom-url-parsing.d.mts +2 -3
  77. package/dist/rules/no-custom-url-parsing.mjs +1 -3
  78. package/dist/rules/no-disallowed-warning-comments.d.mts +2 -2
  79. package/dist/rules/no-disallowed-warning-comments.mjs +1 -3
  80. package/dist/rules/no-duplicated-return.d.mts +2 -2
  81. package/dist/rules/no-duplicated-return.mjs +2 -3
  82. package/dist/rules/no-else-break.d.mts +2 -2
  83. package/dist/rules/no-else-break.mjs +3 -5
  84. package/dist/rules/no-else-continue.d.mts +2 -2
  85. package/dist/rules/no-else-continue.mjs +3 -5
  86. package/dist/rules/no-else-never.d.mts +9 -0
  87. package/dist/rules/no-else-never.mjs +75 -0
  88. package/dist/rules/no-else-return.d.mts +2 -3
  89. package/dist/rules/no-else-return.mjs +4 -5
  90. package/dist/rules/no-else-throw.d.mts +2 -2
  91. package/dist/rules/no-else-throw.mjs +3 -5
  92. package/dist/rules/no-empty-attribute.d.mts +3 -3
  93. package/dist/rules/no-empty-attribute.mjs +1 -3
  94. package/dist/rules/no-empty-comment.d.mts +3 -3
  95. package/dist/rules/no-empty-comment.mjs +1 -3
  96. package/dist/rules/no-empty-jsx-expression.d.mts +2 -2
  97. package/dist/rules/no-empty-jsx-expression.mjs +1 -3
  98. package/dist/rules/no-empty-literal-iteration.d.mts +2 -2
  99. package/dist/rules/no-empty-literal-iteration.mjs +1 -3
  100. package/dist/rules/no-extra-false-fallback.d.mts +2 -3
  101. package/dist/rules/no-extra-false-fallback.mjs +1 -3
  102. package/dist/rules/no-extra-nested-boolean-cast.d.mts +2 -3
  103. package/dist/rules/no-extra-nested-boolean-cast.mjs +2 -3
  104. package/dist/rules/no-first-last.d.mts +2 -2
  105. package/dist/rules/no-first-last.mjs +2 -5
  106. package/dist/rules/no-float-length-check.d.mts +2 -2
  107. package/dist/rules/no-float-length-check.mjs +1 -3
  108. package/dist/rules/no-huge-try-block.d.mts +3 -3
  109. package/dist/rules/no-huge-try-block.mjs +1 -3
  110. package/dist/rules/no-huge-useeffect.d.mts +11 -0
  111. package/dist/rules/no-huge-useeffect.mjs +52 -0
  112. package/dist/rules/no-if-length-for.d.mts +9 -0
  113. package/dist/rules/no-if-length-for.mjs +91 -0
  114. package/dist/rules/no-inline-jsdoc-tag.d.mts +3 -3
  115. package/dist/rules/no-inline-jsdoc-tag.mjs +1 -3
  116. package/dist/rules/no-invalid-date-literal.d.mts +2 -2
  117. package/dist/rules/no-invalid-date-literal.mjs +42 -19
  118. package/dist/rules/no-jsx-statement.d.mts +2 -2
  119. package/dist/rules/no-jsx-statement.mjs +1 -3
  120. package/dist/rules/no-lax-array-type.d.mts +9 -0
  121. package/dist/rules/no-lax-array-type.mjs +129 -0
  122. package/dist/rules/no-lax-return-type.d.mts +9 -0
  123. package/dist/rules/no-lax-return-type.mjs +138 -0
  124. package/dist/rules/no-mutable-literal-fill.d.mts +2 -3
  125. package/dist/rules/no-mutable-literal-fill.mjs +1 -3
  126. package/dist/rules/no-nullish-ternary.d.mts +9 -0
  127. package/dist/rules/no-nullish-ternary.mjs +121 -0
  128. package/dist/rules/no-numbered-comments.d.mts +2 -2
  129. package/dist/rules/no-numbered-comments.mjs +1 -3
  130. package/dist/rules/no-obvious-any.mjs +35 -27
  131. package/dist/rules/no-optional-type-guard-param.d.mts +2 -3
  132. package/dist/rules/no-optional-type-guard-param.mjs +1 -3
  133. package/dist/rules/no-out-of-order-comments.d.mts +2 -2
  134. package/dist/rules/no-out-of-order-comments.mjs +4 -8
  135. package/dist/rules/no-possibly-nullish-equality.d.mts +0 -1
  136. package/dist/rules/no-possibly-nullish-equality.mjs +6 -13
  137. package/dist/rules/no-redundant-function-declaration.d.mts +2 -2
  138. package/dist/rules/no-redundant-function-declaration.mjs +1 -3
  139. package/dist/rules/no-return-to-void.mjs +2 -4
  140. package/dist/rules/no-self-object-assign.d.mts +2 -2
  141. package/dist/rules/no-self-object-assign.mjs +1 -3
  142. package/dist/rules/no-sloppy-length-check.d.mts +2 -3
  143. package/dist/rules/no-sloppy-length-check.mjs +35 -37
  144. package/dist/rules/no-suspicious-jsx-semicolon.d.mts +2 -3
  145. package/dist/rules/no-suspicious-jsx-semicolon.mjs +2 -4
  146. package/dist/rules/no-ternary-return.d.mts +3 -4
  147. package/dist/rules/no-ternary-return.mjs +1 -3
  148. package/dist/rules/no-type-guard.d.mts +9 -0
  149. package/dist/rules/no-type-guard.mjs +36 -0
  150. package/dist/rules/no-unassigned-todo.d.mts +2 -2
  151. package/dist/rules/no-unassigned-todo.mjs +1 -3
  152. package/dist/rules/no-unbound-catch-error.d.mts +2 -2
  153. package/dist/rules/no-unbound-catch-error.mjs +1 -3
  154. package/dist/rules/no-unused-mutually-referential.d.mts +9 -0
  155. package/dist/rules/no-unused-mutually-referential.mjs +215 -0
  156. package/dist/rules/no-unused-param-read.d.mts +2 -2
  157. package/dist/rules/no-unused-param-read.mjs +1 -3
  158. package/dist/rules/no-useless-computed-key.d.mts +2 -2
  159. package/dist/rules/no-useless-computed-key.mjs +1 -3
  160. package/dist/rules/no-useless-iife.d.mts +2 -2
  161. package/dist/rules/no-useless-iife.mjs +2 -3
  162. package/dist/rules/no-useless-logical-fallback.d.mts +0 -1
  163. package/dist/rules/no-useless-logical-fallback.mjs +32 -24
  164. package/dist/rules/no-useless-return-undefined.mjs +11 -11
  165. package/dist/rules/no-useless-ts-check.d.mts +9 -0
  166. package/dist/rules/no-useless-ts-check.mjs +34 -0
  167. package/dist/rules/no-useless-use-strict.d.mts +2 -2
  168. package/dist/rules/no-useless-use-strict.mjs +1 -3
  169. package/dist/rules/no-useless-usememo.d.mts +2 -2
  170. package/dist/rules/no-useless-usememo.mjs +8 -6
  171. package/dist/rules/no-whitespace-property.d.mts +2 -2
  172. package/dist/rules/no-whitespace-property.mjs +1 -3
  173. package/dist/rules/nullish-object-spread.d.mts +9 -0
  174. package/dist/rules/nullish-object-spread.mjs +38 -0
  175. package/dist/rules/optional-call-expression.d.mts +2 -2
  176. package/dist/rules/optional-call-expression.mjs +20 -3
  177. package/dist/rules/prefer-array-from.d.mts +9 -0
  178. package/dist/rules/prefer-array-from.mjs +87 -0
  179. package/dist/rules/prefer-catch-method.d.mts +2 -2
  180. package/dist/rules/prefer-catch-method.mjs +9 -12
  181. package/dist/rules/prefer-early-return.d.mts +2 -2
  182. package/dist/rules/prefer-early-return.mjs +23 -20
  183. package/dist/rules/prefer-eqeq-null.d.mts +9 -0
  184. package/dist/rules/prefer-eqeq-null.mjs +122 -0
  185. package/dist/rules/prefer-finally.d.mts +9 -0
  186. package/dist/rules/prefer-finally.mjs +129 -0
  187. package/dist/rules/prefer-getorinsert.d.mts +9 -0
  188. package/dist/rules/prefer-getorinsert.mjs +180 -0
  189. package/dist/rules/prefer-has.d.mts +9 -0
  190. package/dist/rules/prefer-has.mjs +69 -0
  191. package/dist/rules/prefer-in.d.mts +9 -0
  192. package/dist/rules/prefer-in.mjs +81 -0
  193. package/dist/rules/prefer-object-keys-values.d.mts +9 -0
  194. package/dist/rules/prefer-object-keys-values.mjs +78 -0
  195. package/dist/rules/prefer-repeat.d.mts +2 -2
  196. package/dist/rules/prefer-repeat.mjs +1 -5
  197. package/dist/rules/prefer-satisfies.d.mts +9 -0
  198. package/dist/rules/prefer-satisfies.mjs +86 -0
  199. package/dist/rules/prefer-string-join.d.mts +9 -0
  200. package/dist/rules/prefer-string-join.mjs +67 -0
  201. package/dist/rules/primitive-valueof.mjs +6 -8
  202. package/dist/rules/slim-try.d.mts +9 -0
  203. package/dist/rules/slim-try.mjs +150 -0
  204. package/dist/rules/styled-button-has-type.d.mts +9 -0
  205. package/dist/rules/styled-button-has-type.mjs +82 -0
  206. package/dist/rules/styled-transient-props.d.mts +9 -0
  207. package/dist/rules/styled-transient-props.mjs +52 -0
  208. package/dist/rules/suspicious-map-length.d.mts +2 -2
  209. package/dist/rules/suspicious-map-length.mjs +1 -3
  210. package/dist/rules/template-tostring.d.mts +9 -0
  211. package/dist/rules/template-tostring.mjs +48 -0
  212. package/dist/rules/unsafe-asserted-chain.d.mts +0 -1
  213. package/dist/rules/unsafe-asserted-chain.mjs +5 -8
  214. package/dist/rules/unused-object-assign.d.mts +2 -2
  215. package/dist/rules/unused-object-assign.mjs +1 -3
  216. package/dist/rules/unused-object-freeze.d.mts +9 -0
  217. package/dist/rules/unused-object-freeze.mjs +37 -0
  218. package/dist/rules/useless-as-const.d.mts +9 -0
  219. package/dist/rules/useless-as-const.mjs +59 -0
  220. package/dist/rules/useless-assign.d.mts +11 -0
  221. package/dist/rules/useless-assign.mjs +69 -0
  222. package/dist/rules/useless-conditional-assign.d.mts +9 -0
  223. package/dist/rules/useless-conditional-assign.mjs +58 -0
  224. package/dist/rules/useless-intermediary-variable.mjs +18 -21
  225. package/dist/rules/useless-mock.d.mts +9 -0
  226. package/dist/rules/useless-mock.mjs +180 -0
  227. package/dist/rules/useless-required.d.mts +9 -0
  228. package/dist/rules/useless-required.mjs +257 -0
  229. package/dist/utils/compareTokens.mjs +1 -3
  230. package/dist/utils/createRule.mjs +1 -3
  231. package/dist/utils/negateExpression.mjs +1 -3
  232. package/dist/utils/option.mjs +5 -2
  233. package/package.json +30 -23
  234. package/dist/_virtual/rolldown_runtime.mjs +0 -20
@@ -1,15 +1,42 @@
1
- import { __exportAll } from "../_virtual/rolldown_runtime.mjs";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
+ import array_from_array_default from "./array-from-array.mjs";
3
+ import as_unknown_as_default from "./as-unknown-as.mjs";
4
+ import await_promise_resolve_default from "./await-promise-resolve.mjs";
5
+ import boolean_coalescing_default from "./boolean-coalescing.mjs";
6
+ import comment_duplicate_leading_space_default from "./comment-duplicate-leading-space.mjs";
7
+ import conditional_boolean_default from "./conditional-boolean.mjs";
8
+ import constant_boolean_cast_default from "./constant-boolean-cast.mjs";
2
9
  import de_morgan_default from "./de-morgan.mjs";
10
+ import discarded_expression_statement_default from "./discarded-expression-statement.mjs";
3
11
  import distribute_boolean_casts_default from "./distribute-boolean-casts.mjs";
4
12
  import duplicate_destructuring_default from "./duplicate-destructuring.mjs";
13
+ import duplicate_object_spread_default from "./duplicate-object-spread.mjs";
14
+ import e_default from "./e.mjs";
15
+ import empty_for_default from "./empty-for.mjs";
16
+ import enum_member_default from "./enum-member.mjs";
17
+ import eqeq_null_default from "./eqeq-null.mjs";
18
+ import exact_string_regex_default from "./exact-string-regex.mjs";
19
+ import export_using_default from "./export-using.mjs";
20
+ import generic_constructor_with_hook_default from "./generic-constructor-with-hook.mjs";
5
21
  import idiomatic_cast_default from "./idiomatic-cast.mjs";
22
+ import inferable_type_predicate_default from "./inferable-type-predicate.mjs";
23
+ import inner_as_const_default from "./inner-as-const.mjs";
24
+ import jsx_tostring_default from "./jsx-tostring.mjs";
25
+ import literal_destructuring_default from "./literal-destructuring.mjs";
26
+ import named_export_with_side_effects_default from "./named-export-with-side-effects.mjs";
27
+ import nested_reduce_default from "./nested-reduce.mjs";
28
+ import nested_try_catch_default from "./nested-try-catch.mjs";
29
+ import no_commented_out_comment_default from "./no-commented-out-comment.mjs";
6
30
  import no_constant_template_expression_default from "./no-constant-template-expression.mjs";
31
+ import no_constructed_error_cause_default from "./no-constructed-error-cause.mjs";
32
+ import no_convoluted_boolean_expressions_default from "./no-convoluted-boolean-expressions.mjs";
7
33
  import no_convoluted_logical_expressions_default from "./no-convoluted-logical-expressions.mjs";
8
34
  import no_custom_url_parsing_default from "./no-custom-url-parsing.mjs";
9
35
  import no_disallowed_warning_comments_default from "./no-disallowed-warning-comments.mjs";
10
36
  import no_duplicated_return_default from "./no-duplicated-return.mjs";
11
37
  import no_else_break_default from "./no-else-break.mjs";
12
38
  import no_else_continue_default from "./no-else-continue.mjs";
39
+ import no_else_never_default from "./no-else-never.mjs";
13
40
  import no_else_return_default from "./no-else-return.mjs";
14
41
  import no_else_throw_default from "./no-else-throw.mjs";
15
42
  import no_empty_attribute_default from "./no-empty-attribute.mjs";
@@ -21,10 +48,15 @@ import no_extra_nested_boolean_cast_default from "./no-extra-nested-boolean-cast
21
48
  import no_first_last_default from "./no-first-last.mjs";
22
49
  import no_float_length_check_default from "./no-float-length-check.mjs";
23
50
  import no_huge_try_block_default from "./no-huge-try-block.mjs";
51
+ import no_huge_useeffect_default from "./no-huge-useeffect.mjs";
52
+ import no_if_length_for_default from "./no-if-length-for.mjs";
24
53
  import no_inline_jsdoc_tag_default from "./no-inline-jsdoc-tag.mjs";
25
54
  import no_invalid_date_literal_default from "./no-invalid-date-literal.mjs";
26
55
  import no_jsx_statement_default from "./no-jsx-statement.mjs";
56
+ import no_lax_array_type_default from "./no-lax-array-type.mjs";
57
+ import no_lax_return_type_default from "./no-lax-return-type.mjs";
27
58
  import no_mutable_literal_fill_default from "./no-mutable-literal-fill.mjs";
59
+ import no_nullish_ternary_default from "./no-nullish-ternary.mjs";
28
60
  import no_numbered_comments_default from "./no-numbered-comments.mjs";
29
61
  import no_obvious_any_default from "./no-obvious-any.mjs";
30
62
  import no_optional_type_guard_param_default from "./no-optional-type-guard-param.mjs";
@@ -36,39 +68,88 @@ import no_self_object_assign_default from "./no-self-object-assign.mjs";
36
68
  import no_sloppy_length_check_default from "./no-sloppy-length-check.mjs";
37
69
  import no_suspicious_jsx_semicolon_default from "./no-suspicious-jsx-semicolon.mjs";
38
70
  import no_ternary_return_default from "./no-ternary-return.mjs";
71
+ import no_type_guard_default from "./no-type-guard.mjs";
39
72
  import no_unassigned_todo_default from "./no-unassigned-todo.mjs";
40
73
  import no_unbound_catch_error_default from "./no-unbound-catch-error.mjs";
74
+ import no_unused_mutually_referential_default from "./no-unused-mutually-referential.mjs";
41
75
  import no_unused_param_read_default from "./no-unused-param-read.mjs";
42
76
  import no_useless_computed_key_default from "./no-useless-computed-key.mjs";
43
77
  import no_useless_iife_default from "./no-useless-iife.mjs";
44
78
  import no_useless_logical_fallback_default from "./no-useless-logical-fallback.mjs";
45
79
  import no_useless_return_undefined_default from "./no-useless-return-undefined.mjs";
80
+ import no_useless_ts_check_default from "./no-useless-ts-check.mjs";
46
81
  import no_useless_use_strict_default from "./no-useless-use-strict.mjs";
47
82
  import no_useless_usememo_default from "./no-useless-usememo.mjs";
48
83
  import no_whitespace_property_default from "./no-whitespace-property.mjs";
84
+ import nullish_object_spread_default from "./nullish-object-spread.mjs";
49
85
  import optional_call_expression_default from "./optional-call-expression.mjs";
86
+ import prefer_array_from_default from "./prefer-array-from.mjs";
50
87
  import prefer_catch_method_default from "./prefer-catch-method.mjs";
51
88
  import prefer_early_return_default from "./prefer-early-return.mjs";
89
+ import prefer_eqeq_null_default from "./prefer-eqeq-null.mjs";
90
+ import prefer_finally_default from "./prefer-finally.mjs";
91
+ import prefer_getorinsert_default from "./prefer-getorinsert.mjs";
92
+ import prefer_has_default from "./prefer-has.mjs";
93
+ import prefer_in_default from "./prefer-in.mjs";
94
+ import prefer_object_keys_values_default from "./prefer-object-keys-values.mjs";
52
95
  import prefer_repeat_default from "./prefer-repeat.mjs";
96
+ import prefer_satisfies_default from "./prefer-satisfies.mjs";
97
+ import prefer_string_join_default from "./prefer-string-join.mjs";
53
98
  import primitive_valueof_default from "./primitive-valueof.mjs";
99
+ import slim_try_default from "./slim-try.mjs";
100
+ import styled_button_has_type_default from "./styled-button-has-type.mjs";
101
+ import styled_transient_props_default from "./styled-transient-props.mjs";
54
102
  import suspicious_map_length_default from "./suspicious-map-length.mjs";
103
+ import template_tostring_default from "./template-tostring.mjs";
55
104
  import unsafe_asserted_chain_default from "./unsafe-asserted-chain.mjs";
56
105
  import unused_object_assign_default from "./unused-object-assign.mjs";
106
+ import unused_object_freeze_default from "./unused-object-freeze.mjs";
107
+ import useless_as_const_default from "./useless-as-const.mjs";
108
+ import useless_assign_default from "./useless-assign.mjs";
109
+ import useless_conditional_assign_default from "./useless-conditional-assign.mjs";
57
110
  import useless_intermediary_variable_default from "./useless-intermediary-variable.mjs";
58
-
111
+ import useless_mock_default from "./useless-mock.mjs";
112
+ import useless_required_default from "./useless-required.mjs";
59
113
  //#region lib/rules/index.ts
60
114
  var rules_exports = /* @__PURE__ */ __exportAll({
115
+ "array-from-array": () => array_from_array_default,
116
+ "as-unknown-as": () => as_unknown_as_default,
117
+ "await-promise-resolve": () => await_promise_resolve_default,
118
+ "boolean-coalescing": () => boolean_coalescing_default,
119
+ "comment-duplicate-leading-space": () => comment_duplicate_leading_space_default,
120
+ "conditional-boolean": () => conditional_boolean_default,
121
+ "constant-boolean-cast": () => constant_boolean_cast_default,
61
122
  "de-morgan": () => de_morgan_default,
123
+ "discarded-expression-statement": () => discarded_expression_statement_default,
62
124
  "distribute-boolean-casts": () => distribute_boolean_casts_default,
63
125
  "duplicate-destructuring": () => duplicate_destructuring_default,
126
+ "duplicate-object-spread": () => duplicate_object_spread_default,
127
+ e: () => e_default,
128
+ "empty-for": () => empty_for_default,
129
+ "enum-member": () => enum_member_default,
130
+ "eqeq-null": () => eqeq_null_default,
131
+ "exact-string-regex": () => exact_string_regex_default,
132
+ "export-using": () => export_using_default,
133
+ "generic-constructor-with-hook": () => generic_constructor_with_hook_default,
64
134
  "idiomatic-cast": () => idiomatic_cast_default,
135
+ "inferable-type-predicate": () => inferable_type_predicate_default,
136
+ "inner-as-const": () => inner_as_const_default,
137
+ "jsx-tostring": () => jsx_tostring_default,
138
+ "literal-destructuring": () => literal_destructuring_default,
139
+ "named-export-with-side-effects": () => named_export_with_side_effects_default,
140
+ "nested-reduce": () => nested_reduce_default,
141
+ "nested-try-catch": () => nested_try_catch_default,
142
+ "no-commented-out-comment": () => no_commented_out_comment_default,
65
143
  "no-constant-template-expression": () => no_constant_template_expression_default,
144
+ "no-constructed-error-cause": () => no_constructed_error_cause_default,
145
+ "no-convoluted-boolean-expressions": () => no_convoluted_boolean_expressions_default,
66
146
  "no-convoluted-logical-expressions": () => no_convoluted_logical_expressions_default,
67
147
  "no-custom-url-parsing": () => no_custom_url_parsing_default,
68
148
  "no-disallowed-warning-comments": () => no_disallowed_warning_comments_default,
69
149
  "no-duplicated-return": () => no_duplicated_return_default,
70
150
  "no-else-break": () => no_else_break_default,
71
151
  "no-else-continue": () => no_else_continue_default,
152
+ "no-else-never": () => no_else_never_default,
72
153
  "no-else-return": () => no_else_return_default,
73
154
  "no-else-throw": () => no_else_throw_default,
74
155
  "no-empty-attribute": () => no_empty_attribute_default,
@@ -80,10 +161,15 @@ var rules_exports = /* @__PURE__ */ __exportAll({
80
161
  "no-first-last": () => no_first_last_default,
81
162
  "no-float-length-check": () => no_float_length_check_default,
82
163
  "no-huge-try-block": () => no_huge_try_block_default,
164
+ "no-huge-useeffect": () => no_huge_useeffect_default,
165
+ "no-if-length-for": () => no_if_length_for_default,
83
166
  "no-inline-jsdoc-tag": () => no_inline_jsdoc_tag_default,
84
167
  "no-invalid-date-literal": () => no_invalid_date_literal_default,
85
168
  "no-jsx-statement": () => no_jsx_statement_default,
169
+ "no-lax-array-type": () => no_lax_array_type_default,
170
+ "no-lax-return-type": () => no_lax_return_type_default,
86
171
  "no-mutable-literal-fill": () => no_mutable_literal_fill_default,
172
+ "no-nullish-ternary": () => no_nullish_ternary_default,
87
173
  "no-numbered-comments": () => no_numbered_comments_default,
88
174
  "no-obvious-any": () => no_obvious_any_default,
89
175
  "no-optional-type-guard-param": () => no_optional_type_guard_param_default,
@@ -95,26 +181,48 @@ var rules_exports = /* @__PURE__ */ __exportAll({
95
181
  "no-sloppy-length-check": () => no_sloppy_length_check_default,
96
182
  "no-suspicious-jsx-semicolon": () => no_suspicious_jsx_semicolon_default,
97
183
  "no-ternary-return": () => no_ternary_return_default,
184
+ "no-type-guard": () => no_type_guard_default,
98
185
  "no-unassigned-todo": () => no_unassigned_todo_default,
99
186
  "no-unbound-catch-error": () => no_unbound_catch_error_default,
187
+ "no-unused-mutually-referential": () => no_unused_mutually_referential_default,
100
188
  "no-unused-param-read": () => no_unused_param_read_default,
101
189
  "no-useless-computed-key": () => no_useless_computed_key_default,
102
190
  "no-useless-iife": () => no_useless_iife_default,
103
191
  "no-useless-logical-fallback": () => no_useless_logical_fallback_default,
104
192
  "no-useless-return-undefined": () => no_useless_return_undefined_default,
193
+ "no-useless-ts-check": () => no_useless_ts_check_default,
105
194
  "no-useless-use-strict": () => no_useless_use_strict_default,
106
195
  "no-useless-usememo": () => no_useless_usememo_default,
107
196
  "no-whitespace-property": () => no_whitespace_property_default,
197
+ "nullish-object-spread": () => nullish_object_spread_default,
108
198
  "optional-call-expression": () => optional_call_expression_default,
199
+ "prefer-array-from": () => prefer_array_from_default,
109
200
  "prefer-catch-method": () => prefer_catch_method_default,
110
201
  "prefer-early-return": () => prefer_early_return_default,
202
+ "prefer-eqeq-null": () => prefer_eqeq_null_default,
203
+ "prefer-finally": () => prefer_finally_default,
204
+ "prefer-getorinsert": () => prefer_getorinsert_default,
205
+ "prefer-has": () => prefer_has_default,
206
+ "prefer-in": () => prefer_in_default,
207
+ "prefer-object-keys-values": () => prefer_object_keys_values_default,
111
208
  "prefer-repeat": () => prefer_repeat_default,
209
+ "prefer-satisfies": () => prefer_satisfies_default,
210
+ "prefer-string-join": () => prefer_string_join_default,
112
211
  "primitive-valueof": () => primitive_valueof_default,
212
+ "slim-try": () => slim_try_default,
213
+ "styled-button-has-type": () => styled_button_has_type_default,
214
+ "styled-transient-props": () => styled_transient_props_default,
113
215
  "suspicious-map-length": () => suspicious_map_length_default,
216
+ "template-tostring": () => template_tostring_default,
114
217
  "unsafe-asserted-chain": () => unsafe_asserted_chain_default,
115
218
  "unused-object-assign": () => unused_object_assign_default,
116
- "useless-intermediary-variable": () => useless_intermediary_variable_default
219
+ "unused-object-freeze": () => unused_object_freeze_default,
220
+ "useless-as-const": () => useless_as_const_default,
221
+ "useless-assign": () => useless_assign_default,
222
+ "useless-conditional-assign": () => useless_conditional_assign_default,
223
+ "useless-intermediary-variable": () => useless_intermediary_variable_default,
224
+ "useless-mock": () => useless_mock_default,
225
+ "useless-required": () => useless_required_default
117
226
  });
118
-
119
227
  //#endregion
120
- export { rules_exports };
228
+ export { rules_exports };
@@ -0,0 +1,9 @@
1
+ import { WyrmPluginDocs } from "../utils/createRule.mjs";
2
+ import { ESLintUtils } from "@typescript-eslint/utils";
3
+
4
+ //#region lib/rules/inferable-type-predicate.d.ts
5
+ declare const _default: ESLintUtils.RuleModule<"noInferableTypePredicate", [], WyrmPluginDocs, ESLintUtils.RuleListener> & {
6
+ name: string;
7
+ };
8
+ //#endregion
9
+ export { _default };
@@ -0,0 +1,100 @@
1
+ import { createRule } from "../utils/createRule.mjs";
2
+ import { None, Option, Some } from "../utils/option.mjs";
3
+ import path from "node:path";
4
+ import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
5
+ //#region lib/rules/inferable-type-predicate.ts
6
+ const { name } = path.parse(import.meta.filename);
7
+ var inferable_type_predicate_default = createRule({
8
+ name,
9
+ meta: {
10
+ type: "suggestion",
11
+ docs: {
12
+ description: "Forbid inferable type predicates",
13
+ strict: true,
14
+ requiresTypeChecking: true
15
+ },
16
+ fixable: "code",
17
+ schema: [],
18
+ messages: { noInferableTypePredicate: "Since TypeScript 5.5, this type predicate can be automatically inferred. You should remove it." }
19
+ },
20
+ defaultOptions: [],
21
+ create(context) {
22
+ let services;
23
+ function getServices() {
24
+ services ??= ESLintUtils.getParserServices(context);
25
+ return services;
26
+ }
27
+ return {
28
+ FunctionDeclaration: checkFunction,
29
+ FunctionExpression: checkFunction,
30
+ ArrowFunctionExpression: checkFunction
31
+ };
32
+ function checkFunction(fn) {
33
+ const { returnType } = fn;
34
+ if (!returnType) return;
35
+ if (returnType.typeAnnotation.type !== AST_NODE_TYPES.TSTypePredicate) return;
36
+ const [param] = fn.params;
37
+ if (!param) return;
38
+ if (param.type !== AST_NODE_TYPES.Identifier) return;
39
+ const maybeReturnValue = getReturnValue(fn.body);
40
+ if (!maybeReturnValue.some) return;
41
+ const returnValue = maybeReturnValue.value;
42
+ if (!isInferableEquality(returnValue, param) && !isInferableInequality(returnValue, param)) return;
43
+ context.report({
44
+ node: fn,
45
+ messageId: "noInferableTypePredicate",
46
+ fix(fixer) {
47
+ return fixer.remove(returnType);
48
+ }
49
+ });
50
+ }
51
+ function isInferableInequality(expr, param) {
52
+ if (expr.type !== AST_NODE_TYPES.BinaryExpression) return false;
53
+ if (expr.operator !== "!==" && expr.operator !== "!=") return false;
54
+ if (!getServices().getTypeAtLocation(param).isUnion()) return false;
55
+ return isLiteralInequality(expr.left, expr.right, param) || isLiteralInequality(expr.right, expr.left, param);
56
+ }
57
+ }
58
+ });
59
+ function isInferableEquality(expr, param) {
60
+ if (expr.type !== AST_NODE_TYPES.BinaryExpression) return false;
61
+ if (expr.operator !== "===") return false;
62
+ return isTypeOfCheck(expr.left, expr.right, param) || isTypeOfCheck(expr.right, expr.left, param) || isLiteralEquality(expr.left, expr.right, param) || isLiteralEquality(expr.right, expr.left, param);
63
+ }
64
+ function isTypeOfCheck(left, right, ident) {
65
+ if (left.type !== AST_NODE_TYPES.UnaryExpression) return false;
66
+ if (left.operator !== "typeof") return false;
67
+ if (left.argument.type !== AST_NODE_TYPES.Identifier) return false;
68
+ if (left.argument.name !== ident.name) return false;
69
+ if (right.type !== AST_NODE_TYPES.Literal) return false;
70
+ if (typeof right.value !== "string") return false;
71
+ return true;
72
+ }
73
+ function isLiteralInequality(left, right, ident) {
74
+ if (left.type !== AST_NODE_TYPES.Identifier) return false;
75
+ if (left.name !== ident.name) return false;
76
+ switch (right.type) {
77
+ case AST_NODE_TYPES.Literal: return right.value === null;
78
+ case AST_NODE_TYPES.Identifier: return right.name === "undefined";
79
+ default: return false;
80
+ }
81
+ }
82
+ function isLiteralEquality(left, right, ident) {
83
+ if (left.type !== AST_NODE_TYPES.Identifier) return false;
84
+ if (left.name !== ident.name) return false;
85
+ switch (right.type) {
86
+ case AST_NODE_TYPES.Literal: return true;
87
+ case AST_NODE_TYPES.Identifier: return right.name === "undefined";
88
+ default: return false;
89
+ }
90
+ }
91
+ function getReturnValue(body) {
92
+ if (body.type !== AST_NODE_TYPES.BlockStatement) return Some(body);
93
+ if (body.body.length !== 1) return None;
94
+ const returnStatement = body.body.find((stmt) => stmt.type === AST_NODE_TYPES.ReturnStatement);
95
+ if (!returnStatement) return None;
96
+ if (!returnStatement.argument) return None;
97
+ return Option.fromUndef(returnStatement.argument);
98
+ }
99
+ //#endregion
100
+ export { inferable_type_predicate_default as default };
@@ -0,0 +1,9 @@
1
+ import { WyrmPluginDocs } from "../utils/createRule.mjs";
2
+ import * as _$_typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
3
+
4
+ //#region lib/rules/inner-as-const.d.ts
5
+ declare const _default: _$_typescript_eslint_utils_ts_eslint0.RuleModule<"noInnerAsConstObject" | "noInnerAsConstArray", [], WyrmPluginDocs, _$_typescript_eslint_utils_ts_eslint0.RuleListener> & {
6
+ name: string;
7
+ };
8
+ //#endregion
9
+ export { _default };
@@ -0,0 +1,70 @@
1
+ import { createRule } from "../utils/createRule.mjs";
2
+ import { None, Some } from "../utils/option.mjs";
3
+ import path from "node:path";
4
+ import { AST_NODE_TYPES } from "@typescript-eslint/utils";
5
+ //#region lib/rules/inner-as-const.ts
6
+ const { name } = path.parse(import.meta.filename);
7
+ var inner_as_const_default = createRule({
8
+ name,
9
+ meta: {
10
+ type: "suggestion",
11
+ docs: {
12
+ description: "Enforce setting `as const` on the outermost object/array literal only",
13
+ strict: true
14
+ },
15
+ fixable: "code",
16
+ schema: [],
17
+ messages: {
18
+ noInnerAsConstObject: "Only set `as const` on the outermost object",
19
+ noInnerAsConstArray: "Only set `as const` on the outermost array"
20
+ }
21
+ },
22
+ defaultOptions: [],
23
+ create(context) {
24
+ return {
25
+ ArrayExpression(node) {
26
+ for (const elt of node.elements) {
27
+ if (!elt) continue;
28
+ const maybeExpr = getAsConstExpr(elt);
29
+ if (!maybeExpr.some) continue;
30
+ const expr = maybeExpr.value;
31
+ context.report({
32
+ node: elt,
33
+ messageId: "noInnerAsConstArray",
34
+ *fix(fixer) {
35
+ yield fixer.replaceText(elt, context.sourceCode.getText(expr));
36
+ if (getAsConstExpr(node.parent).some) return;
37
+ yield fixer.insertTextAfter(node, " as const");
38
+ }
39
+ });
40
+ }
41
+ },
42
+ ObjectExpression(node) {
43
+ for (const prop of node.properties) {
44
+ if (prop.type === AST_NODE_TYPES.SpreadElement) continue;
45
+ const maybeExpr = getAsConstExpr(prop.value);
46
+ if (!maybeExpr.some) continue;
47
+ const expr = maybeExpr.value;
48
+ context.report({
49
+ node: prop,
50
+ messageId: "noInnerAsConstObject",
51
+ *fix(fixer) {
52
+ yield fixer.replaceText(prop.value, context.sourceCode.getText(expr));
53
+ if (getAsConstExpr(node.parent).some) return;
54
+ yield fixer.insertTextAfter(node, " as const");
55
+ }
56
+ });
57
+ }
58
+ }
59
+ };
60
+ }
61
+ });
62
+ function getAsConstExpr(node) {
63
+ if (node.type !== AST_NODE_TYPES.TSAsExpression) return None;
64
+ if (node.typeAnnotation.type !== AST_NODE_TYPES.TSTypeReference) return None;
65
+ if (node.typeAnnotation.typeName.type !== AST_NODE_TYPES.Identifier) return None;
66
+ if (node.typeAnnotation.typeName.name !== "const") return None;
67
+ return Some(node.expression);
68
+ }
69
+ //#endregion
70
+ export { inner_as_const_default as default };
@@ -0,0 +1,9 @@
1
+ import { WyrmPluginDocs } from "../utils/createRule.mjs";
2
+ import { ESLintUtils } from "@typescript-eslint/utils";
3
+
4
+ //#region lib/rules/jsx-tostring.d.ts
5
+ declare const _default: ESLintUtils.RuleModule<"noToString", [], WyrmPluginDocs, ESLintUtils.RuleListener> & {
6
+ name: string;
7
+ };
8
+ //#endregion
9
+ export { _default };
@@ -0,0 +1,120 @@
1
+ import { createRule } from "../utils/createRule.mjs";
2
+ import { None, Some, getFirstOption } from "../utils/option.mjs";
3
+ import path from "node:path";
4
+ import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
5
+ //#region lib/rules/jsx-tostring.ts
6
+ const { name } = path.parse(import.meta.filename);
7
+ var jsx_tostring_default = createRule({
8
+ name,
9
+ meta: {
10
+ type: "suggestion",
11
+ docs: {
12
+ description: "Forbid calling `.toString()` inside JSX expressions containers",
13
+ strict: true,
14
+ requiresTypeChecking: true
15
+ },
16
+ fixable: "code",
17
+ schema: [],
18
+ messages: { noToString: "Calling `.toString()` is unnecessary here" }
19
+ },
20
+ defaultOptions: [],
21
+ create(context) {
22
+ let services;
23
+ function getServices() {
24
+ services ??= ESLintUtils.getParserServices(context);
25
+ return services;
26
+ }
27
+ let checker;
28
+ function getChecker() {
29
+ checker ??= getServices().program.getTypeChecker();
30
+ return checker;
31
+ }
32
+ return { JSXExpressionContainer(node) {
33
+ checkJsxExpression(node);
34
+ } };
35
+ function checkJsxExpression(container) {
36
+ const { expression } = container;
37
+ if (expression.type === AST_NODE_TYPES.JSXEmptyExpression) return;
38
+ const maybeObj = getToString(expression);
39
+ if (!maybeObj.some) return;
40
+ const obj = maybeObj.value;
41
+ const objType = getServices().getTypeAtLocation(obj);
42
+ const { parent } = container;
43
+ if (parent.type === AST_NODE_TYPES.JSXFragment) {
44
+ context.report({
45
+ node: expression,
46
+ messageId: "noToString",
47
+ fix(fixer) {
48
+ const txt = context.sourceCode.getText(obj);
49
+ return fixer.replaceText(expression, txt);
50
+ }
51
+ });
52
+ return;
53
+ }
54
+ if (parent.type !== AST_NODE_TYPES.JSXElement) return;
55
+ const { openingElement } = parent;
56
+ if (openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(openingElement.name.name)) {
57
+ context.report({
58
+ node: expression,
59
+ messageId: "noToString",
60
+ fix(fixer) {
61
+ const txt = context.sourceCode.getText(obj);
62
+ return fixer.replaceText(expression, txt);
63
+ }
64
+ });
65
+ return;
66
+ }
67
+ const maybeChildrenType = getChildrenPropTypeFromComponentType(getServices().getTypeAtLocation(openingElement.name));
68
+ if (!maybeChildrenType.some) return;
69
+ const childrenType = maybeChildrenType.value;
70
+ if (!isAssignableTo(objType, childrenType)) return;
71
+ context.report({
72
+ node: expression,
73
+ messageId: "noToString",
74
+ fix(fixer) {
75
+ const txt = context.sourceCode.getText(obj);
76
+ return fixer.replaceText(expression, txt);
77
+ }
78
+ });
79
+ }
80
+ function getChildrenPropTypeFromComponentType(type) {
81
+ return getFirstOption([getChildrenTypeFromSignatures(type.getCallSignatures()), getChildrenTypeFromSignatures(type.getConstructSignatures())]);
82
+ }
83
+ function getChildrenTypeFromSignatures(signatures) {
84
+ for (const signature of signatures) {
85
+ const maybeChildrenType = getChildrenTypeFromSignature(signature);
86
+ if (!maybeChildrenType.some) continue;
87
+ return maybeChildrenType;
88
+ }
89
+ return None;
90
+ }
91
+ function getChildrenTypeFromSignature(signature) {
92
+ const [param] = signature.getParameters();
93
+ if (!param) return None;
94
+ const paramType = getValueTypeFromSymbol(param);
95
+ /* v8 ignore if -- @preserve */
96
+ if (!paramType) return None;
97
+ const childrenProp = paramType.getProperty("children");
98
+ if (!childrenProp) return None;
99
+ const childrenType = getValueTypeFromSymbol(childrenProp);
100
+ if (childrenType) return Some(childrenType);
101
+ return None;
102
+ }
103
+ function getValueTypeFromSymbol(symbol) {
104
+ if (!symbol.valueDeclaration) return null;
105
+ return getChecker().getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
106
+ }
107
+ function isAssignableTo(source, target) {
108
+ return getChecker().isTypeAssignableTo(source, getChecker().getWidenedType(target));
109
+ }
110
+ }
111
+ });
112
+ function getToString(expr) {
113
+ if (expr.type !== AST_NODE_TYPES.CallExpression) return None;
114
+ if (expr.callee.type !== AST_NODE_TYPES.MemberExpression) return None;
115
+ if (expr.callee.property.type !== AST_NODE_TYPES.Identifier) return None;
116
+ if (expr.callee.property.name !== "toString") return None;
117
+ return Some(expr.callee.object);
118
+ }
119
+ //#endregion
120
+ export { jsx_tostring_default as default };
@@ -0,0 +1,9 @@
1
+ import { WyrmPluginDocs } from "../utils/createRule.mjs";
2
+ import * as _$_typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
3
+
4
+ //#region lib/rules/literal-destructuring.d.ts
5
+ declare const _default: _$_typescript_eslint_utils_ts_eslint0.RuleModule<"uselessSpreadElement" | "uselessSpreadProperty" | "usePlainDeclaration", [], WyrmPluginDocs, _$_typescript_eslint_utils_ts_eslint0.RuleListener> & {
6
+ name: string;
7
+ };
8
+ //#endregion
9
+ export { _default };
@@ -0,0 +1,102 @@
1
+ import { createRule } from "../utils/createRule.mjs";
2
+ import path from "node:path";
3
+ import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
4
+ //#region lib/rules/literal-destructuring.ts
5
+ const { name } = path.parse(import.meta.filename);
6
+ var literal_destructuring_default = createRule({
7
+ name,
8
+ meta: {
9
+ type: "suggestion",
10
+ docs: {
11
+ description: "Forbid variable declaration by destructuring object or array literals",
12
+ strict: true
13
+ },
14
+ fixable: "code",
15
+ schema: [],
16
+ messages: {
17
+ uselessSpreadElement: "Remove this spread element from the array literal, it is most likely useless since its value is never read.",
18
+ uselessSpreadProperty: "Remove this spread property from the object literal, it is most likely useless since its value is never read.",
19
+ usePlainDeclaration: "Use a plain variable declaration instead of destructuring a literal"
20
+ }
21
+ },
22
+ defaultOptions: [],
23
+ create(context) {
24
+ return { VariableDeclarator(node) {
25
+ if (!node.init) return;
26
+ if (node.id.type === AST_NODE_TYPES.ArrayPattern && node.init.type === AST_NODE_TYPES.ArrayExpression) {
27
+ checkArrayDecl(node, node.id, node.init);
28
+ return;
29
+ }
30
+ if (node.id.type === AST_NODE_TYPES.ObjectPattern && node.init.type === AST_NODE_TYPES.ObjectExpression) checkObjectDecl(node, node.id, node.init);
31
+ } };
32
+ function checkArrayDecl(decl, id, init) {
33
+ const spreadElement = init.elements.find((elt) => elt?.type === AST_NODE_TYPES.SpreadElement);
34
+ if (spreadElement) {
35
+ const idx = init.elements.indexOf(spreadElement);
36
+ if (idx >= id.elements.length) context.report({
37
+ node: spreadElement,
38
+ messageId: "uselessSpreadElement",
39
+ *fix(fixer) {
40
+ yield fixer.remove(spreadElement);
41
+ const commaToken = context.sourceCode.getTokenAfter(spreadElement);
42
+ if (idx === 0 && commaToken?.type === AST_TOKEN_TYPES.Punctuator && commaToken.value === ",") yield fixer.remove(commaToken);
43
+ }
44
+ });
45
+ return;
46
+ }
47
+ if (!id.elements.every((elt) => elt?.type === AST_NODE_TYPES.Identifier)) return;
48
+ if (!init.elements.every((elt) => elt?.type !== AST_NODE_TYPES.SpreadElement)) return;
49
+ const entries = id.elements.map((ident, i) => [ident.name, init.elements.filter((elt) => elt?.type !== AST_NODE_TYPES.SpreadElement).at(i)]);
50
+ context.report({
51
+ node: decl,
52
+ messageId: "usePlainDeclaration",
53
+ fix(fixer) {
54
+ const txt = entries.map(([key, value]) => {
55
+ return `${key} = ${value ? context.sourceCode.getText(value) : "undefined"}`;
56
+ }).join(", ");
57
+ return fixer.replaceText(decl, txt);
58
+ }
59
+ });
60
+ }
61
+ function checkObjectDecl(decl, id, init) {
62
+ if (!id.properties.every((prop) => prop.type === AST_NODE_TYPES.Property)) return;
63
+ if (id.properties.some((prop) => prop.computed)) return;
64
+ const patternKeys = id.properties.map((prop) => prop.key);
65
+ if (!patternKeys.every((key) => key.type === AST_NODE_TYPES.Identifier)) return;
66
+ const patternNames = patternKeys.map((key) => key.name);
67
+ for (const initProp of init.properties) {
68
+ if (initProp.type === AST_NODE_TYPES.Property) {
69
+ if (initProp.computed) return;
70
+ continue;
71
+ }
72
+ const idx = init.properties.indexOf(initProp);
73
+ const subsequentPropertyNames = new Set(init.properties.slice(idx).filter((prop) => prop.type === AST_NODE_TYPES.Property).map((prop) => prop.key).filter((key) => key.type === AST_NODE_TYPES.Identifier).map((key) => key.name));
74
+ if (patternNames.every((patternName) => subsequentPropertyNames.has(patternName))) context.report({
75
+ node: initProp,
76
+ messageId: "uselessSpreadProperty",
77
+ *fix(fixer) {
78
+ yield fixer.remove(initProp);
79
+ const commaToken = context.sourceCode.getTokenAfter(initProp);
80
+ if (idx === 0 && commaToken?.type === AST_TOKEN_TYPES.Punctuator && commaToken.value === ",") yield fixer.remove(commaToken);
81
+ }
82
+ });
83
+ return;
84
+ }
85
+ const initMap = new Map(init.properties.filter((prop) => prop.type === AST_NODE_TYPES.Property).map((prop) => [prop.key, prop.value]).filter((entry) => entry[0].type === AST_NODE_TYPES.Identifier).map(([key, value]) => [key.name, value]));
86
+ const entries = patternNames.map((patternName) => [patternName, initMap.get(patternName)]);
87
+ if (!entries.every((entry) => entry[1] !== void 0)) return;
88
+ context.report({
89
+ node: decl,
90
+ messageId: "usePlainDeclaration",
91
+ fix(fixer) {
92
+ const txt = entries.map(([key, value]) => {
93
+ return `${key} = ${context.sourceCode.getText(value)}`;
94
+ }).join(", ");
95
+ return fixer.replaceText(decl, txt);
96
+ }
97
+ });
98
+ }
99
+ }
100
+ });
101
+ //#endregion
102
+ export { literal_destructuring_default as default };
@@ -0,0 +1,11 @@
1
+ import { WyrmPluginDocs } from "../utils/createRule.mjs";
2
+ import * as _$_typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
3
+
4
+ //#region lib/rules/named-export-with-side-effects.d.ts
5
+ declare const _default: _$_typescript_eslint_utils_ts_eslint0.RuleModule<"namedExportWithSideEffects", [{
6
+ strict: boolean;
7
+ }], WyrmPluginDocs, _$_typescript_eslint_utils_ts_eslint0.RuleListener> & {
8
+ name: string;
9
+ };
10
+ //#endregion
11
+ export { _default };