@ttsc/lint 0.30.4 → 0.31.1

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 (2520) hide show
  1. package/README.md +753 -741
  2. package/go.mod +7 -5
  3. package/internal/rulecode/rule_code_allocator_is_order_independent_and_append_only_test.go +119 -0
  4. package/internal/rulecode/rule_code_allocator_rejects_invalid_or_exhausted_ledgers_test.go +60 -0
  5. package/internal/rulecode/rulecode.go +18 -0
  6. package/lib/createTtscPlugin.d.ts +84 -0
  7. package/lib/createTtscPlugin.js +2704 -0
  8. package/lib/createTtscPlugin.js.map +1 -0
  9. package/lib/index.d.ts +1 -74
  10. package/lib/index.js +4 -2644
  11. package/lib/index.js.map +1 -1
  12. package/lib/internal/configEvaluatorFailure.d.ts +17 -9
  13. package/lib/internal/configEvaluatorFailure.js +17 -9
  14. package/lib/internal/configEvaluatorFailure.js.map +1 -1
  15. package/lib/internal/lintTrace.d.ts +18 -0
  16. package/lib/internal/lintTrace.js +99 -0
  17. package/lib/internal/lintTrace.js.map +1 -0
  18. package/lib/internal/normalizeContributors.d.ts +25 -0
  19. package/lib/internal/normalizeContributors.js +65 -0
  20. package/lib/internal/normalizeContributors.js.map +1 -0
  21. package/lib/structures/ITtscLintConfig.d.ts +25 -8
  22. package/lib/structures/ITtscLintPlugin.d.ts +13 -8
  23. package/lib/structures/ITtscLintPluginConfig.d.ts +18 -7
  24. package/lib/structures/ITtscLintPluginMeta.d.ts +10 -7
  25. package/lib/structures/TtscLintRuleSetting.d.ts +18 -13
  26. package/lib/structures/TtscLintSeverity.d.ts +5 -0
  27. package/lib/structures/format/ITtscLintFormat.d.ts +14 -8
  28. package/lib/structures/format/ITtscLintFormatJsDoc.d.ts +8 -1
  29. package/lib/structures/format/ITtscLintFormatSortImports.d.ts +14 -8
  30. package/lib/structures/rules/ITtscLintBoundariesRuleOptions.d.ts +133 -25
  31. package/lib/structures/rules/ITtscLintBoundariesRuleOptions.js +3 -3
  32. package/lib/structures/rules/ITtscLintBoundariesRules.d.ts +10 -5
  33. package/lib/structures/rules/ITtscLintContributorRules.d.ts +20 -13
  34. package/lib/structures/rules/ITtscLintCoreRuleOptions.d.ts +212 -24
  35. package/lib/structures/rules/ITtscLintCoreRules.d.ts +92 -72
  36. package/lib/structures/rules/ITtscLintCypressRuleOptions.d.ts +8 -1
  37. package/lib/structures/rules/ITtscLintCypressRules.d.ts +24 -21
  38. package/lib/structures/rules/ITtscLintFunctionalRuleOptions.d.ts +140 -24
  39. package/lib/structures/rules/ITtscLintFunctionalRules.d.ts +20 -12
  40. package/lib/structures/rules/ITtscLintJestRules.d.ts +22 -16
  41. package/lib/structures/rules/ITtscLintJsdocRules.d.ts +5 -0
  42. package/lib/structures/rules/ITtscLintJsxA11yRules.d.ts +24 -21
  43. package/lib/structures/rules/ITtscLintNextjsRules.d.ts +40 -42
  44. package/lib/structures/rules/ITtscLintPlaywrightRules.d.ts +24 -14
  45. package/lib/structures/rules/ITtscLintPromiseRules.d.ts +23 -14
  46. package/lib/structures/rules/ITtscLintReactPerfRuleOptions.d.ts +8 -1
  47. package/lib/structures/rules/ITtscLintReactPerfRules.d.ts +18 -15
  48. package/lib/structures/rules/ITtscLintReactRuleOptions.d.ts +14 -4
  49. package/lib/structures/rules/ITtscLintReactRules.d.ts +33 -27
  50. package/lib/structures/rules/ITtscLintRegexpRules.d.ts +18 -4
  51. package/lib/structures/rules/ITtscLintRuleOptionsMap.d.ts +88 -15
  52. package/lib/structures/rules/ITtscLintRules.d.ts +13 -9
  53. package/lib/structures/rules/ITtscLintSecurityRules.d.ts +33 -23
  54. package/lib/structures/rules/ITtscLintSolidRules.d.ts +57 -47
  55. package/lib/structures/rules/ITtscLintStorybookRuleOptions.d.ts +10 -2
  56. package/lib/structures/rules/ITtscLintStorybookRules.d.ts +52 -62
  57. package/lib/structures/rules/ITtscLintTanstackQueryRules.d.ts +34 -30
  58. package/lib/structures/rules/ITtscLintTestingLibraryRuleOptions.d.ts +12 -3
  59. package/lib/structures/rules/ITtscLintTestingLibraryRules.d.ts +20 -15
  60. package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.d.ts +105 -16
  61. package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +62 -51
  62. package/lib/structures/rules/ITtscLintUnicornRuleOptions.d.ts +234 -46
  63. package/lib/structures/rules/ITtscLintUnicornRules.d.ts +97 -44
  64. package/lib/structures/rules/ITtscLintVitestRules.d.ts +19 -11
  65. package/lib/structures/rules/TtscLintContributorOverlay.d.ts +34 -0
  66. package/lib/structures/rules/TtscLintContributorOverlay.js +3 -0
  67. package/lib/structures/rules/TtscLintContributorOverlay.js.map +1 -0
  68. package/lib/structures/rules/index.d.ts +1 -0
  69. package/lib/structures/rules/index.js +1 -0
  70. package/lib/structures/rules/index.js.map +1 -1
  71. package/linthost/all_rule_names_returns_sorted_caller_owned_enumeration_test.go +72 -0
  72. package/linthost/as_bool_rejects_non_boolean_value_test.go +39 -0
  73. package/linthost/as_int_accepts_all_integer_types_and_rejects_fractional_test.go +77 -0
  74. package/linthost/as_string_rejects_non_string_value_test.go +35 -0
  75. package/linthost/as_string_slice_rejects_non_array_and_non_string_elements_test.go +45 -0
  76. package/linthost/ast_helpers.go +28 -89
  77. package/linthost/ast_helpers_destructuring_target_rejects_reads_inside_member_and_call_test.go +61 -0
  78. package/linthost/ast_selector_expression_class_excludes_type_literals_test.go +32 -0
  79. package/linthost/ast_selector_matcher.go +5 -0
  80. package/linthost/ast_selector_parser.go +5 -0
  81. package/linthost/astutil_find_keyword_is_identifier_aware_test.go +89 -0
  82. package/linthost/astutil_keyword_start_locates_leading_keyword_test.go +79 -0
  83. package/linthost/astutil_node_text_strips_leading_trivia_test.go +48 -0
  84. package/linthost/astutil_token_range_strips_leading_trivia_test.go +58 -0
  85. package/linthost/async_query_event_and_util_promises_test.go +55 -0
  86. package/linthost/await_thenable_await_expression_offers_exact_suggestion_test.go +40 -0
  87. package/linthost/await_thenable_await_union_with_promise_allows_test.go +42 -0
  88. package/linthost/await_thenable_await_using_async_disposable_allows_test.go +65 -0
  89. package/linthost/await_thenable_await_using_async_method_under_dispose_symbol_reports_test.go +57 -0
  90. package/linthost/await_thenable_await_using_helpers_test.go +44 -0
  91. package/linthost/await_thenable_await_using_multi_declarator_reports_only_sync_resource_test.go +65 -0
  92. package/linthost/await_thenable_await_using_protocol_abstractions_allows_test.go +67 -0
  93. package/linthost/await_thenable_await_using_protocol_abstractions_reports_test.go +75 -0
  94. package/linthost/await_thenable_await_using_sync_disposable_reports_test.go +62 -0
  95. package/linthost/await_thenable_await_using_sync_only_union_reports_test.go +64 -0
  96. package/linthost/await_thenable_await_using_union_with_async_disposable_allows_test.go +56 -0
  97. package/linthost/await_thenable_awaitability_type_parameter_boundaries_test.go +51 -0
  98. package/linthost/await_thenable_for_await_of_async_iterable_allows_test.go +63 -0
  99. package/linthost/await_thenable_for_await_of_protocol_abstractions_allows_test.go +67 -0
  100. package/linthost/await_thenable_for_await_of_protocol_abstractions_reports_test.go +75 -0
  101. package/linthost/await_thenable_for_await_of_sync_iterable_reports_test.go +65 -0
  102. package/linthost/await_thenable_for_await_of_sync_only_union_reports_test.go +55 -0
  103. package/linthost/await_thenable_preserves_migrated_all_family_contexts_test.go +20 -0
  104. package/linthost/await_thenable_promise_aggregator_awaitable_inputs_allow_test.go +50 -0
  105. package/linthost/await_thenable_promise_aggregator_container_shapes_report_test.go +53 -0
  106. package/linthost/await_thenable_promise_aggregator_generic_constraint_reports_test.go +45 -0
  107. package/linthost/await_thenable_promise_aggregator_iteration_yields_allow_test.go +50 -0
  108. package/linthost/await_thenable_promise_aggregator_iteration_yields_report_test.go +64 -0
  109. package/linthost/await_thenable_promise_aggregator_literal_members_report_test.go +56 -0
  110. package/linthost/await_thenable_promise_aggregator_native_identity_test.go +60 -0
  111. package/linthost/await_thenable_promise_aggregator_native_methods_report_test.go +50 -0
  112. package/linthost/await_thenable_promise_aggregator_noniterable_boundaries_allow_test.go +39 -0
  113. package/linthost/await_thenable_protocol_members_must_be_callable_test.go +70 -0
  114. package/linthost/await_thenable_structural_thenable_signature_boundary_test.go +53 -0
  115. package/linthost/ban_ts_comment_block_comment_ignores_directive_before_last_line_test.go +32 -0
  116. package/linthost/ban_ts_comment_block_comment_reports_directive_on_last_line_test.go +57 -0
  117. package/linthost/ban_ts_comment_block_comment_splits_last_line_on_all_line_terminators_test.go +55 -0
  118. package/linthost/ban_ts_comment_default_allows_described_expect_error_test.go +27 -0
  119. package/linthost/ban_ts_comment_default_allows_ts_check_test.go +26 -0
  120. package/linthost/ban_ts_comment_default_allows_ts_nocheck_after_first_statement_test.go +32 -0
  121. package/linthost/ban_ts_comment_default_does_not_fix_ts_ignore_test.go +25 -0
  122. package/linthost/ban_ts_comment_default_reports_ignore_with_upgrade_message_test.go +56 -0
  123. package/linthost/ban_ts_comment_default_reports_indented_ignore_with_position_test.go +39 -0
  124. package/linthost/ban_ts_comment_default_reports_ts_nocheck_before_code_test.go +44 -0
  125. package/linthost/ban_ts_comment_default_reports_ts_nocheck_without_statements_test.go +34 -0
  126. package/linthost/ban_ts_comment_default_requires_description_for_bare_expect_error_test.go +51 -0
  127. package/linthost/ban_ts_comment_description_length_counts_grapheme_clusters_test.go +58 -0
  128. package/linthost/ban_ts_comment_description_length_follows_unicode_16_graphemes_test.go +91 -0
  129. package/linthost/ban_ts_comment_follows_regex_in_nested_template_test.go +39 -0
  130. package/linthost/ban_ts_comment_ignores_directive_text_inside_strings_and_templates_test.go +48 -0
  131. package/linthost/ban_ts_comment_ignores_prose_and_near_miss_comments_test.go +34 -0
  132. package/linthost/ban_ts_comment_option_description_format_accepts_matching_description_test.go +36 -0
  133. package/linthost/ban_ts_comment_option_description_format_checks_length_first_test.go +49 -0
  134. package/linthost/ban_ts_comment_option_description_format_reports_mismatch_test.go +46 -0
  135. package/linthost/ban_ts_comment_option_empty_object_directive_allows_directive_test.go +26 -0
  136. package/linthost/ban_ts_comment_option_expect_error_false_allows_directive_test.go +28 -0
  137. package/linthost/ban_ts_comment_option_expect_error_true_reports_despite_description_test.go +41 -0
  138. package/linthost/ban_ts_comment_option_invalid_description_format_keeps_length_gate_test.go +52 -0
  139. package/linthost/ban_ts_comment_option_minimum_description_length_boundary_test.go +67 -0
  140. package/linthost/ban_ts_comment_option_ts_check_true_reports_pragma_anywhere_test.go +50 -0
  141. package/linthost/ban_ts_comment_option_ts_ignore_allow_with_description_test.go +57 -0
  142. package/linthost/ban_ts_comment_option_ts_nocheck_allow_with_description_test.go +57 -0
  143. package/linthost/ban_ts_comment_option_ts_nocheck_false_allows_directive_test.go +27 -0
  144. package/linthost/ban_ts_comment_option_unrecognized_value_keeps_default_policy_test.go +53 -0
  145. package/linthost/ban_ts_comment_pragma_ignores_block_comments_test.go +33 -0
  146. package/linthost/ban_ts_comment_pragma_requires_two_or_three_slashes_test.go +49 -0
  147. package/linthost/ban_ts_comment_pragma_wins_over_error_suppression_match_test.go +29 -0
  148. package/linthost/ban_ts_comment_preserves_migrated_defaults_and_options_test.go +29 -0
  149. package/linthost/ban_ts_comment_respects_inline_disable_next_line_test.go +28 -0
  150. package/linthost/ban_ts_comment_suggestion_compiler_error_boundary_test.go +56 -0
  151. package/linthost/ban_ts_comment_suggestion_rewrites_block_comment_ignore_test.go +40 -0
  152. package/linthost/ban_ts_comment_suggestion_rewrites_many_slash_line_comment_test.go +41 -0
  153. package/linthost/base_chain_walk_crosses_generic_boundary_test.go +165 -0
  154. package/linthost/behavioral_witness_audit_accepts_production_prerequisite_kinds_test.go +57 -0
  155. package/linthost/behavioral_witness_audit_publishes_one_deterministic_route_per_rule_test.go +45 -0
  156. package/linthost/behavioral_witness_audit_rejects_inert_public_rule_test.go +46 -0
  157. package/linthost/behavioral_witness_audit_rejects_invalid_non_canonical_candidate_test.go +49 -0
  158. package/linthost/behavioral_witness_coverage_test.go +379 -0
  159. package/linthost/behavioral_witness_kind_follows_rule_checker_requirement_test.go +69 -0
  160. package/linthost/binding_diagnostic_sites_helpers_test.go +31 -0
  161. package/linthost/blank_line_between_statements_returns_false_for_out_of_range_test.go +51 -0
  162. package/linthost/block_has_non_statement_comment_returns_false_for_out_of_range_test.go +56 -0
  163. package/linthost/block_has_non_statement_comment_skips_nil_stmts_test.go +42 -0
  164. package/linthost/boundaries_dependencies_alias_resolution_test.go +60 -0
  165. package/linthost/boundaries_dependencies_bare_core_builtin_test.go +36 -0
  166. package/linthost/boundaries_dependencies_command_test.go +67 -0
  167. package/linthost/boundaries_dependencies_declaration_file_test.go +50 -0
  168. package/linthost/boundaries_dependencies_default_test.go +36 -0
  169. package/linthost/boundaries_dependencies_from_to_test.go +66 -0
  170. package/linthost/boundaries_dependencies_import_kind_test.go +46 -0
  171. package/linthost/boundaries_dependencies_import_type_kinds_test.go +56 -0
  172. package/linthost/boundaries_dependencies_legacy_to_direction_test.go +43 -0
  173. package/linthost/boundaries_dependencies_local_gates_test.go +43 -0
  174. package/linthost/boundaries_dependencies_messages_test.go +58 -0
  175. package/linthost/boundaries_dependencies_options_test.go +66 -0
  176. package/linthost/boundaries_dependencies_origins_test.go +38 -0
  177. package/linthost/boundaries_dependencies_path_separators_test.go +36 -0
  178. package/linthost/boundaries_dependencies_policy_order_test.go +41 -0
  179. package/linthost/boundaries_dependencies_syntax_test.go +86 -0
  180. package/linthost/boundaries_dependencies_test.go +38 -0
  181. package/linthost/boundaries_dependencies_visibility_selectors_test.go +52 -0
  182. package/linthost/boundaries_element_types_deny_only_names_nothing_test.go +36 -0
  183. package/linthost/boundaries_element_types_ignores_dynamic_syntax_test.go +44 -0
  184. package/linthost/boundaries_element_types_names_the_allowed_set_test.go +40 -0
  185. package/linthost/boundaries_element_types_rejects_disallowed_import_test.go +43 -0
  186. package/linthost/boundaries_entry_point_rejects_non_entry_import_test.go +43 -0
  187. package/linthost/boundaries_external_deny_only_names_nothing_test.go +25 -0
  188. package/linthost/boundaries_external_names_the_allowed_set_test.go +30 -0
  189. package/linthost/boundaries_external_rejects_disallowed_package_test.go +34 -0
  190. package/linthost/boundaries_helpers_test.go +162 -0
  191. package/linthost/boundaries_no_private_rejects_cross_element_private_import_test.go +39 -0
  192. package/linthost/boundaries_no_unknown_rejects_unknown_import_target_test.go +43 -0
  193. package/linthost/check_observations.go +236 -0
  194. package/linthost/check_observations_retains_failed_program_and_raw_inputs_test.go +266 -0
  195. package/linthost/check_serve.go +23 -3
  196. package/linthost/check_serve_reuses_program_and_matches_cold_cycles_test.go +168 -0
  197. package/linthost/check_tag_names_publishes_canonical_hints_test.go +62 -0
  198. package/linthost/check_tag_names_test.go +30 -0
  199. package/linthost/check_values_test.go +31 -0
  200. package/linthost/command_build_emits_project_output_test.go +55 -0
  201. package/linthost/command_build_rejects_conflicting_emit_flags_test.go +32 -0
  202. package/linthost/command_check_applies_a_forwarded_null_reset_test.go +62 -0
  203. package/linthost/command_check_applies_forwarded_tsgo_flag_test.go +61 -0
  204. package/linthost/command_check_corpus_clean_project_exits_zero_test.go +41 -0
  205. package/linthost/command_check_corpus_ignores_future_optional_flags_test.go +34 -0
  206. package/linthost/command_check_corpus_reports_unknown_rule_names_test.go +25 -0
  207. package/linthost/command_check_honors_no_restricted_syntax_options_test.go +59 -0
  208. package/linthost/command_check_no_param_reassign_honors_props_config_test.go +46 -0
  209. package/linthost/command_check_no_restricted_imports_uses_real_config_options_test.go +53 -0
  210. package/linthost/command_check_preserves_compiler_argument_cwd_test.go +78 -0
  211. package/linthost/command_check_preserves_severity_exit_contract_test.go +54 -0
  212. package/linthost/command_check_rejects_invalid_no_param_reassign_options_before_linting_test.go +85 -0
  213. package/linthost/command_check_rejects_invalid_no_restricted_imports_options_before_linting_test.go +52 -0
  214. package/linthost/command_check_rejects_invalid_no_restricted_syntax_selector_test.go +41 -0
  215. package/linthost/command_check_relates_files_to_the_project_directory_test.go +40 -0
  216. package/linthost/command_check_reports_imported_sibling_workspace_source_test.go +45 -0
  217. package/linthost/command_check_reports_lint_diagnostic_test.go +44 -0
  218. package/linthost/command_check_reports_the_malformed_brace_it_used_to_bless_test.go +31 -0
  219. package/linthost/command_check_scopes_extends_rule_options_per_file_test.go +70 -0
  220. package/linthost/command_check_uses_parser_context_for_comment_consumers_test.go +61 -0
  221. package/linthost/command_check_warns_unknown_rules_test.go +41 -0
  222. package/linthost/command_fix_applies_both_lint_and_format_rule_edits_test.go +51 -0
  223. package/linthost/command_fix_applies_native_autofixes_test.go +48 -0
  224. package/linthost/command_fix_leaves_suggestion_only_rules_unchanged_test.go +46 -0
  225. package/linthost/command_fix_owns_its_source_reached_through_a_link_test.go +63 -0
  226. package/linthost/command_fix_rejects_emit_flag_test.go +39 -0
  227. package/linthost/command_fix_reports_but_never_rewrites_imported_sibling_source_test.go +65 -0
  228. package/linthost/command_fix_skips_default_formatting_that_format_applies_test.go +87 -0
  229. package/linthost/command_fix_unicorn_prevent_abbreviations_keeps_cross_file_merges_diagnostic_only_test.go +44 -0
  230. package/linthost/command_fix_unicorn_prevent_abbreviations_reparses_and_is_idempotent_test.go +37 -0
  231. package/linthost/command_fix_unicorn_switch_case_break_position_converges_and_is_idempotent_test.go +58 -0
  232. package/linthost/command_fix_unicorn_template_indent_converges_and_is_idempotent_test.go +43 -0
  233. package/linthost/command_format_applies_format_block_reflow_test.go +50 -0
  234. package/linthost/command_format_applies_format_rule_edits_test.go +54 -0
  235. package/linthost/command_format_arg_hugging_test.go +329 -0
  236. package/linthost/command_format_array_of_arrays_break_test.go +62 -0
  237. package/linthost/command_format_blank_line_in_list_test.go +69 -0
  238. package/linthost/command_format_brace_ownership_negative_twins_test.go +94 -0
  239. package/linthost/command_format_cedes_chained_arrow_body_test.go +50 -0
  240. package/linthost/command_format_cedes_closing_brace_under_wrapped_head_test.go +54 -0
  241. package/linthost/command_format_class_heritage_break_test.go +108 -0
  242. package/linthost/command_format_converges_on_leading_semi_guard_in_callback_test.go +69 -0
  243. package/linthost/command_format_decorated_declaration_indent_is_idempotent_test.go +57 -0
  244. package/linthost/command_format_default_import_single_specifier_break_test.go +26 -0
  245. package/linthost/command_format_display_width_test.go +33 -0
  246. package/linthost/command_format_expands_expression_nested_block_test.go +86 -0
  247. package/linthost/command_format_expression_nested_block_honors_crlf_test.go +39 -0
  248. package/linthost/command_format_fixture_corpus_test.go +179 -0
  249. package/linthost/command_format_honors_entry_ignores_alongside_rules_test.go +79 -0
  250. package/linthost/command_format_import_multi_specifier_from_overflow_break_test.go +27 -0
  251. package/linthost/command_format_indent_idempotency_helper_test.go +57 -0
  252. package/linthost/command_format_keeps_commented_statement_body_whole_test.go +23 -0
  253. package/linthost/command_format_keeps_empty_expression_nested_block_test.go +29 -0
  254. package/linthost/command_format_lays_out_a_statement_body_test.go +90 -0
  255. package/linthost/command_format_leaves_a_braceless_control_flow_body_alone_test.go +30 -0
  256. package/linthost/command_format_leaves_imported_sibling_source_untouched_test.go +68 -0
  257. package/linthost/command_format_leaves_prettier_shaped_mapped_types_untouched_test.go +39 -0
  258. package/linthost/command_format_leaves_prettier_shaped_type_members_untouched_test.go +41 -0
  259. package/linthost/command_format_leaves_token_spacing_untouched_test.go +66 -0
  260. package/linthost/command_format_multiple_callbacks_test.go +150 -0
  261. package/linthost/command_format_nested_ternary_indent_test.go +67 -0
  262. package/linthost/command_format_nested_ternary_parens_test.go +74 -0
  263. package/linthost/command_format_numeric_array_fill_test.go +94 -0
  264. package/linthost/command_format_preserves_braceless_for_body_indent_test.go +28 -0
  265. package/linthost/command_format_preserves_braceless_if_try_body_indent_test.go +30 -0
  266. package/linthost/command_format_preserves_class_typeparam_heritage_inline_test.go +27 -0
  267. package/linthost/command_format_preserves_comments_in_reflow_test.go +66 -0
  268. package/linthost/command_format_preserves_crlf_across_reflow_rules_test.go +73 -0
  269. package/linthost/command_format_preserves_generic_arg_multiline_type_literal_indent_test.go +30 -0
  270. package/linthost/command_format_preserves_generic_arg_type_literal_indent_test.go +30 -0
  271. package/linthost/command_format_preserves_interface_qualified_heritage_own_line_test.go +28 -0
  272. package/linthost/command_format_preserves_intersection_generic_type_literal_indent_test.go +36 -0
  273. package/linthost/command_format_preserves_multi_type_heritage_empty_body_test.go +28 -0
  274. package/linthost/command_format_preserves_multiline_type_param_heritage_test.go +30 -0
  275. package/linthost/command_format_preserves_nested_variable_type_literal_indent_test.go +27 -0
  276. package/linthost/command_format_preserves_param_type_literal_indent_test.go +62 -0
  277. package/linthost/command_format_preserves_union_member_type_literal_indent_test.go +28 -0
  278. package/linthost/command_format_print_width_abstains_inside_binary_expression_test.go +84 -0
  279. package/linthost/command_format_print_width_cascades_with_semi_and_quotes_test.go +62 -0
  280. package/linthost/command_format_print_width_converges_on_unbraced_control_flow_test.go +176 -0
  281. package/linthost/command_format_rejects_emit_flag_test.go +39 -0
  282. package/linthost/command_format_respects_resolved_entry_applicability_test.go +219 -0
  283. package/linthost/command_format_restores_class_member_indent_from_flat_test.go +61 -0
  284. package/linthost/command_format_restores_closing_braces_from_flat_test.go +64 -0
  285. package/linthost/command_format_restores_decorated_member_indent_from_flat_test.go +61 -0
  286. package/linthost/command_format_restores_decorated_namespace_class_indent_from_flat_test.go +62 -0
  287. package/linthost/command_format_restores_decorated_nested_class_indent_from_flat_test.go +64 -0
  288. package/linthost/command_format_restores_decorated_nested_function_indent_from_flat_test.go +60 -0
  289. package/linthost/command_format_restores_decorated_nested_interface_indent_from_flat_test.go +59 -0
  290. package/linthost/command_format_restores_nested_class_indent_from_flat_test.go +60 -0
  291. package/linthost/command_format_restores_stranded_brace_from_one_line_block_test.go +140 -0
  292. package/linthost/command_format_restores_switch_indent_from_flat_test.go +63 -0
  293. package/linthost/command_format_return_typed_arrow_hug_test.go +74 -0
  294. package/linthost/command_format_round2_coverage_test.go +57 -0
  295. package/linthost/command_format_round2_hug_fixes_test.go +70 -0
  296. package/linthost/command_format_round3_force_break_test.go +49 -0
  297. package/linthost/command_format_settles_a_member_terminator_on_a_padded_line_test.go +34 -0
  298. package/linthost/command_format_single_specifier_abstain_does_not_block_multi_break_test.go +56 -0
  299. package/linthost/command_format_single_specifier_stays_inline_test.go +60 -0
  300. package/linthost/command_format_split_call_collapses_flat_once_isolated_test.go +54 -0
  301. package/linthost/command_format_spread_comment_test.go +36 -0
  302. package/linthost/command_format_stranded_brace_honors_crlf_test.go +51 -0
  303. package/linthost/command_format_structural_rules_are_idempotent_on_their_own_output_test.go +51 -0
  304. package/linthost/command_format_structural_rules_converge_on_headline_input_test.go +56 -0
  305. package/linthost/command_format_structural_rules_converge_on_nested_block_test.go +56 -0
  306. package/linthost/command_format_switch_case_block_indent_test.go +80 -0
  307. package/linthost/command_format_terminates_a_split_interface_member_test.go +34 -0
  308. package/linthost/command_format_test_call_hug_test.go +92 -0
  309. package/linthost/command_format_wrapped_function_body_indent_test.go +43 -0
  310. package/linthost/command_lint_corpus_semantics_helpers_test.go +29 -0
  311. package/linthost/command_prints_version_test.go +38 -0
  312. package/linthost/command_rejects_conflicting_emit_flags_test.go +33 -0
  313. package/linthost/command_rejects_unknown_test.go +32 -0
  314. package/linthost/command_requires_argument_test.go +32 -0
  315. package/linthost/command_transform_normalizes_dot_segments_in_file_path_test.go +49 -0
  316. package/linthost/command_transform_outputs_requested_file_test.go +43 -0
  317. package/linthost/command_transform_requires_file_test.go +32 -0
  318. package/linthost/comment_scan.go +3 -2
  319. package/linthost/comment_scan_handles_malformed_parser_recovery_test.go +59 -0
  320. package/linthost/comment_scan_uses_parser_lexical_ranges_across_source_modes_test.go +109 -0
  321. package/linthost/compile.go +177 -38
  322. package/linthost/compile_user_pattern_caches_option_regex_test.go +70 -0
  323. package/linthost/config.go +954 -269
  324. package/linthost/config_cache_does_not_memoize_failed_evaluation_test.go +63 -0
  325. package/linthost/config_cache_portable_dependency_policies_test.go +471 -0
  326. package/linthost/config_cache_preserves_pattern_precedence_test.go +96 -0
  327. package/linthost/config_cache_reuses_evaluation_until_content_changes_test.go +81 -0
  328. package/linthost/config_fixture_helpers_test.go +70 -0
  329. package/linthost/config_format.go +5 -5
  330. package/linthost/config_glob.go +517 -0
  331. package/linthost/config_glob_bounds_matching_work_test.go +115 -0
  332. package/linthost/config_glob_preserves_expansion_semantics_test.go +128 -0
  333. package/linthost/config_glob_preserves_stored_case_recovery_test.go +64 -0
  334. package/linthost/config_json.go +85 -0
  335. package/linthost/config_loader_sources_escape_every_literal_percent_test.go +81 -0
  336. package/linthost/config_store_option_fold_honors_both_entry_orders_test.go +70 -0
  337. package/linthost/config_store_resolves_options_with_entry_scope_test.go +95 -0
  338. package/linthost/config_store_severity_only_override_inherits_matching_options_test.go +53 -0
  339. package/linthost/config_store_validates_every_scoped_option_variant_test.go +55 -0
  340. package/linthost/consistent_return_accepts_functions_that_return_on_every_path_through_switch_and_try_test.go +43 -0
  341. package/linthost/context_report_range_suggestion_separates_opt_in_edits_test.go +76 -0
  342. package/linthost/contrib_adapter.go +3 -1
  343. package/linthost/contrib_adapter_to_internal_text_edits_returns_nil_for_empty_input_test.go +34 -0
  344. package/linthost/contrib_adapter_to_internal_text_edits_round_trips_three_edits_test.go +40 -0
  345. package/linthost/contributor_ast_only_marker_skips_standalone_checker_test.go +52 -0
  346. package/linthost/contributor_bootstrap_is_single_owner_for_reusable_main_test.go +425 -0
  347. package/linthost/contributor_cannot_mutate_later_invocation_options_test.go +55 -0
  348. package/linthost/contributor_diagnostic_ranges_are_bounded_test.go +139 -0
  349. package/linthost/contributor_generic_accepts_options_method_keeps_legacy_payload_test.go +81 -0
  350. package/linthost/contributor_metadata_panic_is_rejected_test.go +84 -0
  351. package/linthost/contributor_optionless_marker_rejects_payload_test.go +63 -0
  352. package/linthost/contributor_panics_preserve_other_rules_in_process_test.go +111 -0
  353. package/linthost/contributor_range_fix_bounds_diagnostic_independently_from_edit_test.go +52 -0
  354. package/linthost/contributor_report_related_reaches_finding_test.go +101 -0
  355. package/linthost/contributor_rule_decodes_options_through_public_context_test.go +75 -0
  356. package/linthost/contributor_rule_opt_out_skips_declaration_files_test.go +56 -0
  357. package/linthost/contributor_rule_receives_and_reports_configured_severity_test.go +65 -0
  358. package/linthost/contributor_rules_visit_declaration_files_by_default_test.go +50 -0
  359. package/linthost/contributor_tagged_rule_marks_findings_test.go +78 -0
  360. package/linthost/contributor_type_aware_marker_keeps_checker_test.go +50 -0
  361. package/linthost/contributor_without_tag_marker_leaves_findings_untagged_test.go +61 -0
  362. package/linthost/cypress_assertion_before_screenshot_allows_immediately_prior_assertion_test.go +33 -0
  363. package/linthost/cypress_assertion_before_screenshot_allows_same_chain_assertion_test.go +31 -0
  364. package/linthost/cypress_assertion_before_screenshot_reports_unchecked_screenshot_test.go +34 -0
  365. package/linthost/cypress_assertion_before_screenshot_reports_unrelated_prior_assertion_test.go +36 -0
  366. package/linthost/cypress_finding_helpers_test.go +14 -0
  367. package/linthost/cypress_no_and_reports_chain_starting_and_test.go +35 -0
  368. package/linthost/cypress_no_assigning_return_values_reports_cy_assignment_test.go +35 -0
  369. package/linthost/cypress_no_async_before_reports_async_before_each_test.go +37 -0
  370. package/linthost/cypress_no_async_tests_reports_async_it_test.go +37 -0
  371. package/linthost/cypress_no_chained_get_reports_second_get_test.go +34 -0
  372. package/linthost/cypress_no_debug_reports_debug_command_test.go +34 -0
  373. package/linthost/cypress_no_force_reports_force_true_option_test.go +34 -0
  374. package/linthost/cypress_no_pause_reports_pause_command_test.go +34 -0
  375. package/linthost/cypress_no_unnecessary_waiting_reports_numeric_wait_test.go +35 -0
  376. package/linthost/cypress_no_xpath_reports_xpath_command_test.go +34 -0
  377. package/linthost/cypress_require_data_selectors_reports_class_selector_test.go +36 -0
  378. package/linthost/cypress_unsafe_to_chain_command_reports_action_middle_test.go +35 -0
  379. package/linthost/declaration_file_allowlist_names_are_registered_rules_test.go +50 -0
  380. package/linthost/default_case_accepts_block_comment_marker_test.go +28 -0
  381. package/linthost/default_case_accepts_case_insensitive_marker_test.go +28 -0
  382. package/linthost/default_case_accepts_empty_switch_test.go +24 -0
  383. package/linthost/default_case_accepts_existing_default_clause_test.go +29 -0
  384. package/linthost/default_case_accepts_no_default_marker_test.go +28 -0
  385. package/linthost/default_case_custom_pattern_replaces_default_marker_test.go +30 -0
  386. package/linthost/default_case_helpers_test.go +58 -0
  387. package/linthost/default_case_honors_custom_comment_pattern_test.go +28 -0
  388. package/linthost/default_case_invalid_comment_pattern_falls_back_to_default_test.go +28 -0
  389. package/linthost/default_case_rejects_marker_with_trailing_text_test.go +28 -0
  390. package/linthost/default_case_rejects_unrelated_trailing_comment_test.go +28 -0
  391. package/linthost/default_case_reports_switch_without_default_test.go +27 -0
  392. package/linthost/default_case_requires_marker_to_be_last_comment_test.go +30 -0
  393. package/linthost/diagnostic_codes_distinguish_former_collision_across_cli_and_lsp_test.go +97 -0
  394. package/linthost/dispatch.go +29 -9
  395. package/linthost/dispatch_array_literal_breaks_when_overflows_test.go +38 -0
  396. package/linthost/dispatch_array_literal_falls_back_when_element_nil_test.go +53 -0
  397. package/linthost/dispatch_array_literal_falls_back_when_elements_nil_test.go +48 -0
  398. package/linthost/dispatch_array_literal_flat_when_fits_test.go +34 -0
  399. package/linthost/dispatch_array_literal_returns_empty_for_nil_node_test.go +31 -0
  400. package/linthost/dispatch_arrow_function_block_body_reindents_consistently_test.go +41 -0
  401. package/linthost/dispatch_arrow_function_returns_covered_for_nil_node_test.go +38 -0
  402. package/linthost/dispatch_arrow_function_returns_verbatim_for_nil_body_test.go +46 -0
  403. package/linthost/dispatch_block_collapses_empty_body_to_braces_test.go +40 -0
  404. package/linthost/dispatch_block_keeps_covered_for_single_line_statements_test.go +42 -0
  405. package/linthost/dispatch_block_preserves_blank_line_between_statements_test.go +41 -0
  406. package/linthost/dispatch_block_reports_uncovered_for_comment_only_body_test.go +37 -0
  407. package/linthost/dispatch_block_reports_uncovered_for_inter_statement_comment_test.go +37 -0
  408. package/linthost/dispatch_block_returns_covered_for_nil_node_test.go +34 -0
  409. package/linthost/dispatch_block_returns_verbatim_for_nil_statement_test.go +47 -0
  410. package/linthost/dispatch_block_returns_verbatim_for_nil_statements_test.go +44 -0
  411. package/linthost/dispatch_call_breaks_expression_body_arrow_argument_when_overflows_test.go +44 -0
  412. package/linthost/dispatch_call_breaks_hugged_object_when_flat_form_overflows_test.go +42 -0
  413. package/linthost/dispatch_call_explodes_when_hugged_callback_header_overflows_test.go +45 -0
  414. package/linthost/dispatch_call_explodes_when_hugged_object_header_overflows_test.go +43 -0
  415. package/linthost/dispatch_call_expression_breaks_arguments_when_overflows_test.go +40 -0
  416. package/linthost/dispatch_call_expression_flat_when_fits_test.go +33 -0
  417. package/linthost/dispatch_call_hugs_last_callback_argument_test.go +41 -0
  418. package/linthost/dispatch_call_keeps_hugged_object_flat_when_it_fits_test.go +40 -0
  419. package/linthost/dispatch_expression_statement_returns_covered_for_nil_node_test.go +36 -0
  420. package/linthost/dispatch_expression_statement_returns_verbatim_for_dirty_tail_test.go +44 -0
  421. package/linthost/dispatch_expression_statement_returns_verbatim_for_nil_expression_test.go +44 -0
  422. package/linthost/dispatch_function_expression_block_body_reindents_test.go +43 -0
  423. package/linthost/dispatch_function_expression_returns_covered_for_nil_node_test.go +36 -0
  424. package/linthost/dispatch_function_expression_returns_verbatim_for_nil_body_test.go +44 -0
  425. package/linthost/dispatch_function_like_returns_verbatim_for_out_of_range_body_test.go +50 -0
  426. package/linthost/dispatch_function_like_taints_covered_for_multiline_signature_test.go +38 -0
  427. package/linthost/dispatch_import_declaration_falls_back_for_default_import_test.go +32 -0
  428. package/linthost/dispatch_import_declaration_falls_back_for_import_attributes_test.go +33 -0
  429. package/linthost/dispatch_import_declaration_falls_back_for_namespace_import_test.go +37 -0
  430. package/linthost/dispatch_import_declaration_falls_back_for_side_effect_import_test.go +36 -0
  431. package/linthost/dispatch_import_declaration_omits_semicolon_when_absent_test.go +37 -0
  432. package/linthost/dispatch_import_declaration_preserves_type_only_keyword_test.go +34 -0
  433. package/linthost/dispatch_import_declaration_returns_empty_for_nil_node_test.go +30 -0
  434. package/linthost/dispatch_import_declaration_threads_clauses_test.go +35 -0
  435. package/linthost/dispatch_named_exports_breaks_when_overflows_test.go +38 -0
  436. package/linthost/dispatch_named_exports_falls_back_when_elements_nil_test.go +49 -0
  437. package/linthost/dispatch_named_exports_falls_back_when_specifier_nil_test.go +51 -0
  438. package/linthost/dispatch_named_exports_flat_when_fits_test.go +33 -0
  439. package/linthost/dispatch_named_exports_returns_empty_for_nil_node_test.go +31 -0
  440. package/linthost/dispatch_named_imports_breaks_when_overflows_test.go +37 -0
  441. package/linthost/dispatch_named_imports_falls_back_when_elements_nil_test.go +50 -0
  442. package/linthost/dispatch_named_imports_falls_back_when_specifier_nil_test.go +54 -0
  443. package/linthost/dispatch_named_imports_flat_when_fits_test.go +34 -0
  444. package/linthost/dispatch_named_imports_returns_empty_for_nil_node_test.go +30 -0
  445. package/linthost/dispatch_nested_callback_reflows_at_every_depth_test.go +52 -0
  446. package/linthost/dispatch_new_expression_breaks_arguments_when_overflows_test.go +39 -0
  447. package/linthost/dispatch_new_expression_flat_when_fits_test.go +36 -0
  448. package/linthost/dispatch_object_literal_breaks_when_overflows_test.go +40 -0
  449. package/linthost/dispatch_object_literal_falls_back_when_properties_nil_test.go +49 -0
  450. package/linthost/dispatch_object_literal_falls_back_when_property_nil_test.go +52 -0
  451. package/linthost/dispatch_object_literal_flat_when_fits_test.go +33 -0
  452. package/linthost/dispatch_object_literal_returns_empty_for_nil_node_test.go +31 -0
  453. package/linthost/dispatch_parenthesized_expression_reflows_inner_test.go +42 -0
  454. package/linthost/dispatch_parenthesized_expression_returns_covered_for_nil_node_test.go +35 -0
  455. package/linthost/dispatch_parenthesized_expression_returns_verbatim_for_nil_inner_test.go +44 -0
  456. package/linthost/dispatch_reports_uncovered_for_multiline_verbatim_subtree_test.go +42 -0
  457. package/linthost/dispatch_return_statement_reflows_returned_expression_test.go +45 -0
  458. package/linthost/dispatch_return_statement_returns_covered_for_nil_node_test.go +36 -0
  459. package/linthost/dispatch_return_statement_returns_verbatim_for_bare_return_test.go +41 -0
  460. package/linthost/dispatch_return_statement_returns_verbatim_for_dirty_tail_test.go +43 -0
  461. package/linthost/dispatch_verbatim_fallback_preserves_unknown_kinds_test.go +41 -0
  462. package/linthost/display_width.go +29 -5
  463. package/linthost/display_width_after_last_newline_measures_tail_test.go +33 -0
  464. package/linthost/display_width_from_column_expands_tabs_to_stops_test.go +49 -0
  465. package/linthost/display_width_matches_prettier_get_string_width_test.go +124 -0
  466. package/linthost/display_width_oracle_preconditions_test.go +32 -0
  467. package/linthost/doc_join_returns_nil_for_empty_parts_test.go +33 -0
  468. package/linthost/dot_notation_declines_fix_when_comment_in_bracket_span_test.go +40 -0
  469. package/linthost/dot_notation_fix_bracket_to_dot_for_identifier_key_test.go +27 -0
  470. package/linthost/dot_notation_fix_keeps_bracket_for_reserved_word_test.go +28 -0
  471. package/linthost/dot_notation_fix_spaces_decimal_integer_receiver_test.go +76 -0
  472. package/linthost/dot_notation_offers_reserved_word_collapse_as_suggestion_test.go +36 -0
  473. package/linthost/dot_notation_offers_withheld_bracket_collapse_as_suggestion_test.go +37 -0
  474. package/linthost/dot_notation_skips_invalid_identifier_key_test.go +27 -0
  475. package/linthost/editor_format_overrides_accepts_utf8_bom_test.go +155 -0
  476. package/linthost/editor_format_overrides_combined_sections_follow_source_order_test.go +58 -0
  477. package/linthost/editor_format_overrides_drive_idempotent_output_test.go +69 -0
  478. package/linthost/editor_format_overrides_duplicate_language_section_uses_last_value_test.go +55 -0
  479. package/linthost/editor_format_overrides_equivalent_exact_sections_use_last_scope_test.go +52 -0
  480. package/linthost/editor_format_overrides_language_section_wins_test.go +37 -0
  481. package/linthost/editor_format_overrides_normalize_full_language_selectors_test.go +44 -0
  482. package/linthost/editor_format_overrides_reads_vscode_settings_test.go +45 -0
  483. package/linthost/editor_format_overrides_reject_malformed_language_selectors_test.go +36 -0
  484. package/linthost/editor_format_overrides_single_language_precedence_is_deterministic_test.go +51 -0
  485. package/linthost/editor_format_overrides_supported_language_ids_test.go +60 -0
  486. package/linthost/empty_tags_test.go +27 -0
  487. package/linthost/engine.go +523 -91
  488. package/linthost/engine_accepts_null_tuple_slot_as_absent_options_test.go +37 -0
  489. package/linthost/engine_accepts_payload_for_option_rule_test.go +36 -0
  490. package/linthost/engine_accepts_severity_only_optionless_rule_test.go +28 -0
  491. package/linthost/engine_align_uses_current_column_test.go +27 -0
  492. package/linthost/engine_block_disable_after_code_does_not_suppress_earlier_same_line_test.go +47 -0
  493. package/linthost/engine_conditional_group_empty_renders_nothing_test.go +24 -0
  494. package/linthost/engine_conditional_group_falls_back_to_last_option_test.go +30 -0
  495. package/linthost/engine_conditional_group_picks_first_fitting_option_test.go +31 -0
  496. package/linthost/engine_crlf_terminator_emits_carriage_returns_test.go +24 -0
  497. package/linthost/engine_dedupes_duplicate_kinds_in_visits_test.go +64 -0
  498. package/linthost/engine_detects_files_without_enabled_rules_test.go +40 -0
  499. package/linthost/engine_directive_accepts_typescript_namespace_prefix_test.go +48 -0
  500. package/linthost/engine_directive_after_template_expression_test.go +37 -0
  501. package/linthost/engine_directive_records_unknown_rule_in_unknown_channel_test.go +65 -0
  502. package/linthost/engine_directive_rejects_legacy_typescript_eslint_prefix_test.go +50 -0
  503. package/linthost/engine_directive_without_rules_disables_all_rules_on_target_line_test.go +57 -0
  504. package/linthost/engine_disable_line_multiline_block_comment_targets_end_line_test.go +50 -0
  505. package/linthost/engine_dispatches_only_to_interested_rules_test.go +81 -0
  506. package/linthost/engine_end_of_line_defaults_to_lf_when_empty_test.go +23 -0
  507. package/linthost/engine_fits_first_line_counts_flat_group_lines_test.go +25 -0
  508. package/linthost/engine_fits_first_line_stops_at_first_break_test.go +85 -0
  509. package/linthost/engine_fits_measures_conditional_group_as_first_option_test.go +25 -0
  510. package/linthost/engine_fits_rejects_forced_break_group_test.go +22 -0
  511. package/linthost/engine_fits_returns_false_when_remaining_negative_test.go +21 -0
  512. package/linthost/engine_fits_treats_indent_align_as_transparent_in_flat_test.go +34 -0
  513. package/linthost/engine_flatten_resolves_breaks_to_flat_form_test.go +57 -0
  514. package/linthost/engine_group_break_flag_forces_broken_layout_test.go +29 -0
  515. package/linthost/engine_group_breaks_when_overflows_width_test.go +30 -0
  516. package/linthost/engine_group_collapses_when_fits_width_test.go +28 -0
  517. package/linthost/engine_hardline_forces_break_regardless_of_width_test.go +23 -0
  518. package/linthost/engine_ifbreak_picks_broken_branch_when_group_breaks_test.go +32 -0
  519. package/linthost/engine_ifbreak_picks_flat_branch_when_group_fits_test.go +28 -0
  520. package/linthost/engine_ignores_directive_text_inside_strings_test.go +45 -0
  521. package/linthost/engine_ignores_jsx_text_inline_disable_markers_test.go +54 -0
  522. package/linthost/engine_indent_compounds_inside_group_test.go +20 -0
  523. package/linthost/engine_line_suffix_attaches_to_next_break_test.go +33 -0
  524. package/linthost/engine_line_suffix_drain_preserves_embedded_newline_test.go +23 -0
  525. package/linthost/engine_line_suffix_drains_inline_when_no_break_follows_test.go +28 -0
  526. package/linthost/engine_line_suffix_flush_preserves_embedded_newline_test.go +28 -0
  527. package/linthost/engine_literalline_emits_newline_at_column_zero_test.go +24 -0
  528. package/linthost/engine_preserves_migrated_disable_directive_population_test.go +46 -0
  529. package/linthost/engine_print_width_defaults_when_zero_test.go +39 -0
  530. package/linthost/engine_quarantines_panicking_rule_per_file_test.go +110 -0
  531. package/linthost/engine_records_unknown_rules_test.go +42 -0
  532. package/linthost/engine_recovers_from_rule_panic_test.go +68 -0
  533. package/linthost/engine_rejects_legacy_typescript_eslint_prefix_test.go +39 -0
  534. package/linthost/engine_rejects_optionless_payload_while_rule_is_off_test.go +37 -0
  535. package/linthost/engine_rejects_payload_shapes_for_optionless_rule_test.go +46 -0
  536. package/linthost/engine_requires_type_checker_for_contributor_rule_test.go +43 -0
  537. package/linthost/engine_requires_type_checker_for_prefer_const_test.go +33 -0
  538. package/linthost/engine_requires_type_checker_for_type_aware_rule_test.go +35 -0
  539. package/linthost/engine_respects_block_disable_enable_test.go +48 -0
  540. package/linthost/engine_respects_eslint_disable_line_test.go +45 -0
  541. package/linthost/engine_respects_eslint_disable_next_line_test.go +48 -0
  542. package/linthost/engine_respects_lint_disable_next_line_alias_test.go +46 -0
  543. package/linthost/engine_run_parallel_matches_serial_finding_set_test.go +86 -0
  544. package/linthost/engine_runs_format_rules_on_declaration_files_test.go +37 -0
  545. package/linthost/engine_runs_opt_in_rules_on_declaration_files_test.go +39 -0
  546. package/linthost/engine_skips_off_rules_test.go +41 -0
  547. package/linthost/engine_skips_type_checker_for_ast_only_rule_test.go +35 -0
  548. package/linthost/engine_skips_value_rules_on_declaration_files_test.go +40 -0
  549. package/linthost/engine_softline_emits_newline_when_group_breaks_test.go +23 -0
  550. package/linthost/engine_softline_renders_empty_when_flat_test.go +22 -0
  551. package/linthost/engine_starting_indent_offsets_break_decision_test.go +29 -0
  552. package/linthost/engine_tab_width_defaults_when_zero_test.go +24 -0
  553. package/linthost/engine_text_renders_verbatim_test.go +29 -0
  554. package/linthost/engine_text_with_embedded_newline_forces_break_test.go +24 -0
  555. package/linthost/engine_use_tabs_emits_remainder_spaces_test.go +27 -0
  556. package/linthost/engine_use_tabs_emits_tab_characters_test.go +24 -0
  557. package/linthost/eqeqeq_offers_unsafe_operator_rewrite_as_suggestion_test.go +45 -0
  558. package/linthost/expect_matchers_without_argument_do_not_panic_test.go +50 -0
  559. package/linthost/file_path_from_uri_preserves_literal_percent_escapes_test.go +36 -0
  560. package/linthost/file_url_matches_node_shape_test.go +64 -0
  561. package/linthost/files_selector_scopes_rules_away_from_an_imported_sibling_test.go +70 -0
  562. package/linthost/filter_format_findings_keeps_only_format_rule_findings_test.go +56 -0
  563. package/linthost/filter_known_flags_preserves_known_values_and_skips_unknowns_test.go +49 -0
  564. package/linthost/filter_known_flags_resolves_names_case_insensitively_test.go +43 -0
  565. package/linthost/filter_lint_findings_drops_format_rule_findings_test.go +43 -0
  566. package/linthost/find_lint_config_file_discovers_nearest_ancestor_test.go +37 -0
  567. package/linthost/find_lint_config_file_discovers_plain_lint_config_test.go +37 -0
  568. package/linthost/find_lint_config_file_falls_back_to_cwd_for_out_of_tree_tsconfig_test.go +43 -0
  569. package/linthost/find_lint_config_file_prefers_nearest_directory_test.go +38 -0
  570. package/linthost/find_lint_config_file_rejects_same_directory_conflicts_test.go +38 -0
  571. package/linthost/find_lint_config_file_uses_tsconfig_directory_when_outside_cwd_test.go +45 -0
  572. package/linthost/find_lint_entry_accepts_sorted_check_plugin_payload_test.go +53 -0
  573. package/linthost/fix.go +37 -11
  574. package/linthost/fix_eqeqeq_replaces_same_type_literal_operator_test.go +26 -0
  575. package/linthost/fix_eqeqeq_replaces_typeof_operator_test.go +26 -0
  576. package/linthost/fix_eqeqeq_requires_both_operands_to_share_a_primitive_kind_test.go +29 -0
  577. package/linthost/fix_eqeqeq_skips_unsafe_identifier_comparison_test.go +25 -0
  578. package/linthost/fix_interleaved_import_type_and_bracket_spacing_stays_valid_test.go +113 -0
  579. package/linthost/fix_no_extra_bind_removes_safe_member_and_call_syntax_test.go +45 -0
  580. package/linthost/fix_no_extra_bind_skips_effectful_or_commented_removals_test.go +55 -0
  581. package/linthost/fix_no_extra_non_null_assertion_drops_trailing_bang_test.go +39 -0
  582. package/linthost/fix_no_import_type_side_effects_hoists_type_keyword_test.go +29 -0
  583. package/linthost/fix_no_import_type_side_effects_preserves_leading_comment_test.go +30 -0
  584. package/linthost/fix_no_import_type_side_effects_skips_comment_import_keyword_test.go +31 -0
  585. package/linthost/fix_no_import_type_side_effects_skips_mixed_import_test.go +28 -0
  586. package/linthost/fix_no_unnecessary_type_constraint_disambiguates_cts_generic_arrow_test.go +20 -0
  587. package/linthost/fix_no_unnecessary_type_constraint_disambiguates_mts_generic_arrow_test.go +20 -0
  588. package/linthost/fix_no_unnecessary_type_constraint_disambiguates_tsx_generic_arrow_test.go +20 -0
  589. package/linthost/fix_no_unnecessary_type_constraint_drops_extends_clause_test.go +28 -0
  590. package/linthost/fix_no_unnecessary_type_constraint_keeps_default_unambiguous_test.go +20 -0
  591. package/linthost/fix_no_unnecessary_type_constraint_keeps_multiple_parameters_unambiguous_test.go +20 -0
  592. package/linthost/fix_no_unnecessary_type_constraint_keeps_non_arrow_declarations_minimal_test.go +28 -0
  593. package/linthost/fix_no_unnecessary_type_constraint_keeps_ts_generic_arrow_minimal_test.go +20 -0
  594. package/linthost/fix_no_unnecessary_type_constraint_preserves_comma_comments_test.go +22 -0
  595. package/linthost/fix_no_unnecessary_type_constraint_preserves_existing_trailing_comma_test.go +20 -0
  596. package/linthost/fix_no_useless_escape_drops_backslash_test.go +28 -0
  597. package/linthost/fix_no_useless_escape_drops_nondigit_neighbors_of_octal_exemption_test.go +31 -0
  598. package/linthost/fix_no_useless_escape_skips_backslash_digit_escapes_test.go +48 -0
  599. package/linthost/fix_no_useless_escape_skips_tagged_template_test.go +29 -0
  600. package/linthost/fix_no_useless_escape_skips_template_substitution_escape_test.go +45 -0
  601. package/linthost/fix_no_useless_rename_drops_rename_tail_test.go +39 -0
  602. package/linthost/fix_no_useless_rename_skips_string_literal_alias_test.go +34 -0
  603. package/linthost/fix_no_var_fixes_despite_label_before_test.go +30 -0
  604. package/linthost/fix_no_var_fixes_despite_member_name_before_test.go +29 -0
  605. package/linthost/fix_no_var_fixes_despite_object_key_before_test.go +30 -0
  606. package/linthost/fix_no_var_fixes_despite_type_reference_before_test.go +32 -0
  607. package/linthost/fix_no_var_keeps_bindings_observable_by_direct_eval_test.go +41 -0
  608. package/linthost/fix_no_var_preserves_script_global_object_bindings_test.go +30 -0
  609. package/linthost/fix_no_var_replaces_closure_reference_without_loop_test.go +30 -0
  610. package/linthost/fix_no_var_replaces_for_header_binding_test.go +31 -0
  611. package/linthost/fix_no_var_replaces_for_in_header_binding_test.go +31 -0
  612. package/linthost/fix_no_var_replaces_for_of_header_binding_test.go +31 -0
  613. package/linthost/fix_no_var_replaces_loop_local_without_closure_test.go +30 -0
  614. package/linthost/fix_no_var_replaces_namespace_block_binding_test.go +28 -0
  615. package/linthost/fix_no_var_replaces_reassigned_binding_test.go +30 -0
  616. package/linthost/fix_no_var_replaces_reference_in_nested_block_test.go +30 -0
  617. package/linthost/fix_no_var_replaces_reference_inside_with_body_test.go +30 -0
  618. package/linthost/fix_no_var_replaces_same_block_references_test.go +30 -0
  619. package/linthost/fix_no_var_replaces_same_case_clause_references_test.go +30 -0
  620. package/linthost/fix_no_var_replaces_unique_binding_test.go +30 -0
  621. package/linthost/fix_no_var_replaces_var_keyword_test.go +28 -0
  622. package/linthost/fix_no_var_skips_block_scope_escape_test.go +37 -0
  623. package/linthost/fix_no_var_skips_catch_binding_redeclaration_test.go +36 -0
  624. package/linthost/fix_no_var_skips_class_field_capture_in_loop_test.go +38 -0
  625. package/linthost/fix_no_var_skips_cross_case_reference_test.go +36 -0
  626. package/linthost/fix_no_var_skips_cross_scope_same_name_over_decline_test.go +36 -0
  627. package/linthost/fix_no_var_skips_deferred_self_reference_in_init_test.go +45 -0
  628. package/linthost/fix_no_var_skips_direct_self_reference_in_init_test.go +37 -0
  629. package/linthost/fix_no_var_skips_for_header_closure_capture_test.go +38 -0
  630. package/linthost/fix_no_var_skips_for_header_multi_declarator_test.go +32 -0
  631. package/linthost/fix_no_var_skips_for_header_redeclaration_test.go +36 -0
  632. package/linthost/fix_no_var_skips_for_header_use_after_loop_test.go +37 -0
  633. package/linthost/fix_no_var_skips_for_in_annex_b_initializer_test.go +33 -0
  634. package/linthost/fix_no_var_skips_for_in_header_expression_self_reference_test.go +37 -0
  635. package/linthost/fix_no_var_skips_for_of_destructuring_header_test.go +32 -0
  636. package/linthost/fix_no_var_skips_for_of_header_closure_capture_test.go +38 -0
  637. package/linthost/fix_no_var_skips_for_of_header_expression_self_reference_test.go +36 -0
  638. package/linthost/fix_no_var_skips_function_declaration_redeclaration_test.go +39 -0
  639. package/linthost/fix_no_var_skips_function_scope_escape_test.go +28 -0
  640. package/linthost/fix_no_var_skips_iife_self_reference_in_init_test.go +39 -0
  641. package/linthost/fix_no_var_skips_let_as_binding_name_test.go +32 -0
  642. package/linthost/fix_no_var_skips_loop_closure_capture_test.go +37 -0
  643. package/linthost/fix_no_var_skips_mixed_destructure_redeclaration_test.go +38 -0
  644. package/linthost/fix_no_var_skips_mixed_destructure_use_before_test.go +36 -0
  645. package/linthost/fix_no_var_skips_parameter_redeclaration_test.go +28 -0
  646. package/linthost/fix_no_var_skips_redeclaration_test.go +37 -0
  647. package/linthost/fix_no_var_skips_shorthand_value_before_test.go +37 -0
  648. package/linthost/fix_no_var_skips_single_statement_position_test.go +33 -0
  649. package/linthost/fix_no_var_skips_typeof_self_reference_in_init_test.go +38 -0
  650. package/linthost/fix_no_var_skips_use_before_declaration_test.go +36 -0
  651. package/linthost/fix_no_var_skips_use_before_for_header_test.go +36 -0
  652. package/linthost/fix_no_var_skips_while_loop_closure_capture_test.go +35 -0
  653. package/linthost/fix_no_var_skips_with_statement_body_test.go +35 -0
  654. package/linthost/fix_no_wrapper_object_types_replaces_typename_test.go +28 -0
  655. package/linthost/fix_no_wrapper_object_types_replaces_unshadowed_const_test.go +30 -0
  656. package/linthost/fix_no_wrapper_object_types_skips_function_shadow_test.go +27 -0
  657. package/linthost/fix_no_wrapper_object_types_skips_import_equals_shadow_test.go +26 -0
  658. package/linthost/fix_no_wrapper_object_types_skips_imported_name_test.go +26 -0
  659. package/linthost/fix_no_wrapper_object_types_skips_user_shadowed_name_test.go +27 -0
  660. package/linthost/fix_object_shorthand_drops_value_tail_test.go +28 -0
  661. package/linthost/fix_object_shorthand_preserves_the_prototype_setter_test.go +28 -0
  662. package/linthost/fix_prefer_as_const_preserves_comment_before_literal_type_test.go +27 -0
  663. package/linthost/fix_prefer_as_const_replaces_angle_bracket_type_with_const_test.go +27 -0
  664. package/linthost/fix_prefer_as_const_replaces_literal_type_with_const_test.go +27 -0
  665. package/linthost/fix_prefer_as_const_replaces_parenthesized_literal_assertion_test.go +28 -0
  666. package/linthost/fix_prefer_as_const_replaces_parenthesized_literal_type_test.go +28 -0
  667. package/linthost/fix_prefer_as_const_skips_null_literal_assertion_test.go +26 -0
  668. package/linthost/fix_prefer_as_const_skips_property_annotation_rewrite_test.go +27 -0
  669. package/linthost/fix_prefer_as_const_skips_template_literal_assertion_test.go +28 -0
  670. package/linthost/fix_prefer_as_const_skips_variable_annotation_rewrite_test.go +27 -0
  671. package/linthost/fix_prefer_const_counts_nested_write_in_shorthand_default_test.go +25 -0
  672. package/linthost/fix_prefer_const_keeps_nonlocal_rewrites_diagnostic_only_test.go +54 -0
  673. package/linthost/fix_prefer_const_preserves_assertion_wrapped_assignment_targets_test.go +68 -0
  674. package/linthost/fix_prefer_const_replaces_let_with_fresh_for_of_binding_test.go +29 -0
  675. package/linthost/fix_prefer_const_replaces_single_let_keyword_test.go +26 -0
  676. package/linthost/fix_prefer_const_replaces_wholly_stable_destructuring_keyword_test.go +26 -0
  677. package/linthost/fix_prefer_const_skips_destructuring_assignment_targets_test.go +42 -0
  678. package/linthost/fix_prefer_const_skips_for_in_reassignment_test.go +28 -0
  679. package/linthost/fix_prefer_const_skips_for_of_reassignment_test.go +29 -0
  680. package/linthost/fix_prefer_const_skips_multi_declaration_list_test.go +32 -0
  681. package/linthost/fix_prefer_namespace_keyword_replaces_module_keyword_test.go +29 -0
  682. package/linthost/fix_regexp_no_useless_flag_deletes_the_flag_it_named_test.go +74 -0
  683. package/linthost/fix_regexp_no_useless_quantifier_drops_exactly_one_repeat_test.go +57 -0
  684. package/linthost/fix_regexp_no_useless_two_nums_quantifier_collapses_equal_bounds_test.go +50 -0
  685. package/linthost/fix_regexp_no_zero_quantifier_stays_diagnostic_only_test.go +39 -0
  686. package/linthost/fix_regexp_prefer_d_replaces_spelled_out_digit_class_test.go +49 -0
  687. package/linthost/fix_regexp_prefer_plus_quantifier_replaces_open_ended_one_test.go +45 -0
  688. package/linthost/fix_regexp_prefer_question_quantifier_replaces_zero_to_one_test.go +43 -0
  689. package/linthost/fix_regexp_prefer_star_quantifier_replaces_open_ended_zero_test.go +43 -0
  690. package/linthost/fix_regexp_prefer_w_replaces_spelled_out_word_class_test.go +46 -0
  691. package/linthost/fix_regexp_require_unicode_regexp_offers_u_and_v_suggestions_test.go +71 -0
  692. package/linthost/fix_regexp_require_unicode_sets_regexp_offers_the_v_flag_test.go +76 -0
  693. package/linthost/fix_regexp_sort_flags_rewrites_flag_run_in_canonical_order_test.go +48 -0
  694. package/linthost/fix_regexp_withholds_a_rewrite_the_regex_parser_rejects_test.go +62 -0
  695. package/linthost/fix_security_detect_new_buffer_offers_three_successors_test.go +93 -0
  696. package/linthost/fix_security_detect_pseudo_random_bytes_proves_automatic_rename_test.go +95 -0
  697. package/linthost/fix_select_text_edit_groups_collapses_duplicate_edit_within_finding_test.go +42 -0
  698. package/linthost/fix_select_text_edit_groups_drops_partially_overlapped_finding_whole_test.go +43 -0
  699. package/linthost/fix_select_text_edit_groups_drops_self_overlapping_finding_test.go +32 -0
  700. package/linthost/fix_select_text_edit_groups_keeps_disjoint_multi_edit_finding_whole_test.go +41 -0
  701. package/linthost/fix_select_text_edits_drops_coincident_zero_width_insert_test.go +57 -0
  702. package/linthost/fix_select_text_edits_drops_duplicate_edits_test.go +38 -0
  703. package/linthost/fix_select_text_edits_drops_overlapping_ranges_test.go +32 -0
  704. package/linthost/fix_solid_imports_rewrites_sole_specifier_module_test.go +65 -0
  705. package/linthost/fix_solid_no_react_specific_props_renames_react_props_test.go +66 -0
  706. package/linthost/fix_storybook_no_renderer_packages_offers_framework_packages_test.go +95 -0
  707. package/linthost/fix_tsx_grammar_keeps_jsx_while_rewriting_var_and_let_test.go +36 -0
  708. package/linthost/flags_gen.go +2 -2
  709. package/linthost/for_direction_honors_a_negated_compound_step_test.go +37 -0
  710. package/linthost/format.go +14 -4
  711. package/linthost/format_arrow_parens_abstains_on_comment_near_trailing_comma_test.go +68 -0
  712. package/linthost/format_arrow_parens_abstains_on_param_comment_test.go +44 -0
  713. package/linthost/format_arrow_parens_avoid_keeps_return_type_parens_test.go +24 -0
  714. package/linthost/format_arrow_parens_avoid_keeps_type_parameter_parens_test.go +23 -0
  715. package/linthost/format_arrow_parens_idempotent_on_wrapped_test.go +24 -0
  716. package/linthost/format_arrow_parens_keeps_destructured_param_under_avoid_test.go +24 -0
  717. package/linthost/format_arrow_parens_keeps_ineligible_trailing_comma_params_test.go +66 -0
  718. package/linthost/format_arrow_parens_keeps_trailing_comma_param_under_always_test.go +48 -0
  719. package/linthost/format_arrow_parens_keeps_typed_param_under_avoid_test.go +24 -0
  720. package/linthost/format_arrow_parens_strips_async_single_param_test.go +26 -0
  721. package/linthost/format_arrow_parens_strips_single_param_under_avoid_test.go +24 -0
  722. package/linthost/format_arrow_parens_strips_trailing_comma_param_under_avoid_test.go +51 -0
  723. package/linthost/format_arrow_parens_strips_wrapped_param_before_list_comma_test.go +32 -0
  724. package/linthost/format_arrow_parens_wraps_bare_single_param_test.go +25 -0
  725. package/linthost/format_block_absent_keeps_format_rules_off_test.go +42 -0
  726. package/linthost/format_block_default_severity_off_keeps_format_rules_out_of_check_test.go +48 -0
  727. package/linthost/format_block_drops_format_rule_in_rules_map_test.go +45 -0
  728. package/linthost/format_block_expands_nil_raw_to_empty_map_test.go +32 -0
  729. package/linthost/format_block_jsdoc_false_skips_rule_test.go +37 -0
  730. package/linthost/format_block_propagates_jsdoc_sort_tags_option_test.go +59 -0
  731. package/linthost/format_block_propagates_prettier_options_to_rule_test.go +159 -0
  732. package/linthost/format_block_propagates_sort_imports_options_test.go +70 -0
  733. package/linthost/format_block_rejects_empty_sort_imports_order_test.go +37 -0
  734. package/linthost/format_block_rejects_invalid_jsdoc_options_test.go +68 -0
  735. package/linthost/format_block_rejects_invalid_severity_test.go +33 -0
  736. package/linthost/format_block_rejects_invalid_trailing_comma_value_test.go +36 -0
  737. package/linthost/format_block_rejects_non_array_sort_imports_order_test.go +32 -0
  738. package/linthost/format_block_rejects_non_bool_or_object_jsdoc_test.go +36 -0
  739. package/linthost/format_block_rejects_non_bool_or_object_sort_imports_test.go +30 -0
  740. package/linthost/format_block_rejects_non_bool_semi_test.go +32 -0
  741. package/linthost/format_block_rejects_non_bool_single_quote_test.go +31 -0
  742. package/linthost/format_block_rejects_non_bool_sort_imports_options_test.go +45 -0
  743. package/linthost/format_block_rejects_non_bool_use_tabs_test.go +31 -0
  744. package/linthost/format_block_rejects_non_int_print_width_test.go +31 -0
  745. package/linthost/format_block_rejects_non_int_tab_width_test.go +32 -0
  746. package/linthost/format_block_rejects_non_string_end_of_line_test.go +48 -0
  747. package/linthost/format_block_rejects_non_string_trailing_comma_test.go +32 -0
  748. package/linthost/format_block_rejects_unknown_key_test.go +39 -0
  749. package/linthost/format_block_rejects_unknown_sort_imports_key_test.go +36 -0
  750. package/linthost/format_block_severity_warning_enables_check_diagnostics_test.go +48 -0
  751. package/linthost/format_block_sort_imports_false_keeps_rule_off_test.go +27 -0
  752. package/linthost/format_block_sort_imports_true_enables_defaults_test.go +37 -0
  753. package/linthost/format_block_targets_option_accepting_rules_test.go +90 -0
  754. package/linthost/format_block_threads_end_of_line_into_sort_imports_test.go +55 -0
  755. package/linthost/format_block_wins_over_vscode_settings_test.go +36 -0
  756. package/linthost/format_brace_continuation_corrects_a_pushed_keyword_at_the_wrong_column_test.go +28 -0
  757. package/linthost/format_brace_continuation_honors_crlf_end_of_line_test.go +29 -0
  758. package/linthost/format_brace_continuation_indents_a_pushed_keyword_to_its_statement_test.go +27 -0
  759. package/linthost/format_brace_continuation_is_idempotent_in_both_directions_test.go +32 -0
  760. package/linthost/format_brace_continuation_leaves_an_if_without_an_else_alone_test.go +23 -0
  761. package/linthost/format_brace_continuation_normalizes_a_zero_width_gap_test.go +27 -0
  762. package/linthost/format_brace_continuation_pulls_catch_and_finally_onto_their_braces_test.go +28 -0
  763. package/linthost/format_brace_continuation_pulls_do_while_onto_the_closing_brace_test.go +27 -0
  764. package/linthost/format_brace_continuation_pulls_else_onto_the_closing_brace_test.go +27 -0
  765. package/linthost/format_brace_continuation_pulls_finally_onto_a_try_without_a_catch_test.go +28 -0
  766. package/linthost/format_brace_continuation_pushes_a_do_while_off_a_statement_body_test.go +28 -0
  767. package/linthost/format_brace_continuation_pushes_else_off_a_statement_consequent_test.go +28 -0
  768. package/linthost/format_brace_continuation_pushes_past_a_brace_terminated_non_block_test.go +28 -0
  769. package/linthost/format_brace_continuation_pushes_past_a_label_prefix_test.go +48 -0
  770. package/linthost/format_brace_continuation_settles_a_shared_line_through_the_cascade_test.go +44 -0
  771. package/linthost/format_brace_continuation_skips_a_commented_gap_test.go +28 -0
  772. package/linthost/format_brace_continuation_waits_for_a_statement_to_own_its_line_test.go +27 -0
  773. package/linthost/format_bracket_spacing_idempotent_on_padded_test.go +23 -0
  774. package/linthost/format_bracket_spacing_leaves_a_prettier_shaped_type_literal_alone_test.go +27 -0
  775. package/linthost/format_bracket_spacing_leaves_empty_object_test.go +74 -0
  776. package/linthost/format_bracket_spacing_pads_an_unspaced_type_literal_test.go +29 -0
  777. package/linthost/format_bracket_spacing_pads_destructure_test.go +24 -0
  778. package/linthost/format_bracket_spacing_pads_import_attributes_test.go +28 -0
  779. package/linthost/format_bracket_spacing_pads_mapped_type_test.go +27 -0
  780. package/linthost/format_bracket_spacing_pads_named_imports_test.go +24 -0
  781. package/linthost/format_bracket_spacing_pads_object_literal_test.go +26 -0
  782. package/linthost/format_bracket_spacing_strips_object_literal_under_false_test.go +26 -0
  783. package/linthost/format_clause_join_charges_the_else_width_budget_at_its_limit_test.go +37 -0
  784. package/linthost/format_clause_join_charges_the_shift_to_the_header_lines_indent_test.go +45 -0
  785. package/linthost/format_clause_join_emits_no_shift_when_the_column_is_unchanged_test.go +50 -0
  786. package/linthost/format_clause_join_hoists_across_a_multiline_template_without_moving_it_test.go +30 -0
  787. package/linthost/format_clause_join_idempotent_on_joined_body_test.go +27 -0
  788. package/linthost/format_clause_join_joins_do_body_test.go +27 -0
  789. package/linthost/format_clause_join_joins_else_body_test.go +27 -0
  790. package/linthost/format_clause_join_joins_else_if_chain_across_lines_test.go +44 -0
  791. package/linthost/format_clause_join_joins_for_and_while_bodies_test.go +32 -0
  792. package/linthost/format_clause_join_joins_labeled_block_body_test.go +31 -0
  793. package/linthost/format_clause_join_joins_single_if_body_test.go +28 -0
  794. package/linthost/format_clause_join_joins_with_body_test.go +27 -0
  795. package/linthost/format_clause_join_keeps_a_blank_line_inside_a_hoisted_body_test.go +45 -0
  796. package/linthost/format_clause_join_keeps_overlong_body_broken_test.go +31 -0
  797. package/linthost/format_clause_join_leaves_a_block_comment_interior_untouched_test.go +45 -0
  798. package/linthost/format_clause_join_leaves_a_string_continuation_untouched_test.go +45 -0
  799. package/linthost/format_clause_join_leaves_a_template_literal_type_untouched_test.go +49 -0
  800. package/linthost/format_clause_join_reindents_a_hoisted_body_inside_a_function_test.go +43 -0
  801. package/linthost/format_clause_join_reindents_a_hoisted_else_if_chain_test.go +45 -0
  802. package/linthost/format_clause_join_reindents_a_hoisted_labeled_block_test.go +27 -0
  803. package/linthost/format_clause_join_reindents_an_indentable_block_comment_test.go +50 -0
  804. package/linthost/format_clause_join_settles_a_deep_staircase_within_the_cascade_budget_test.go +44 -0
  805. package/linthost/format_clause_join_shifts_a_tab_indented_body_with_tabs_test.go +44 -0
  806. package/linthost/format_clause_join_skips_braced_body_test.go +31 -0
  807. package/linthost/format_clause_join_skips_braced_else_and_do_bodies_test.go +38 -0
  808. package/linthost/format_clause_join_skips_commented_else_gap_test.go +29 -0
  809. package/linthost/format_clause_join_skips_empty_else_and_do_bodies_test.go +33 -0
  810. package/linthost/format_clause_join_skips_empty_statement_body_test.go +36 -0
  811. package/linthost/format_command_resolver_keeps_configured_options_inside_matching_entry_test.go +64 -0
  812. package/linthost/format_command_resolver_skips_upgrade_for_entry_ignored_file_test.go +60 -0
  813. package/linthost/format_command_resolver_skips_upgrade_for_file_outside_entry_files_test.go +61 -0
  814. package/linthost/format_command_resolver_variants_replace_bare_options_with_reachable_defaults_test.go +34 -0
  815. package/linthost/format_declaration_header_abstains_on_comment_in_header_test.go +25 -0
  816. package/linthost/format_declaration_header_abstains_on_type_params_with_multi_clause_test.go +27 -0
  817. package/linthost/format_declaration_header_breaks_empty_body_at_width_boundary_test.go +32 -0
  818. package/linthost/format_declaration_header_breaks_generic_heritage_type_args_test.go +28 -0
  819. package/linthost/format_declaration_header_breaks_multi_type_interface_test.go +29 -0
  820. package/linthost/format_declaration_header_breaks_multiple_clauses_test.go +25 -0
  821. package/linthost/format_declaration_header_breaks_single_type_clause_in_multi_clause_test.go +73 -0
  822. package/linthost/format_declaration_header_breaks_type_param_default_after_equals_test.go +29 -0
  823. package/linthost/format_declaration_header_collapses_fitting_header_test.go +29 -0
  824. package/linthost/format_declaration_header_drops_brace_for_class_body_test.go +28 -0
  825. package/linthost/format_declaration_header_explodes_and_drops_brace_for_class_body_test.go +27 -0
  826. package/linthost/format_declaration_header_explodes_type_parameters_test.go +26 -0
  827. package/linthost/format_declaration_header_generic_heritage_honors_crlf_end_of_line_test.go +32 -0
  828. package/linthost/format_declaration_header_glues_brace_for_empty_body_test.go +27 -0
  829. package/linthost/format_declaration_header_idempotent_on_broken_clauses_test.go +24 -0
  830. package/linthost/format_declaration_header_idempotent_on_broken_heritage_type_args_test.go +25 -0
  831. package/linthost/format_declaration_header_idempotent_on_exploded_class_body_test.go +25 -0
  832. package/linthost/format_declaration_header_keeps_multi_type_inline_after_break_test.go +30 -0
  833. package/linthost/format_declaration_header_keeps_single_generic_heritage_arg_inline_test.go +25 -0
  834. package/linthost/format_declaration_header_keeps_single_heritage_type_inline_test.go +26 -0
  835. package/linthost/format_declaration_header_multi_clause_honors_crlf_end_of_line_test.go +30 -0
  836. package/linthost/format_declaration_header_multi_type_honors_crlf_end_of_line_test.go +30 -0
  837. package/linthost/format_declaration_header_type_param_explode_honors_crlf_end_of_line_test.go +32 -0
  838. package/linthost/format_defaults_apply_without_format_config_test.go +46 -0
  839. package/linthost/format_indent_case_block_body_matches_case_depth_test.go +30 -0
  840. package/linthost/format_indent_cedes_body_under_multiline_arrow_head_test.go +39 -0
  841. package/linthost/format_indent_cedes_callback_argument_body_test.go +31 -0
  842. package/linthost/format_indent_defers_shared_line_to_statement_split_test.go +32 -0
  843. package/linthost/format_indent_honors_custom_tab_width_test.go +28 -0
  844. package/linthost/format_indent_honors_use_tabs_option_test.go +28 -0
  845. package/linthost/format_indent_idempotent_on_correct_class_body_test.go +27 -0
  846. package/linthost/format_indent_idempotent_on_correct_nested_block_test.go +26 -0
  847. package/linthost/format_indent_idempotent_on_decorated_member_test.go +29 -0
  848. package/linthost/format_indent_normalizes_class_method_body_depth_test.go +29 -0
  849. package/linthost/format_indent_normalizes_decorated_member_declaration_line_test.go +31 -0
  850. package/linthost/format_indent_normalizes_multiple_decorator_lines_test.go +30 -0
  851. package/linthost/format_indent_normalizes_over_indented_block_statement_test.go +27 -0
  852. package/linthost/format_indent_normalizes_plain_member_header_test.go +29 -0
  853. package/linthost/format_indent_normalizes_same_line_decorated_member_test.go +49 -0
  854. package/linthost/format_indent_normalizes_switch_case_body_depth_test.go +29 -0
  855. package/linthost/format_indent_still_fixes_single_line_head_arrow_body_test.go +27 -0
  856. package/linthost/format_indent_strips_leading_indent_from_top_level_statement_test.go +27 -0
  857. package/linthost/format_jsdoc_honors_custom_tag_synonyms_option_test.go +26 -0
  858. package/linthost/format_jsdoc_preserves_example_block_body_test.go +63 -0
  859. package/linthost/format_jsdoc_rejects_malformed_tag_synonym_value_test.go +60 -0
  860. package/linthost/format_jsdoc_rewrites_arg_synonyms_to_param_test.go +25 -0
  861. package/linthost/format_jsdoc_rewrites_return_to_returns_test.go +24 -0
  862. package/linthost/format_jsdoc_skips_canonical_tags_test.go +32 -0
  863. package/linthost/format_jsdoc_skips_inline_at_text_test.go +34 -0
  864. package/linthost/format_jsdoc_skips_jsdoc_like_strings_in_source_test.go +41 -0
  865. package/linthost/format_orphan_semi_inert_under_semi_true_test.go +24 -0
  866. package/linthost/format_orphan_semi_merges_guard_under_no_semi_test.go +35 -0
  867. package/linthost/format_orphan_semi_skips_comment_between_guard_and_statement_test.go +28 -0
  868. package/linthost/format_orphan_semi_skips_non_hazard_successor_test.go +29 -0
  869. package/linthost/format_parameter_properties_breaks_multi_param_constructor_test.go +30 -0
  870. package/linthost/format_parameter_properties_breaks_override_only_constructor_test.go +31 -0
  871. package/linthost/format_parameter_properties_honors_crlf_end_of_line_test.go +29 -0
  872. package/linthost/format_parameter_properties_idempotent_on_broken_list_test.go +28 -0
  873. package/linthost/format_parameter_properties_ignores_decorated_plain_params_test.go +31 -0
  874. package/linthost/format_parameter_properties_ignores_plain_params_test.go +27 -0
  875. package/linthost/format_parameter_properties_keeps_single_param_inline_test.go +30 -0
  876. package/linthost/format_prettier_conformance_e2e_test.go +367 -0
  877. package/linthost/format_print_width_abstains_inside_jsx_expression_test.go +50 -0
  878. package/linthost/format_print_width_abstains_inside_template_substitution_test.go +31 -0
  879. package/linthost/format_print_width_abstains_when_callback_body_holds_uncovered_statement_test.go +37 -0
  880. package/linthost/format_print_width_abstains_when_inter_member_comment_present_test.go +32 -0
  881. package/linthost/format_print_width_abstains_when_trailing_block_comment_before_close_bracket_test.go +35 -0
  882. package/linthost/format_print_width_breaks_array_rest_assignment_target_without_comma_test.go +31 -0
  883. package/linthost/format_print_width_breaks_call_when_trailing_semicolon_overflows_test.go +26 -0
  884. package/linthost/format_print_width_breaks_default_plus_named_import_shape_test.go +29 -0
  885. package/linthost/format_print_width_breaks_long_call_arguments_test.go +31 -0
  886. package/linthost/format_print_width_breaks_long_named_exports_test.go +30 -0
  887. package/linthost/format_print_width_breaks_long_named_imports_test.go +30 -0
  888. package/linthost/format_print_width_breaks_long_new_expression_arguments_test.go +31 -0
  889. package/linthost/format_print_width_breaks_long_object_literal_test.go +27 -0
  890. package/linthost/format_print_width_breaks_overflowing_react_hook_deps_array_test.go +29 -0
  891. package/linthost/format_print_width_check_abstains_when_ctx_is_nil_test.go +24 -0
  892. package/linthost/format_print_width_check_abstains_when_node_is_nil_test.go +48 -0
  893. package/linthost/format_print_width_check_abstains_when_node_range_exceeds_context_source_test.go +71 -0
  894. package/linthost/format_print_width_declines_last_arg_hug_after_arrow_lead_test.go +29 -0
  895. package/linthost/format_print_width_declines_last_arg_hug_after_callback_test.go +28 -0
  896. package/linthost/format_print_width_default_width_is_80_columns_test.go +31 -0
  897. package/linthost/format_print_width_explodes_call_when_hugged_header_overflows_test.go +26 -0
  898. package/linthost/format_print_width_hangs_broken_ternary_arm_under_arm_column_test.go +40 -0
  899. package/linthost/format_print_width_has_non_child_comments_returns_false_when_node_is_nil_test.go +46 -0
  900. package/linthost/format_print_width_has_reflow_ancestor_returns_false_when_node_is_nil_test.go +40 -0
  901. package/linthost/format_print_width_honors_crlf_end_of_line_test.go +30 -0
  902. package/linthost/format_print_width_honors_custom_tab_width_test.go +27 -0
  903. package/linthost/format_print_width_honors_tab_leading_source_test.go +27 -0
  904. package/linthost/format_print_width_honors_use_tabs_option_test.go +25 -0
  905. package/linthost/format_print_width_hugs_arrow_with_object_body_test.go +32 -0
  906. package/linthost/format_print_width_hugs_first_callback_argument_test.go +31 -0
  907. package/linthost/format_print_width_hugs_first_callback_with_array_arg_test.go +27 -0
  908. package/linthost/format_print_width_hugs_object_argument_despite_long_trailing_suffix_test.go +32 -0
  909. package/linthost/format_print_width_idempotent_on_already_reflowed_input_test.go +26 -0
  910. package/linthost/format_print_width_idempotent_on_first_hugged_call_test.go +25 -0
  911. package/linthost/format_print_width_idempotent_on_hugged_callback_call_test.go +25 -0
  912. package/linthost/format_print_width_idempotent_on_nested_ternary_staircase_test.go +25 -0
  913. package/linthost/format_print_width_indents_nested_alternate_ternary_test.go +30 -0
  914. package/linthost/format_print_width_indents_nested_consequent_ternary_test.go +30 -0
  915. package/linthost/format_print_width_indents_relative_to_line_leading_indent_test.go +42 -0
  916. package/linthost/format_print_width_inserts_after_non_rest_object_assignment_target_test.go +30 -0
  917. package/linthost/format_print_width_inserts_after_object_spread_in_value_literal_test.go +30 -0
  918. package/linthost/format_print_width_keeps_call_with_trailing_line_comment_inline_test.go +24 -0
  919. package/linthost/format_print_width_keeps_empty_array_literal_flat_test.go +25 -0
  920. package/linthost/format_print_width_keeps_empty_object_literal_flat_test.go +28 -0
  921. package/linthost/format_print_width_keeps_nested_object_that_fits_test.go +24 -0
  922. package/linthost/format_print_width_keeps_object_rest_assignment_target_without_comma_test.go +29 -0
  923. package/linthost/format_print_width_keeps_react_hook_hugged_past_open_line_test.go +26 -0
  924. package/linthost/format_print_width_keeps_short_call_with_callback_hugged_test.go +32 -0
  925. package/linthost/format_print_width_keeps_short_ternary_flat_test.go +27 -0
  926. package/linthost/format_print_width_leading_column_returns_zero_when_pos_is_nonpositive_test.go +51 -0
  927. package/linthost/format_print_width_line_leading_indent_uses_two_when_tab_width_nonpositive_test.go +47 -0
  928. package/linthost/format_print_width_max_line_width_uses_two_when_tab_width_nonpositive_test.go +47 -0
  929. package/linthost/format_print_width_preserves_blank_line_in_reflowed_callback_body_test.go +29 -0
  930. package/linthost/format_print_width_preserves_call_type_arguments_test.go +32 -0
  931. package/linthost/format_print_width_preserves_leading_jsdoc_above_reflowed_node_test.go +44 -0
  932. package/linthost/format_print_width_preserves_multiline_object_test.go +30 -0
  933. package/linthost/format_print_width_preserves_optional_call_token_test.go +32 -0
  934. package/linthost/format_print_width_preserves_terminator_decision_on_imports_test.go +42 -0
  935. package/linthost/format_print_width_reflows_call_with_nested_object_argument_test.go +33 -0
  936. package/linthost/format_print_width_reflows_wide_array_with_slash_strings_test.go +34 -0
  937. package/linthost/format_print_width_reindents_callback_body_inside_indented_block_test.go +33 -0
  938. package/linthost/format_print_width_skips_namespace_import_shape_test.go +28 -0
  939. package/linthost/format_print_width_skips_nested_target_when_ancestor_covers_it_test.go +58 -0
  940. package/linthost/format_print_width_skips_short_object_literal_test.go +29 -0
  941. package/linthost/format_print_width_slice_contains_newline_clamps_out_of_range_bounds_test.go +57 -0
  942. package/linthost/format_print_width_ternary_arm_indent_bonus_test.go +44 -0
  943. package/linthost/format_print_width_trailing_line_width_excludes_trailing_line_comment_test.go +38 -0
  944. package/linthost/format_print_width_trailing_line_width_handles_guards_and_tabs_test.go +51 -0
  945. package/linthost/format_quote_props_consistent_preserves_cooked_identifier_keys_test.go +37 -0
  946. package/linthost/format_quote_props_consistent_quotes_mixed_object_test.go +28 -0
  947. package/linthost/format_quote_props_consistent_unquotes_all_identifier_keys_test.go +24 -0
  948. package/linthost/format_quote_props_consistent_unquotes_proto_with_identifier_keys_test.go +21 -0
  949. package/linthost/format_quote_props_keeps_non_identifier_key_test.go +24 -0
  950. package/linthost/format_quote_props_keeps_numeric_key_test.go +20 -0
  951. package/linthost/format_quote_props_preserve_is_noop_test.go +23 -0
  952. package/linthost/format_quote_props_unquotes_class_method_test.go +30 -0
  953. package/linthost/format_quote_props_unquotes_identifier_keys_test.go +25 -0
  954. package/linthost/format_quote_props_unquotes_interface_member_test.go +28 -0
  955. package/linthost/format_quote_props_unquotes_proto_key_without_changing_setter_semantics_test.go +21 -0
  956. package/linthost/format_quote_props_unquotes_reserved_word_key_test.go +25 -0
  957. package/linthost/format_quote_props_unquotes_type_literal_member_test.go +28 -0
  958. package/linthost/format_quotes_converts_double_to_single_preserving_apostrophe_escape_test.go +23 -0
  959. package/linthost/format_quotes_converts_single_to_double_test.go +22 -0
  960. package/linthost/format_quotes_escapes_double_quote_when_converting_test.go +22 -0
  961. package/linthost/format_quotes_honors_prefer_single_option_test.go +27 -0
  962. package/linthost/format_quotes_keeps_double_on_escape_tie_test.go +29 -0
  963. package/linthost/format_quotes_keeps_double_with_redundant_single_escape_test.go +31 -0
  964. package/linthost/format_quotes_keeps_single_with_redundant_double_escape_test.go +31 -0
  965. package/linthost/format_quotes_preserves_strings_with_unescaped_double_quotes_test.go +34 -0
  966. package/linthost/format_quotes_skips_double_quoted_literals_test.go +24 -0
  967. package/linthost/format_quotes_skips_jsx_attribute_strings_test.go +44 -0
  968. package/linthost/format_quotes_skips_template_literals_test.go +38 -0
  969. package/linthost/format_quotes_switches_double_to_single_to_minimize_escapes_test.go +31 -0
  970. package/linthost/format_quotes_switches_single_to_double_to_minimize_escapes_test.go +22 -0
  971. package/linthost/format_quotes_unescapes_apostrophe_when_converting_test.go +30 -0
  972. package/linthost/format_reflow_preserves_import_default_gap_comment_test.go +29 -0
  973. package/linthost/format_reflow_preserves_import_type_gap_comment_test.go +29 -0
  974. package/linthost/format_reflow_preserves_nested_call_arg_comment_test.go +24 -0
  975. package/linthost/format_reflow_preserves_new_constructee_gap_comment_test.go +21 -0
  976. package/linthost/format_reflow_preserves_return_comment_test.go +24 -0
  977. package/linthost/format_reflow_preserves_ternary_paren_comment_test.go +26 -0
  978. package/linthost/format_semi_fires_for_every_asi_statement_kind_test.go +103 -0
  979. package/linthost/format_semi_honors_prefer_never_option_test.go +28 -0
  980. package/linthost/format_semi_idempotent_on_stripped_interface_test.go +28 -0
  981. package/linthost/format_semi_idempotent_on_terminated_members_test.go +38 -0
  982. package/linthost/format_semi_inserts_after_missing_terminator_test.go +28 -0
  983. package/linthost/format_semi_inserts_member_terminator_before_trailing_comment_test.go +29 -0
  984. package/linthost/format_semi_keeps_a_flat_mapped_type_bare_test.go +31 -0
  985. package/linthost/format_semi_keeps_a_flat_object_types_last_member_bare_test.go +36 -0
  986. package/linthost/format_semi_keeps_braced_and_object_literal_accessors_bare_test.go +40 -0
  987. package/linthost/format_semi_keeps_class_field_semi_before_computed_member_test.go +32 -0
  988. package/linthost/format_semi_keeps_object_literal_accessor_separators_untouched_test.go +49 -0
  989. package/linthost/format_semi_keeps_one_line_interface_body_bare_test.go +29 -0
  990. package/linthost/format_semi_keeps_same_line_type_member_separator_test.go +31 -0
  991. package/linthost/format_semi_keeps_type_member_semi_before_call_signature_test.go +32 -0
  992. package/linthost/format_semi_normalizes_a_comma_member_separator_test.go +39 -0
  993. package/linthost/format_semi_prefer_never_block_comment_is_not_hazard_test.go +49 -0
  994. package/linthost/format_semi_prefer_never_keeps_a_flat_object_types_separator_test.go +38 -0
  995. package/linthost/format_semi_prefer_never_keeps_do_while_separator_test.go +32 -0
  996. package/linthost/format_semi_prefer_never_keeps_same_line_else_separator_test.go +31 -0
  997. package/linthost/format_semi_prefer_never_keeps_same_line_statement_separator_test.go +29 -0
  998. package/linthost/format_semi_prefer_never_keeps_semi_before_asi_hazard_test.go +58 -0
  999. package/linthost/format_semi_prefer_never_keeps_semi_before_regex_hazard_test.go +51 -0
  1000. package/linthost/format_semi_prefer_never_keeps_semi_before_same_line_comment_gap_test.go +30 -0
  1001. package/linthost/format_semi_prefer_never_line_comment_is_not_hazard_test.go +49 -0
  1002. package/linthost/format_semi_prefer_never_normalizes_a_comma_it_must_keep_test.go +37 -0
  1003. package/linthost/format_semi_prefer_never_strips_a_comma_member_separator_test.go +32 -0
  1004. package/linthost/format_semi_prefer_never_strips_a_flat_object_types_trailing_separator_test.go +33 -0
  1005. package/linthost/format_semi_prefer_never_strips_a_mapped_type_terminator_test.go +35 -0
  1006. package/linthost/format_semi_prefer_never_strips_across_crlf_test.go +33 -0
  1007. package/linthost/format_semi_prefer_never_strips_across_multiline_comment_gap_test.go +32 -0
  1008. package/linthost/format_semi_prefer_never_strips_before_same_line_close_brace_test.go +31 -0
  1009. package/linthost/format_semi_prefer_never_strips_member_with_space_test.go +52 -0
  1010. package/linthost/format_semi_reads_a_mapped_types_wrap_at_its_opening_brace_test.go +34 -0
  1011. package/linthost/format_semi_skips_already_terminated_statements_test.go +31 -0
  1012. package/linthost/format_semi_strips_class_field_semicolons_test.go +29 -0
  1013. package/linthost/format_semi_strips_interface_member_semicolons_test.go +29 -0
  1014. package/linthost/format_semi_strips_type_alias_semicolon_test.go +29 -0
  1015. package/linthost/format_semi_terminates_a_broken_mapped_type_test.go +40 -0
  1016. package/linthost/format_semi_terminates_a_mapped_type_across_crlf_test.go +32 -0
  1017. package/linthost/format_semi_terminates_a_mapped_type_around_its_trailing_comment_test.go +37 -0
  1018. package/linthost/format_semi_terminates_a_mapped_type_without_a_type_annotation_test.go +37 -0
  1019. package/linthost/format_semi_terminates_a_member_across_crlf_test.go +31 -0
  1020. package/linthost/format_semi_terminates_a_member_whose_type_ends_in_a_brace_test.go +31 -0
  1021. package/linthost/format_semi_terminates_broken_interface_members_test.go +45 -0
  1022. package/linthost/format_semi_terminates_broken_type_literal_member_test.go +31 -0
  1023. package/linthost/format_semi_terminates_class_index_signature_and_ambient_accessor_test.go +29 -0
  1024. package/linthost/format_sort_imports_alphabetizes_named_specifiers_test.go +31 -0
  1025. package/linthost/format_sort_imports_combine_requires_unsafe_runtime_opt_in_test.go +30 -0
  1026. package/linthost/format_sort_imports_combines_type_and_value_test.go +27 -0
  1027. package/linthost/format_sort_imports_dedupes_repeated_specifier_test.go +28 -0
  1028. package/linthost/format_sort_imports_group_separator_honors_crlf_end_of_line_test.go +40 -0
  1029. package/linthost/format_sort_imports_groups_builtins_first_test.go +29 -0
  1030. package/linthost/format_sort_imports_groups_external_before_relative_test.go +35 -0
  1031. package/linthost/format_sort_imports_groups_type_only_imports_test.go +27 -0
  1032. package/linthost/format_sort_imports_honors_crlf_end_of_line_test.go +40 -0
  1033. package/linthost/format_sort_imports_honors_custom_import_order_test.go +88 -0
  1034. package/linthost/format_sort_imports_keeps_attribute_bearing_imports_unmerged_test.go +24 -0
  1035. package/linthost/format_sort_imports_keeps_commented_list_unmerged_test.go +26 -0
  1036. package/linthost/format_sort_imports_keeps_conflicting_defaults_separate_test.go +34 -0
  1037. package/linthost/format_sort_imports_keeps_default_gap_comment_unmerged_test.go +24 -0
  1038. package/linthost/format_sort_imports_keeps_default_only_gap_comment_unmerged_test.go +24 -0
  1039. package/linthost/format_sort_imports_keeps_empty_named_imports_test.go +31 -0
  1040. package/linthost/format_sort_imports_keeps_identical_commented_imports_unmerged_test.go +35 -0
  1041. package/linthost/format_sort_imports_keeps_identical_namespace_imports_unmerged_test.go +35 -0
  1042. package/linthost/format_sort_imports_keeps_namespace_imports_separate_test.go +34 -0
  1043. package/linthost/format_sort_imports_keeps_trailing_specifier_comment_unmerged_test.go +24 -0
  1044. package/linthost/format_sort_imports_keeps_type_and_value_separate_test.go +31 -0
  1045. package/linthost/format_sort_imports_keeps_type_default_and_type_named_separate_test.go +34 -0
  1046. package/linthost/format_sort_imports_keeps_type_default_and_type_named_separate_when_combining_test.go +34 -0
  1047. package/linthost/format_sort_imports_keeps_type_default_separate_when_combining_test.go +31 -0
  1048. package/linthost/format_sort_imports_merges_default_and_named_test.go +27 -0
  1049. package/linthost/format_sort_imports_merges_duplicate_modules_test.go +28 -0
  1050. package/linthost/format_sort_imports_merges_duplicate_type_only_imports_test.go +24 -0
  1051. package/linthost/format_sort_imports_merges_type_default_with_empty_named_test.go +28 -0
  1052. package/linthost/format_sort_imports_merges_type_named_binding_test.go +33 -0
  1053. package/linthost/format_sort_imports_orders_case_insensitively_by_default_test.go +29 -0
  1054. package/linthost/format_sort_imports_orders_case_sensitively_when_enabled_test.go +29 -0
  1055. package/linthost/format_sort_imports_preserves_comments_between_imports_test.go +43 -0
  1056. package/linthost/format_sort_imports_preserves_comments_between_specifiers_test.go +38 -0
  1057. package/linthost/format_sort_imports_preserves_side_effect_imports_test.go +55 -0
  1058. package/linthost/format_sort_imports_recognizes_exact_builtin_specifiers_test.go +56 -0
  1059. package/linthost/format_sort_imports_scopes_type_group_by_regex_test.go +32 -0
  1060. package/linthost/format_sort_imports_separator_spans_empty_group_test.go +31 -0
  1061. package/linthost/format_sort_imports_skips_already_sorted_files_test.go +40 -0
  1062. package/linthost/format_sort_imports_skips_invalid_regex_group_test.go +30 -0
  1063. package/linthost/format_sort_imports_skips_invalid_types_regex_group_test.go +28 -0
  1064. package/linthost/format_sort_imports_skips_single_import_files_test.go +38 -0
  1065. package/linthost/format_sort_imports_sorts_erased_type_only_block_test.go +26 -0
  1066. package/linthost/format_sort_imports_sorts_named_specifiers_without_reordering_runtime_imports_test.go +28 -0
  1067. package/linthost/format_sort_imports_treats_inline_type_bindings_as_runtime_import_test.go +24 -0
  1068. package/linthost/format_sort_imports_unsafe_option_reorders_runtime_imports_test.go +34 -0
  1069. package/linthost/format_statement_split_abstains_on_empty_statements_test.go +26 -0
  1070. package/linthost/format_statement_split_abstains_when_block_comment_in_gap_test.go +28 -0
  1071. package/linthost/format_statement_split_breaks_statements_sharing_a_line_test.go +28 -0
  1072. package/linthost/format_statement_split_breaks_three_statements_on_one_line_test.go +27 -0
  1073. package/linthost/format_statement_split_honors_crlf_end_of_line_test.go +29 -0
  1074. package/linthost/format_statement_split_indents_split_statement_inside_block_test.go +30 -0
  1075. package/linthost/format_statement_split_keeps_block_on_case_label_line_test.go +28 -0
  1076. package/linthost/format_statement_split_keeps_leading_semi_guard_test.go +31 -0
  1077. package/linthost/format_statement_split_skips_already_one_per_line_test.go +26 -0
  1078. package/linthost/format_ternary_nullish_parens_leaves_logical_and_parenthesized_test.go +30 -0
  1079. package/linthost/format_ternary_nullish_parens_wraps_all_positions_test.go +29 -0
  1080. package/linthost/format_trailing_comma_honors_mode_es5_for_enum_members_test.go +26 -0
  1081. package/linthost/format_trailing_comma_honors_mode_es5_includes_type_level_lists_test.go +26 -0
  1082. package/linthost/format_trailing_comma_honors_mode_es5_option_test.go +28 -0
  1083. package/linthost/format_trailing_comma_honors_mode_es5_skips_arrow_parameter_test.go +29 -0
  1084. package/linthost/format_trailing_comma_honors_mode_es5_skips_call_argument_test.go +28 -0
  1085. package/linthost/format_trailing_comma_honors_mode_es5_skips_constructor_parameter_test.go +29 -0
  1086. package/linthost/format_trailing_comma_honors_mode_es5_skips_function_expression_parameter_test.go +29 -0
  1087. package/linthost/format_trailing_comma_honors_mode_es5_skips_method_parameter_test.go +29 -0
  1088. package/linthost/format_trailing_comma_honors_mode_es5_skips_new_argument_test.go +28 -0
  1089. package/linthost/format_trailing_comma_honors_mode_es5_skips_set_accessor_parameter_test.go +29 -0
  1090. package/linthost/format_trailing_comma_inserts_after_array_spread_in_value_literal_test.go +26 -0
  1091. package/linthost/format_trailing_comma_inserts_after_decorated_parameter_test.go +27 -0
  1092. package/linthost/format_trailing_comma_inserts_after_last_array_element_test.go +25 -0
  1093. package/linthost/format_trailing_comma_inserts_after_last_arrow_parameter_test.go +25 -0
  1094. package/linthost/format_trailing_comma_inserts_after_last_call_argument_test.go +25 -0
  1095. package/linthost/format_trailing_comma_inserts_after_last_call_signature_parameter_test.go +28 -0
  1096. package/linthost/format_trailing_comma_inserts_after_last_construct_signature_parameter_test.go +28 -0
  1097. package/linthost/format_trailing_comma_inserts_after_last_constructor_parameter_test.go +26 -0
  1098. package/linthost/format_trailing_comma_inserts_after_last_constructor_type_parameter_test.go +28 -0
  1099. package/linthost/format_trailing_comma_inserts_after_last_element_in_multiple_lists_test.go +27 -0
  1100. package/linthost/format_trailing_comma_inserts_after_last_function_expression_parameter_test.go +25 -0
  1101. package/linthost/format_trailing_comma_inserts_after_last_function_parameter_test.go +25 -0
  1102. package/linthost/format_trailing_comma_inserts_after_last_function_type_parameter_test.go +28 -0
  1103. package/linthost/format_trailing_comma_inserts_after_last_method_parameter_test.go +26 -0
  1104. package/linthost/format_trailing_comma_inserts_after_last_method_signature_parameter_test.go +28 -0
  1105. package/linthost/format_trailing_comma_inserts_after_last_named_export_test.go +25 -0
  1106. package/linthost/format_trailing_comma_inserts_after_last_named_import_test.go +25 -0
  1107. package/linthost/format_trailing_comma_inserts_after_last_new_argument_test.go +27 -0
  1108. package/linthost/format_trailing_comma_inserts_after_last_object_property_test.go +25 -0
  1109. package/linthost/format_trailing_comma_inserts_after_last_set_accessor_parameter_test.go +26 -0
  1110. package/linthost/format_trailing_comma_inserts_after_last_tuple_element_test.go +25 -0
  1111. package/linthost/format_trailing_comma_inserts_after_last_type_parameter_test.go +28 -0
  1112. package/linthost/format_trailing_comma_inserts_after_non_rest_array_assignment_target_test.go +27 -0
  1113. package/linthost/format_trailing_comma_inserts_after_non_rest_object_assignment_target_test.go +27 -0
  1114. package/linthost/format_trailing_comma_inserts_after_object_spread_in_value_literal_test.go +26 -0
  1115. package/linthost/format_trailing_comma_inserts_after_parameter_property_in_constructor_test.go +28 -0
  1116. package/linthost/format_trailing_comma_mode_none_removes_trailing_comma_test.go +28 -0
  1117. package/linthost/format_trailing_comma_places_comma_before_trailing_line_comment_test.go +31 -0
  1118. package/linthost/format_trailing_comma_removes_call_comma_under_es5_test.go +27 -0
  1119. package/linthost/format_trailing_comma_skips_already_terminated_lists_test.go +31 -0
  1120. package/linthost/format_trailing_comma_skips_array_rest_assignment_target_test.go +28 -0
  1121. package/linthost/format_trailing_comma_skips_call_when_close_paren_shares_line_with_last_argument_test.go +30 -0
  1122. package/linthost/format_trailing_comma_skips_dynamic_import_argument_test.go +28 -0
  1123. package/linthost/format_trailing_comma_skips_empty_lists_test.go +32 -0
  1124. package/linthost/format_trailing_comma_skips_inline_block_comment_before_close_bracket_test.go +31 -0
  1125. package/linthost/format_trailing_comma_skips_object_rest_assignment_target_test.go +28 -0
  1126. package/linthost/format_trailing_comma_skips_rest_parameter_test.go +39 -0
  1127. package/linthost/format_trailing_comma_skips_single_line_lists_test.go +34 -0
  1128. package/linthost/format_trailing_comma_skips_unparenthesized_arrow_with_multiline_body_test.go +28 -0
  1129. package/linthost/format_whitespace_collapses_all_blank_file_to_single_eol_test.go +30 -0
  1130. package/linthost/format_whitespace_collapses_consecutive_blank_lines_test.go +27 -0
  1131. package/linthost/format_whitespace_fixes_missing_final_newline_with_trailing_space_test.go +29 -0
  1132. package/linthost/format_whitespace_inserts_missing_final_newline_test.go +28 -0
  1133. package/linthost/format_whitespace_keeps_blank_line_inside_template_test.go +27 -0
  1134. package/linthost/format_whitespace_normalizes_crlf_to_lf_by_default_test.go +28 -0
  1135. package/linthost/format_whitespace_preserves_crlf_under_crlf_end_of_line_test.go +28 -0
  1136. package/linthost/format_whitespace_preserves_nested_template_content_test.go +28 -0
  1137. package/linthost/format_whitespace_preserves_trailing_space_across_template_substitution_test.go +29 -0
  1138. package/linthost/format_whitespace_preserves_trailing_spaces_inside_template_literal_test.go +35 -0
  1139. package/linthost/format_whitespace_skips_empty_file_test.go +26 -0
  1140. package/linthost/format_whitespace_skips_single_blank_line_test.go +26 -0
  1141. package/linthost/format_whitespace_strips_leading_blank_lines_test.go +27 -0
  1142. package/linthost/format_whitespace_strips_trailing_blank_lines_test.go +27 -0
  1143. package/linthost/format_whitespace_trims_trailing_spaces_test.go +28 -0
  1144. package/linthost/functional_helpers_test.go +88 -0
  1145. package/linthost/functional_immutable_data_ignores_code_pattern_test.go +28 -0
  1146. package/linthost/functional_immutable_data_rejects_property_assignment_test.go +25 -0
  1147. package/linthost/functional_no_class_inheritance_rejects_extends_test.go +24 -0
  1148. package/linthost/functional_no_classes_rejects_class_declaration_test.go +24 -0
  1149. package/linthost/functional_no_conditional_statements_rejects_if_test.go +23 -0
  1150. package/linthost/functional_no_expression_statements_rejects_call_test.go +23 -0
  1151. package/linthost/functional_no_let_ignores_identifier_pattern_test.go +28 -0
  1152. package/linthost/functional_no_let_rejects_let_declaration_test.go +24 -0
  1153. package/linthost/functional_no_loop_statements_rejects_for_test.go +23 -0
  1154. package/linthost/functional_no_mixed_types_check_interfaces_false_skips_interface_test.go +28 -0
  1155. package/linthost/functional_no_mixed_types_check_interfaces_false_still_checks_type_literal_test.go +28 -0
  1156. package/linthost/functional_no_mixed_types_check_type_literals_false_skips_type_literal_test.go +28 -0
  1157. package/linthost/functional_no_mixed_types_check_type_literals_false_still_checks_interface_test.go +28 -0
  1158. package/linthost/functional_no_mixed_types_rejects_method_and_property_test.go +23 -0
  1159. package/linthost/functional_no_promise_reject_rejects_static_call_test.go +23 -0
  1160. package/linthost/functional_no_return_void_allow_null_false_rejects_null_return_type_test.go +27 -0
  1161. package/linthost/functional_no_return_void_allow_undefined_false_rejects_undefined_return_type_test.go +28 -0
  1162. package/linthost/functional_no_return_void_allows_null_return_type_by_default_test.go +23 -0
  1163. package/linthost/functional_no_return_void_allows_undefined_return_type_by_default_test.go +23 -0
  1164. package/linthost/functional_no_return_void_ignore_inferred_types_keeps_annotated_bare_return_test.go +28 -0
  1165. package/linthost/functional_no_return_void_ignore_inferred_types_reads_a_get_accessor_annotation_test.go +30 -0
  1166. package/linthost/functional_no_return_void_ignore_inferred_types_skips_unannotated_bare_return_test.go +28 -0
  1167. package/linthost/functional_no_return_void_ignore_inferred_types_stops_at_the_nearest_function_test.go +29 -0
  1168. package/linthost/functional_no_return_void_rejects_void_annotation_test.go +23 -0
  1169. package/linthost/functional_no_this_expressions_rejects_this_test.go +23 -0
  1170. package/linthost/functional_no_throw_statements_rejects_throw_test.go +23 -0
  1171. package/linthost/functional_no_try_statements_rejects_try_test.go +23 -0
  1172. package/linthost/functional_parameters_ignores_identifier_pattern_test.go +27 -0
  1173. package/linthost/functional_parameters_rejects_rest_parameter_test.go +25 -0
  1174. package/linthost/functional_prefer_immutable_types_ignores_identifier_pattern_test.go +28 -0
  1175. package/linthost/functional_prefer_immutable_types_rejects_array_type_test.go +23 -0
  1176. package/linthost/functional_prefer_immutable_types_rejects_mutable_parameter_array_test.go +24 -0
  1177. package/linthost/functional_prefer_property_signatures_rejects_method_signature_test.go +23 -0
  1178. package/linthost/functional_prefer_readonly_type_allow_mutable_return_type_covers_call_signature_test.go +29 -0
  1179. package/linthost/functional_prefer_readonly_type_allow_mutable_return_type_keeps_parameter_annotation_test.go +28 -0
  1180. package/linthost/functional_prefer_readonly_type_allow_mutable_return_type_skips_return_annotation_test.go +28 -0
  1181. package/linthost/functional_prefer_readonly_type_ignore_class_fields_only_keeps_method_parameter_test.go +34 -0
  1182. package/linthost/functional_prefer_readonly_type_ignore_class_keeps_module_scope_checked_test.go +29 -0
  1183. package/linthost/functional_prefer_readonly_type_ignore_class_skips_class_body_test.go +29 -0
  1184. package/linthost/functional_prefer_readonly_type_ignore_collections_keeps_property_signature_test.go +28 -0
  1185. package/linthost/functional_prefer_readonly_type_ignore_collections_skips_array_type_test.go +28 -0
  1186. package/linthost/functional_prefer_readonly_type_ignore_interface_keeps_type_alias_member_test.go +28 -0
  1187. package/linthost/functional_prefer_readonly_type_ignore_interface_skips_interface_member_test.go +28 -0
  1188. package/linthost/functional_prefer_readonly_type_ignores_code_pattern_test.go +27 -0
  1189. package/linthost/functional_prefer_readonly_type_rejects_array_type_test.go +23 -0
  1190. package/linthost/functional_prefer_tacit_check_member_expressions_false_keeps_identifier_callee_test.go +27 -0
  1191. package/linthost/functional_prefer_tacit_check_member_expressions_false_skips_member_callee_test.go +28 -0
  1192. package/linthost/functional_prefer_tacit_rejects_single_argument_wrapper_test.go +24 -0
  1193. package/linthost/functional_readonly_type_rejects_readonly_array_generic_test.go +23 -0
  1194. package/linthost/functional_type_declaration_immutability_ignores_identifier_pattern_test.go +27 -0
  1195. package/linthost/functional_type_declaration_immutability_rejects_mutable_interface_test.go +23 -0
  1196. package/linthost/getter_return_follows_every_path_through_switch_try_and_loops_test.go +64 -0
  1197. package/linthost/global_ignores_remove_an_imported_source_from_the_read_scope_test.go +60 -0
  1198. package/linthost/graph_nodes.go +12 -2
  1199. package/linthost/graph_nodes_drops_what_a_consumer_cannot_index_test.go +98 -0
  1200. package/linthost/graph_nodes_publishes_nothing_without_a_publisher_test.go +51 -0
  1201. package/linthost/grapheme_break_unicode_16_conformance_test.go +99 -0
  1202. package/linthost/grouped_accessor_pairs_object_literal_message_test.go +75 -0
  1203. package/linthost/guard_for_in_structural_matrix_test.go +74 -0
  1204. package/linthost/has_nil_entry_distinguishes_malformed_and_valid_lists_test.go +35 -0
  1205. package/linthost/has_nil_entry_returns_false_for_nil_list_test.go +26 -0
  1206. package/linthost/helpers_test.go +910 -0
  1207. package/linthost/hints.go +11 -1
  1208. package/linthost/host.go +126 -43
  1209. package/linthost/imported_tsx_source_joins_the_read_scope_test.go +67 -0
  1210. package/linthost/indent_unit_uses_tab_width_when_positive_test.go +49 -0
  1211. package/linthost/inline_resolver_carries_options_in_resolved_config_test.go +36 -0
  1212. package/linthost/input_observation.go +571 -0
  1213. package/linthost/invalid_contributor_range_cannot_panic_inline_directive_filtering_test.go +46 -0
  1214. package/linthost/is_format_rule_detects_marker_interface_test.go +62 -0
  1215. package/linthost/jsdoc_helpers_test.go +30 -0
  1216. package/linthost/jsx_a11y_alt_text_allows_img_spread_props_test.go +21 -0
  1217. package/linthost/jsx_a11y_alt_text_requires_img_alt_test.go +22 -0
  1218. package/linthost/jsx_a11y_anchor_ambiguous_text_test.go +24 -0
  1219. package/linthost/jsx_a11y_anchor_has_content_rejects_empty_anchor_test.go +25 -0
  1220. package/linthost/jsx_a11y_anchor_is_valid_allows_spread_props_test.go +21 -0
  1221. package/linthost/jsx_a11y_anchor_is_valid_rejects_hash_href_despite_spread_test.go +22 -0
  1222. package/linthost/jsx_a11y_anchor_is_valid_rejects_hash_href_test.go +22 -0
  1223. package/linthost/jsx_a11y_aria_activedescendant_has_tabindex_requires_focus_target_test.go +23 -0
  1224. package/linthost/jsx_a11y_aria_props_rejects_unknown_prop_test.go +22 -0
  1225. package/linthost/jsx_a11y_aria_proptypes_rejects_bad_boolean_test.go +23 -0
  1226. package/linthost/jsx_a11y_aria_role_rejects_unknown_role_test.go +22 -0
  1227. package/linthost/jsx_a11y_aria_unsupported_elements_rejects_meta_aria_test.go +23 -0
  1228. package/linthost/jsx_a11y_aria_unsupported_elements_rejects_role_despite_spread_test.go +24 -0
  1229. package/linthost/jsx_a11y_autocomplete_valid_allows_appropriate_input_type_test.go +29 -0
  1230. package/linthost/jsx_a11y_autocomplete_valid_rejects_inappropriate_input_type_test.go +21 -0
  1231. package/linthost/jsx_a11y_autocomplete_valid_rejects_invalid_token_sequence_test.go +26 -0
  1232. package/linthost/jsx_a11y_autocomplete_valid_rejects_unknown_token_test.go +22 -0
  1233. package/linthost/jsx_a11y_click_events_have_key_events_requires_keyboard_handler_test.go +21 -0
  1234. package/linthost/jsx_a11y_control_has_associated_label_requires_button_label_test.go +21 -0
  1235. package/linthost/jsx_a11y_heading_has_content_rejects_empty_heading_test.go +22 -0
  1236. package/linthost/jsx_a11y_helpers_test.go +33 -0
  1237. package/linthost/jsx_a11y_html_has_lang_allows_non_empty_lang_test.go +21 -0
  1238. package/linthost/jsx_a11y_html_has_lang_allows_spread_props_test.go +24 -0
  1239. package/linthost/jsx_a11y_html_has_lang_rejects_empty_lang_test.go +27 -0
  1240. package/linthost/jsx_a11y_html_has_lang_requires_lang_test.go +21 -0
  1241. package/linthost/jsx_a11y_iframe_has_title_allows_spread_props_test.go +23 -0
  1242. package/linthost/jsx_a11y_iframe_has_title_requires_title_test.go +21 -0
  1243. package/linthost/jsx_a11y_img_redundant_alt_rejects_image_word_despite_spread_test.go +25 -0
  1244. package/linthost/jsx_a11y_img_redundant_alt_rejects_image_word_test.go +21 -0
  1245. package/linthost/jsx_a11y_interactive_supports_focus_requires_tabindex_test.go +21 -0
  1246. package/linthost/jsx_a11y_label_has_associated_control_requires_for_or_child_test.go +21 -0
  1247. package/linthost/jsx_a11y_label_has_for_alias_matches_associated_control_test.go +21 -0
  1248. package/linthost/jsx_a11y_lang_allows_valid_bcp47_tag_test.go +22 -0
  1249. package/linthost/jsx_a11y_lang_rejects_empty_lang_test.go +20 -0
  1250. package/linthost/jsx_a11y_lang_rejects_invalid_bcp47_tag_test.go +25 -0
  1251. package/linthost/jsx_a11y_media_has_caption_requires_track_test.go +22 -0
  1252. package/linthost/jsx_a11y_mouse_events_have_key_events_requires_focus_test.go +21 -0
  1253. package/linthost/jsx_a11y_no_access_key_rejects_access_key_test.go +21 -0
  1254. package/linthost/jsx_a11y_no_aria_hidden_on_focusable_rejects_hidden_button_test.go +21 -0
  1255. package/linthost/jsx_a11y_no_autofocus_rejects_autofocus_test.go +21 -0
  1256. package/linthost/jsx_a11y_no_distracting_elements_rejects_marquee_test.go +21 -0
  1257. package/linthost/jsx_a11y_no_interactive_element_to_noninteractive_role_rejects_button_presentation_test.go +21 -0
  1258. package/linthost/jsx_a11y_no_noninteractive_element_interactions_rejects_li_click_test.go +21 -0
  1259. package/linthost/jsx_a11y_no_noninteractive_element_to_interactive_role_rejects_ul_button_test.go +21 -0
  1260. package/linthost/jsx_a11y_no_noninteractive_tabindex_rejects_section_tabindex_test.go +21 -0
  1261. package/linthost/jsx_a11y_no_redundant_roles_rejects_button_role_button_test.go +21 -0
  1262. package/linthost/jsx_a11y_no_static_element_interactions_requires_role_test.go +21 -0
  1263. package/linthost/jsx_a11y_prefer_tag_over_role_rejects_div_button_test.go +21 -0
  1264. package/linthost/jsx_a11y_role_has_required_aria_props_allows_native_checkbox_test.go +21 -0
  1265. package/linthost/jsx_a11y_role_has_required_aria_props_allows_spread_props_test.go +23 -0
  1266. package/linthost/jsx_a11y_role_has_required_aria_props_requires_checkbox_checked_test.go +21 -0
  1267. package/linthost/jsx_a11y_role_supports_aria_props_allows_explicit_button_pressed_test.go +21 -0
  1268. package/linthost/jsx_a11y_role_supports_aria_props_allows_native_button_pressed_test.go +21 -0
  1269. package/linthost/jsx_a11y_role_supports_aria_props_rejects_button_checked_test.go +21 -0
  1270. package/linthost/jsx_a11y_rules_survive_spread_attributes_test.go +60 -0
  1271. package/linthost/jsx_a11y_scope_rejects_scope_on_td_test.go +21 -0
  1272. package/linthost/jsx_a11y_tabindex_no_positive_rejects_positive_tabindex_test.go +21 -0
  1273. package/linthost/known_symbol_property_name_finds_iteration_and_disposal_protocol_members_test.go +112 -0
  1274. package/linthost/legacy_custom_resolver_keeps_rule_options_fallback_test.go +45 -0
  1275. package/linthost/lint_corpus_companions_belong_to_their_own_case_test.go +53 -0
  1276. package/linthost/lint_corpus_diagnostics_are_attributed_to_the_main_source_test.go +51 -0
  1277. package/linthost/lint_corpus_directives_reject_malformed_or_duplicate_markers_test.go +89 -0
  1278. package/linthost/lint_corpus_discovery_classifies_every_typescript_suffix_test.go +56 -0
  1279. package/linthost/lint_corpus_discovery_rejects_invalid_companion_contracts_test.go +50 -0
  1280. package/linthost/lint_corpus_discovery_rejects_unclassified_sources_test.go +39 -0
  1281. package/linthost/lint_corpus_expectation_parser_rejects_malformed_or_targetless_markers_test.go +46 -0
  1282. package/linthost/lint_corpus_expectation_parser_resolves_line_and_jsx_block_markers_test.go +53 -0
  1283. package/linthost/lint_corpus_filename_separators_share_materialized_source_identity_test.go +85 -0
  1284. package/linthost/lint_corpus_loader_helpers_test.go +704 -0
  1285. package/linthost/lint_corpus_project_selects_jsx_mode_for_included_tsx_sources_test.go +118 -0
  1286. package/linthost/lint_corpus_skips_name_one_rule_and_one_harness_test.go +63 -0
  1287. package/linthost/lint_fixture_corpus_test.go +166 -0
  1288. package/linthost/lint_trace.go +202 -0
  1289. package/linthost/lint_trace_preserves_raw_invocation_and_integrity_test.go +139 -0
  1290. package/linthost/load_config_file_rejects_unsupported_extension_test.go +38 -0
  1291. package/linthost/load_config_resolver_compact_globs_preserve_entry_policy_test.go +97 -0
  1292. package/linthost/load_config_resolver_scopes_extends_options_in_engine_test.go +65 -0
  1293. package/linthost/load_json_config_file_rejects_invalid_json_test.go +38 -0
  1294. package/linthost/load_program_keeps_checker_pool_for_type_aware_rules_test.go +184 -0
  1295. package/linthost/load_program_skips_checker_for_ast_only_rules_test.go +59 -0
  1296. package/linthost/load_rule_config_configfile_overrides_discovery_test.go +51 -0
  1297. package/linthost/load_rule_config_discovers_cwd_config_for_out_of_tree_tsconfig_test.go +46 -0
  1298. package/linthost/load_rule_config_discovers_plain_lint_config_test.go +39 -0
  1299. package/linthost/load_rule_config_extends_with_ignores_and_rules_ignores_globally_test.go +141 -0
  1300. package/linthost/load_rule_config_honors_plugin_config_dir_env_test.go +53 -0
  1301. package/linthost/load_rule_config_loads_json_config_file_test.go +55 -0
  1302. package/linthost/load_rule_config_missing_config_error_names_search_origins_test.go +44 -0
  1303. package/linthost/load_rule_config_preserves_json_pattern_precedence_test.go +80 -0
  1304. package/linthost/load_rule_config_rejects_array_rules_test.go +34 -0
  1305. package/linthost/load_rule_config_rejects_empty_extends_test.go +34 -0
  1306. package/linthost/load_rule_config_rejects_extends_cycle_between_two_configs_test.go +71 -0
  1307. package/linthost/load_rule_config_rejects_missing_discovered_config_test.go +37 -0
  1308. package/linthost/load_rule_config_rejects_overly_deep_extends_chain_test.go +53 -0
  1309. package/linthost/load_rule_config_rejects_self_referential_extends_test.go +49 -0
  1310. package/linthost/load_rule_config_resolves_configfile_relative_to_plugin_config_dir_env_test.go +46 -0
  1311. package/linthost/load_rule_config_resolves_linear_extends_chain_test.go +81 -0
  1312. package/linthost/load_rules_ignores_non_lint_plugin_payload_test.go +33 -0
  1313. package/linthost/loader_module_option_follows_the_config_package_type_test.go +103 -0
  1314. package/linthost/loader_rootdir_contains_loader_and_config_test.go +59 -0
  1315. package/linthost/loader_temp_base_stays_on_config_volume_test.go +35 -0
  1316. package/linthost/logic_rules_cover_boolean_call_arguments_undefined_typeof_negative_zero_and_number_nan_test.go +43 -0
  1317. package/linthost/lookup_rule_returns_registered_implementation_or_nil_test.go +49 -0
  1318. package/linthost/lsp.go +185 -34
  1319. package/linthost/lsp_apply_suggestion_rejects_stale_source_test.go +49 -0
  1320. package/linthost/lsp_apply_suggestion_resolves_junction_project_link_test.go +33 -0
  1321. package/linthost/lsp_apply_suggestion_resolves_logical_project_link_test.go +35 -0
  1322. package/linthost/lsp_await_thenable_suggestion_executes_exact_token_test.go +52 -0
  1323. package/linthost/lsp_ban_ts_comment_suggestion_preserves_crlf_block_test.go +52 -0
  1324. package/linthost/lsp_code_action_helpers_test.go +55 -0
  1325. package/linthost/lsp_code_actions_fail_closed_for_invalid_quickfix_range_test.go +88 -0
  1326. package/linthost/lsp_code_actions_reject_more_specific_context_only_test.go +37 -0
  1327. package/linthost/lsp_code_actions_returns_empty_for_node_modules_target_test.go +44 -0
  1328. package/linthost/lsp_code_actions_returns_empty_for_outside_cwd_target_test.go +45 -0
  1329. package/linthost/lsp_code_actions_short_circuits_unowned_context_only_test.go +46 -0
  1330. package/linthost/lsp_code_actions_split_lint_and_format_commands_test.go +41 -0
  1331. package/linthost/lsp_command_discovery_reports_owned_commands_and_kinds_test.go +67 -0
  1332. package/linthost/lsp_command_helpers_test.go +113 -0
  1333. package/linthost/lsp_command_workspace_preserves_nested_dependency_scopes_test.go +77 -0
  1334. package/linthost/lsp_commands_accept_windows_short_cwd_test.go +62 -0
  1335. package/linthost/lsp_diagnostic_omits_code_description_for_contributor_rule_test.go +81 -0
  1336. package/linthost/lsp_diagnostic_tags_drop_unknown_values_test.go +41 -0
  1337. package/linthost/lsp_diagnostic_wire_drops_code_description_key_when_unmapped_test.go +65 -0
  1338. package/linthost/lsp_diagnostics_link_rule_codes_to_documentation_test.go +84 -0
  1339. package/linthost/lsp_document_write_scope_preserves_project_and_sibling_boundaries_test.go +68 -0
  1340. package/linthost/lsp_execute_command_applies_utf16_edit_after_non_bmp_prefix_test.go +48 -0
  1341. package/linthost/lsp_execute_command_cascades_format_fixes_without_mutating_disk_test.go +50 -0
  1342. package/linthost/lsp_execute_command_cascades_lint_fixes_without_mutating_disk_test.go +48 -0
  1343. package/linthost/lsp_execute_command_copies_read_only_file_as_writable_test.go +46 -0
  1344. package/linthost/lsp_execute_command_maps_absolute_config_file_into_temp_workspace_test.go +40 -0
  1345. package/linthost/lsp_execute_command_materializes_duplicate_symlinked_directories_test.go +57 -0
  1346. package/linthost/lsp_execute_command_materializes_junctioned_directory_without_mutating_original_test.go +61 -0
  1347. package/linthost/lsp_execute_command_materializes_symlink_target_without_mutating_original_test.go +55 -0
  1348. package/linthost/lsp_execute_command_materializes_symlinked_directory_without_mutating_original_test.go +56 -0
  1349. package/linthost/lsp_execute_command_rejects_target_outside_cwd_before_read_test.go +61 -0
  1350. package/linthost/lsp_execute_command_returns_null_for_node_modules_target_test.go +59 -0
  1351. package/linthost/lsp_execute_command_returns_null_when_no_edits_test.go +51 -0
  1352. package/linthost/lsp_execute_command_splits_lint_and_format_edits_test.go +43 -0
  1353. package/linthost/lsp_fix_all_leaves_suggestion_only_rewrites_unchanged_test.go +37 -0
  1354. package/linthost/lsp_format_buffer_formats_missing_disk_file_test.go +42 -0
  1355. package/linthost/lsp_format_buffer_helpers_test.go +68 -0
  1356. package/linthost/lsp_format_buffer_ignores_disk_content_test.go +52 -0
  1357. package/linthost/lsp_format_buffer_in_memory_test.go +47 -0
  1358. package/linthost/lsp_format_buffer_type_aware_contributor_test.go +142 -0
  1359. package/linthost/lsp_format_paths_honor_entry_ignores_test.go +45 -0
  1360. package/linthost/lsp_format_paths_use_canonical_defaults_test.go +72 -0
  1361. package/linthost/lsp_format_paths_use_defaults_without_format_block_test.go +28 -0
  1362. package/linthost/lsp_format_paths_use_editor_language_overrides_test.go +34 -0
  1363. package/linthost/lsp_hints_publishes_jsdoc_check_tag_names_corpus_test.go +56 -0
  1364. package/linthost/lsp_hints_skips_the_program_when_nothing_publishes_test.go +46 -0
  1365. package/linthost/lsp_hints_still_loads_the_program_for_a_declared_publisher_test.go +42 -0
  1366. package/linthost/lsp_logical_project_link_helpers_test.go +127 -0
  1367. package/linthost/lsp_position_columns_count_utf16_across_planes_test.go +107 -0
  1368. package/linthost/lsp_position_counts_non_bmp_as_two_utf16_units_test.go +26 -0
  1369. package/linthost/lsp_prefer_as_const_suggestion_executes_selected_range_test.go +51 -0
  1370. package/linthost/lsp_project_diagnostics_recomputes_external_state_without_document_test.go +187 -0
  1371. package/linthost/lsp_serve_answers_hints_from_the_resident_daemon_test.go +73 -0
  1372. package/linthost/lsp_switch_exhaustiveness_suggestions_preserve_default_anchors_test.go +206 -0
  1373. package/linthost/match_any_pattern_accepts_native_and_slash_separators_test.go +47 -0
  1374. package/linthost/match_any_pattern_handles_brace_expansion_test.go +43 -0
  1375. package/linthost/match_any_pattern_matches_dot_directory_globs_test.go +44 -0
  1376. package/linthost/max_nested_callbacks_counts_only_functions_passed_to_calls_test.go +46 -0
  1377. package/linthost/migrated_no_misused_promises_helpers_test.go +30 -0
  1378. package/linthost/migrated_no_unused_expressions_helpers_test.go +50 -0
  1379. package/linthost/migrated_typed_rule_helpers_test.go +46 -0
  1380. package/linthost/misc_testing_library_rules_test.go +63 -0
  1381. package/linthost/mixed_diagnostics_render_empty_is_silent_test.go +29 -0
  1382. package/linthost/mixed_diagnostics_render_interleaves_parser_and_lint_test.go +51 -0
  1383. package/linthost/mixed_diagnostics_render_orders_files_and_ties_test.go +58 -0
  1384. package/linthost/new_print_context_zero_print_width_applies_defaults_test.go +36 -0
  1385. package/linthost/no_array_delete_asks_the_type_not_the_subscript_test.go +70 -0
  1386. package/linthost/no_await_in_loop_complete_semantics_test.go +205 -0
  1387. package/linthost/no_base_to_string_test.go +48 -0
  1388. package/linthost/no_class_assign_test.go +217 -0
  1389. package/linthost/no_container_ignores_unrelated_container_binding_test.go +33 -0
  1390. package/linthost/no_deprecated_test.go +45 -0
  1391. package/linthost/no_dupe_class_members_allows_typescript_overload_signatures_test.go +41 -0
  1392. package/linthost/no_dupe_class_members_rejects_accessor_data_collisions_test.go +28 -0
  1393. package/linthost/no_dupe_else_if_logical_coverage_test.go +152 -0
  1394. package/linthost/no_dupe_keys_computed_key_static_resolution_test.go +72 -0
  1395. package/linthost/no_duplicate_imports_allow_separate_type_imports_allows_value_plus_type_import_test.go +30 -0
  1396. package/linthost/no_duplicate_imports_allow_separate_type_imports_still_reports_type_pairs_test.go +30 -0
  1397. package/linthost/no_duplicate_imports_allow_separate_type_imports_still_reports_value_pairs_test.go +29 -0
  1398. package/linthost/no_duplicate_imports_allows_inline_type_specifier_beside_type_import_test.go +29 -0
  1399. package/linthost/no_duplicate_imports_allows_named_and_namespace_value_imports_test.go +31 -0
  1400. package/linthost/no_duplicate_imports_allows_type_default_and_type_named_imports_test.go +31 -0
  1401. package/linthost/no_duplicate_imports_allows_type_namespace_and_type_named_imports_test.go +28 -0
  1402. package/linthost/no_duplicate_imports_classifies_inline_type_specifier_as_value_test.go +31 -0
  1403. package/linthost/no_duplicate_imports_helpers_test.go +78 -0
  1404. package/linthost/no_duplicate_imports_ignores_misspelled_option_keys_test.go +30 -0
  1405. package/linthost/no_duplicate_imports_ignores_reexports_by_default_test.go +32 -0
  1406. package/linthost/no_duplicate_imports_include_exports_allows_export_star_beside_named_import_test.go +31 -0
  1407. package/linthost/no_duplicate_imports_include_exports_allows_export_star_beside_namespace_reexport_test.go +29 -0
  1408. package/linthost/no_duplicate_imports_include_exports_allows_namespace_reexport_beside_named_import_test.go +29 -0
  1409. package/linthost/no_duplicate_imports_include_exports_reports_both_pairings_on_one_declaration_test.go +34 -0
  1410. package/linthost/no_duplicate_imports_include_exports_reports_export_star_beside_side_effect_import_test.go +35 -0
  1411. package/linthost/no_duplicate_imports_include_exports_reports_import_after_reexport_test.go +30 -0
  1412. package/linthost/no_duplicate_imports_include_exports_reports_reexport_after_import_test.go +30 -0
  1413. package/linthost/no_duplicate_imports_include_exports_reports_repeated_export_star_test.go +30 -0
  1414. package/linthost/no_duplicate_imports_include_exports_reports_second_reexport_test.go +29 -0
  1415. package/linthost/no_duplicate_imports_include_exports_reports_type_reexport_after_value_import_test.go +30 -0
  1416. package/linthost/no_duplicate_imports_include_exports_skips_local_export_without_module_test.go +31 -0
  1417. package/linthost/no_duplicate_imports_include_exports_treats_empty_reexport_clause_as_side_effect_test.go +31 -0
  1418. package/linthost/no_duplicate_imports_include_exports_with_allow_separate_allows_type_reexport_test.go +30 -0
  1419. package/linthost/no_duplicate_imports_preserves_migrated_json_tuple_options_test.go +47 -0
  1420. package/linthost/no_duplicate_imports_reports_default_then_named_value_imports_test.go +31 -0
  1421. package/linthost/no_duplicate_imports_reports_default_then_namespace_value_imports_test.go +30 -0
  1422. package/linthost/no_duplicate_imports_reports_each_later_duplicate_import_test.go +31 -0
  1423. package/linthost/no_duplicate_imports_reports_nonadjacent_duplicate_value_imports_test.go +30 -0
  1424. package/linthost/no_duplicate_imports_reports_repeated_side_effect_imports_test.go +29 -0
  1425. package/linthost/no_duplicate_imports_reports_side_effect_import_after_named_import_test.go +30 -0
  1426. package/linthost/no_duplicate_imports_reports_two_namespace_value_imports_test.go +29 -0
  1427. package/linthost/no_duplicate_imports_reports_two_type_default_imports_test.go +29 -0
  1428. package/linthost/no_duplicate_imports_reports_value_default_then_type_named_import_test.go +33 -0
  1429. package/linthost/no_duplicate_imports_reports_value_then_type_named_import_by_default_test.go +30 -0
  1430. package/linthost/no_duplicate_imports_skips_empty_module_specifiers_test.go +30 -0
  1431. package/linthost/no_duplicate_imports_treats_default_with_empty_named_clause_as_default_test.go +30 -0
  1432. package/linthost/no_duplicate_imports_treats_empty_named_import_clause_as_side_effect_test.go +32 -0
  1433. package/linthost/no_duplicate_imports_trims_module_specifier_whitespace_test.go +29 -0
  1434. package/linthost/no_else_return_allow_else_if_false_reports_else_if_test.go +60 -0
  1435. package/linthost/no_else_return_allows_break_before_else_test.go +34 -0
  1436. package/linthost/no_else_return_allows_continue_before_else_test.go +34 -0
  1437. package/linthost/no_else_return_allows_else_if_return_chain_test.go +34 -0
  1438. package/linthost/no_else_return_allows_throw_before_else_test.go +32 -0
  1439. package/linthost/no_else_return_reports_once_on_terminal_else_test.go +31 -0
  1440. package/linthost/no_else_return_reports_plain_else_after_return_test.go +27 -0
  1441. package/linthost/no_empty_character_class_semantics_test.go +62 -0
  1442. package/linthost/no_empty_complete_semantics_test.go +89 -0
  1443. package/linthost/no_empty_function_comments_preserve_every_kind_test.go +35 -0
  1444. package/linthost/no_empty_function_options_test.go +60 -0
  1445. package/linthost/no_empty_function_typescript_exceptions_and_category_boundaries_test.go +248 -0
  1446. package/linthost/no_empty_static_block_comment_boundaries_test.go +37 -0
  1447. package/linthost/no_extend_native_covers_assignment_and_static_callee_forms_test.go +52 -0
  1448. package/linthost/no_extend_native_covers_every_native_constructor_with_a_prototype_test.go +45 -0
  1449. package/linthost/no_extend_native_define_property_and_computed_test.go +71 -0
  1450. package/linthost/no_extend_native_respects_constructor_bindings_test.go +48 -0
  1451. package/linthost/no_extra_bind_function_body_test.go +72 -0
  1452. package/linthost/no_extra_bind_offers_withheld_removal_as_suggestion_test.go +43 -0
  1453. package/linthost/no_extra_bind_preserves_throwing_receiver_reads_test.go +32 -0
  1454. package/linthost/no_extra_boolean_cast_declines_fix_for_comment_between_bangs_test.go +28 -0
  1455. package/linthost/no_extra_boolean_cast_declines_fix_for_leading_comment_in_call_test.go +29 -0
  1456. package/linthost/no_extra_boolean_cast_declines_fix_for_trailing_comment_in_call_test.go +28 -0
  1457. package/linthost/no_extra_boolean_cast_fix_boolean_call_in_boolean_context_test.go +43 -0
  1458. package/linthost/no_extra_boolean_cast_fix_collapses_nested_boolean_call_test.go +30 -0
  1459. package/linthost/no_extra_boolean_cast_fix_double_bang_in_boolean_context_test.go +28 -0
  1460. package/linthost/no_extra_boolean_cast_fix_keeps_bare_identifier_under_bang_test.go +28 -0
  1461. package/linthost/no_extra_boolean_cast_fix_keeps_parenthesized_argument_without_double_wrap_test.go +28 -0
  1462. package/linthost/no_extra_boolean_cast_fix_parenthesizes_arrow_argument_in_ternary_condition_test.go +30 -0
  1463. package/linthost/no_extra_boolean_cast_fix_parenthesizes_assignment_in_ternary_condition_test.go +28 -0
  1464. package/linthost/no_extra_boolean_cast_fix_parenthesizes_await_argument_under_bang_test.go +28 -0
  1465. package/linthost/no_extra_boolean_cast_fix_parenthesizes_logical_operand_under_bang_test.go +28 -0
  1466. package/linthost/no_extra_boolean_cast_fix_parenthesizes_nested_ternary_condition_test.go +30 -0
  1467. package/linthost/no_extra_boolean_cast_fix_parenthesizes_yield_argument_under_bang_test.go +28 -0
  1468. package/linthost/no_extra_boolean_cast_fix_preserves_comment_inside_argument_test.go +29 -0
  1469. package/linthost/no_extra_boolean_cast_fix_skips_wrap_for_logical_ternary_condition_test.go +29 -0
  1470. package/linthost/no_extra_boolean_cast_fix_skips_wrap_inside_explicit_parens_under_bang_test.go +29 -0
  1471. package/linthost/no_extra_boolean_cast_keeps_meaningful_double_bang_outside_boolean_context_test.go +28 -0
  1472. package/linthost/no_extra_boolean_cast_offers_withheld_splice_as_suggestion_test.go +37 -0
  1473. package/linthost/no_extra_boolean_cast_preserves_shadowed_converters_test.go +76 -0
  1474. package/linthost/no_fallthrough_accepts_adjacent_empty_case_labels_test.go +28 -0
  1475. package/linthost/no_fallthrough_accepts_block_marker_with_trailing_unrelated_comment_test.go +32 -0
  1476. package/linthost/no_fallthrough_accepts_break_in_try_with_normal_finally_test.go +33 -0
  1477. package/linthost/no_fallthrough_accepts_breaking_catch_after_throwing_try_test.go +34 -0
  1478. package/linthost/no_fallthrough_accepts_continue_terminating_case_test.go +33 -0
  1479. package/linthost/no_fallthrough_accepts_do_while_with_always_throwing_body_test.go +33 -0
  1480. package/linthost/no_fallthrough_accepts_empty_case_with_same_line_comment_test.go +29 -0
  1481. package/linthost/no_fallthrough_accepts_if_else_terminating_every_path_test.go +38 -0
  1482. package/linthost/no_fallthrough_accepts_infinite_for_without_break_test.go +31 -0
  1483. package/linthost/no_fallthrough_accepts_infinite_loop_with_labeled_break_to_outer_test.go +35 -0
  1484. package/linthost/no_fallthrough_accepts_infinite_while_without_break_test.go +31 -0
  1485. package/linthost/no_fallthrough_accepts_labeled_break_to_outer_loop_test.go +34 -0
  1486. package/linthost/no_fallthrough_accepts_marked_empty_case_with_blank_gap_test.go +30 -0
  1487. package/linthost/no_fallthrough_accepts_marked_fallthrough_variants_test.go +43 -0
  1488. package/linthost/no_fallthrough_accepts_marker_in_sole_empty_block_test.go +30 -0
  1489. package/linthost/no_fallthrough_accepts_marker_inside_sole_block_statement_test.go +32 -0
  1490. package/linthost/no_fallthrough_accepts_nested_switch_terminating_on_every_path_test.go +38 -0
  1491. package/linthost/no_fallthrough_accepts_terminating_finally_test.go +34 -0
  1492. package/linthost/no_fallthrough_accepts_terminating_try_and_catch_with_normal_finally_test.go +41 -0
  1493. package/linthost/no_fallthrough_accepts_unreachable_labeled_break_in_while_false_test.go +39 -0
  1494. package/linthost/no_fallthrough_accepts_unreachable_labeled_break_in_while_zero_test.go +37 -0
  1495. package/linthost/no_fallthrough_accepts_while_bigint_one_literal_test.go +31 -0
  1496. package/linthost/no_fallthrough_accepts_while_nonempty_string_literal_test.go +31 -0
  1497. package/linthost/no_fallthrough_accepts_while_numeric_one_literal_test.go +31 -0
  1498. package/linthost/no_fallthrough_accepts_while_regex_literal_test.go +31 -0
  1499. package/linthost/no_fallthrough_accepts_with_statement_body_break_test.go +33 -0
  1500. package/linthost/no_fallthrough_allow_empty_case_permits_blank_line_gap_test.go +29 -0
  1501. package/linthost/no_fallthrough_command_composes_nested_try_finally_test.go +124 -0
  1502. package/linthost/no_fallthrough_command_composes_statement_and_loop_throw_edges_test.go +108 -0
  1503. package/linthost/no_fallthrough_command_helpers_test.go +68 -0
  1504. package/linthost/no_fallthrough_command_preserves_bigint_literal_truthiness_test.go +82 -0
  1505. package/linthost/no_fallthrough_command_preserves_catch_break_continue_test.go +66 -0
  1506. package/linthost/no_fallthrough_command_preserves_code_path_boundaries_test.go +136 -0
  1507. package/linthost/no_fallthrough_command_preserves_jsx_code_path_boundaries_test.go +68 -0
  1508. package/linthost/no_fallthrough_command_preserves_markers_across_catch_reachability_test.go +40 -0
  1509. package/linthost/no_fallthrough_command_tracks_binding_reference_edges_test.go +70 -0
  1510. package/linthost/no_fallthrough_command_tracks_return_exception_edges_test.go +79 -0
  1511. package/linthost/no_fallthrough_custom_pattern_replaces_default_marker_test.go +32 -0
  1512. package/linthost/no_fallthrough_directive_suppression_still_wins_test.go +32 -0
  1513. package/linthost/no_fallthrough_helpers_test.go +55 -0
  1514. package/linthost/no_fallthrough_honors_custom_comment_pattern_test.go +30 -0
  1515. package/linthost/no_fallthrough_ignores_switch_without_clauses_test.go +24 -0
  1516. package/linthost/no_fallthrough_ignores_trailing_unreachable_statements_test.go +33 -0
  1517. package/linthost/no_fallthrough_ignores_unreachable_break_in_infinite_loop_test.go +35 -0
  1518. package/linthost/no_fallthrough_invalid_comment_pattern_falls_back_to_default_test.go +31 -0
  1519. package/linthost/no_fallthrough_never_reports_last_open_case_test.go +27 -0
  1520. package/linthost/no_fallthrough_rejects_breakable_conditional_while_test.go +33 -0
  1521. package/linthost/no_fallthrough_rejects_directive_comment_as_marker_test.go +31 -0
  1522. package/linthost/no_fallthrough_rejects_do_while_exited_by_labeled_continue_test.go +34 -0
  1523. package/linthost/no_fallthrough_rejects_do_while_exited_by_unlabeled_continue_test.go +33 -0
  1524. package/linthost/no_fallthrough_rejects_do_while_with_break_test.go +32 -0
  1525. package/linthost/no_fallthrough_rejects_empty_case_followed_by_blank_line_test.go +30 -0
  1526. package/linthost/no_fallthrough_rejects_empty_case_with_comment_line_gap_test.go +31 -0
  1527. package/linthost/no_fallthrough_rejects_empty_statement_case_despite_allow_empty_case_test.go +29 -0
  1528. package/linthost/no_fallthrough_rejects_for_of_with_always_throwing_body_test.go +33 -0
  1529. package/linthost/no_fallthrough_rejects_if_else_with_one_open_branch_test.go +36 -0
  1530. package/linthost/no_fallthrough_rejects_if_without_else_test.go +33 -0
  1531. package/linthost/no_fallthrough_rejects_infinite_loop_broken_by_own_label_test.go +32 -0
  1532. package/linthost/no_fallthrough_rejects_infinite_while_containing_break_test.go +32 -0
  1533. package/linthost/no_fallthrough_rejects_labeled_block_broken_by_own_label_test.go +33 -0
  1534. package/linthost/no_fallthrough_rejects_lint_directive_comment_as_marker_test.go +31 -0
  1535. package/linthost/no_fallthrough_rejects_marker_before_last_statement_test.go +32 -0
  1536. package/linthost/no_fallthrough_rejects_marker_in_block_that_is_not_sole_statement_test.go +31 -0
  1537. package/linthost/no_fallthrough_rejects_marker_inside_nested_inner_block_test.go +31 -0
  1538. package/linthost/no_fallthrough_rejects_nested_switch_exited_by_inner_break_test.go +34 -0
  1539. package/linthost/no_fallthrough_rejects_nested_switch_without_default_test.go +36 -0
  1540. package/linthost/no_fallthrough_rejects_non_literal_constant_condition_test.go +33 -0
  1541. package/linthost/no_fallthrough_rejects_normally_completing_catch_test.go +34 -0
  1542. package/linthost/no_fallthrough_rejects_open_try_with_normal_finally_test.go +34 -0
  1543. package/linthost/no_fallthrough_rejects_return_inside_arrow_test.go +32 -0
  1544. package/linthost/no_fallthrough_rejects_return_inside_function_declaration_test.go +33 -0
  1545. package/linthost/no_fallthrough_rejects_return_inside_function_expression_test.go +33 -0
  1546. package/linthost/no_fallthrough_rejects_unrelated_comment_in_sole_empty_block_test.go +29 -0
  1547. package/linthost/no_fallthrough_rejects_unrelated_trailing_comment_test.go +30 -0
  1548. package/linthost/no_fallthrough_reports_case_message_after_leading_default_test.go +37 -0
  1549. package/linthost/no_fallthrough_reports_default_message_for_default_clause_test.go +35 -0
  1550. package/linthost/no_fallthrough_reports_each_unmarked_transition_once_test.go +32 -0
  1551. package/linthost/no_fallthrough_reports_inner_and_outer_switch_transitions_test.go +37 -0
  1552. package/linthost/no_fallthrough_reports_unused_comment_after_terminating_if_else_test.go +46 -0
  1553. package/linthost/no_fallthrough_reports_unused_comment_inside_sole_block_test.go +36 -0
  1554. package/linthost/no_fallthrough_reports_unused_fallthrough_comment_test.go +38 -0
  1555. package/linthost/no_fallthrough_reports_unused_marker_after_unreachable_catch_test.go +37 -0
  1556. package/linthost/no_fallthrough_requires_marker_to_be_last_comment_test.go +32 -0
  1557. package/linthost/no_fallthrough_unused_check_accepts_real_fallthrough_marker_test.go +30 -0
  1558. package/linthost/no_fallthrough_unused_check_ignores_non_marker_comment_test.go +31 -0
  1559. package/linthost/no_fallthrough_unused_check_skips_last_case_marker_test.go +28 -0
  1560. package/linthost/no_fallthrough_unused_check_skips_reachable_empty_case_test.go +30 -0
  1561. package/linthost/no_fallthrough_unused_comment_ignored_by_default_test.go +31 -0
  1562. package/linthost/no_floating_promises_credits_a_handler_through_an_optional_chain_test.go +55 -0
  1563. package/linthost/no_floating_promises_default_semantics_test.go +48 -0
  1564. package/linthost/no_floating_promises_detects_index_value_type_parameters_test.go +145 -0
  1565. package/linthost/no_floating_promises_handler_chains_test.go +53 -0
  1566. package/linthost/no_floating_promises_helpers_test.go +43 -0
  1567. package/linthost/no_floating_promises_iife_test.go +32 -0
  1568. package/linthost/no_floating_promises_javascript_generic_defaults_test.go +177 -0
  1569. package/linthost/no_floating_promises_mixed_receiver_results_test.go +222 -0
  1570. package/linthost/no_floating_promises_options_test.go +56 -0
  1571. package/linthost/no_floating_promises_preserves_call_resolution_test.go +291 -0
  1572. package/linthost/no_floating_promises_preserves_candidate_context_literals_test.go +289 -0
  1573. package/linthost/no_floating_promises_preserves_contextual_callback_returns_test.go +208 -0
  1574. package/linthost/no_floating_promises_preserves_migrated_default_contexts_test.go +20 -0
  1575. package/linthost/no_floating_promises_preserves_optional_callback_overloads_test.go +42 -0
  1576. package/linthost/no_floating_promises_preserves_subtype_overload_priority_test.go +40 -0
  1577. package/linthost/no_floating_promises_rejects_inapplicable_generic_receiver_branches_test.go +254 -0
  1578. package/linthost/no_floating_promises_rejects_opaque_mapped_type_parameters_test.go +159 -0
  1579. package/linthost/no_floating_promises_safe_calls_in_composites_specifiers_test.go +43 -0
  1580. package/linthost/no_floating_promises_safe_calls_in_composites_test.go +88 -0
  1581. package/linthost/no_floating_promises_specifiers_test.go +108 -0
  1582. package/linthost/no_floating_promises_test.go +46 -0
  1583. package/linthost/no_floating_promises_thenable_scope_follows_check_thenables_test.go +87 -0
  1584. package/linthost/no_floating_promises_type_shapes_test.go +100 -0
  1585. package/linthost/no_for_in_array_test.go +49 -0
  1586. package/linthost/no_func_assign_test.go +195 -0
  1587. package/linthost/no_import_assign_binding_identity_and_complete_writes_test.go +140 -0
  1588. package/linthost/no_import_assign_binding_identity_helpers_test.go +114 -0
  1589. package/linthost/no_import_assign_ignores_resolved_shadows_and_deeper_values_test.go +118 -0
  1590. package/linthost/no_import_assign_recognizes_every_assignment_operator_test.go +36 -0
  1591. package/linthost/no_import_assign_test.go +48 -0
  1592. package/linthost/no_inner_declarations_both_mode_test.go +73 -0
  1593. package/linthost/no_inner_declarations_default_allows_strict_script_block_functions_test.go +33 -0
  1594. package/linthost/no_inner_declarations_default_module_test.go +35 -0
  1595. package/linthost/no_inner_declarations_default_strict_context_test.go +93 -0
  1596. package/linthost/no_inner_declarations_disallow_block_functions_test.go +57 -0
  1597. package/linthost/no_inner_declarations_helpers_test.go +32 -0
  1598. package/linthost/no_invalid_this_accepts_class_field_initializers_test.go +32 -0
  1599. package/linthost/no_irregular_whitespace_allows_string_literals_and_reports_code_test.go +44 -0
  1600. package/linthost/no_loop_func_allows_safe_bindings_and_excluded_headers_test.go +67 -0
  1601. package/linthost/no_loop_func_allows_using_bindings_test.go +52 -0
  1602. package/linthost/no_loop_func_checks_all_runtime_function_forms_test.go +52 -0
  1603. package/linthost/no_loop_func_helpers_test.go +55 -0
  1604. package/linthost/no_loop_func_iife_boundaries_test.go +41 -0
  1605. package/linthost/no_loop_func_reports_only_unsafe_references_test.go +83 -0
  1606. package/linthost/no_loop_func_test.go +68 -0
  1607. package/linthost/no_loop_func_tracks_write_forms_and_symbol_identity_test.go +49 -0
  1608. package/linthost/no_loop_func_treats_class_field_initializers_as_variable_scopes_test.go +46 -0
  1609. package/linthost/no_loss_of_precision_accepts_exact_unsafe_integer_test.go +36 -0
  1610. package/linthost/no_loss_of_precision_handles_every_number_syntax_test.go +93 -0
  1611. package/linthost/no_loss_of_precision_rejects_huge_decimal_integer_test.go +28 -0
  1612. package/linthost/no_meaningless_void_operator_test.go +48 -0
  1613. package/linthost/no_misused_promises_arguments_test.go +82 -0
  1614. package/linthost/no_misused_promises_defaults_test.go +89 -0
  1615. package/linthost/no_misused_promises_helpers_test.go +135 -0
  1616. package/linthost/no_misused_promises_native_array_predicates_test.go +91 -0
  1617. package/linthost/no_misused_promises_options_test.go +103 -0
  1618. package/linthost/no_misused_promises_preserves_migrated_default_contexts_test.go +23 -0
  1619. package/linthost/no_misused_promises_test.go +53 -0
  1620. package/linthost/no_mixed_operators_allow_same_precedence_false_flags_additive_test.go +42 -0
  1621. package/linthost/no_mixed_operators_allows_bitwise_beside_comparison_test.go +26 -0
  1622. package/linthost/no_mixed_operators_allows_bitwise_beside_logical_test.go +25 -0
  1623. package/linthost/no_mixed_operators_allows_parenthesized_inner_test.go +27 -0
  1624. package/linthost/no_mixed_operators_allows_relational_same_precedence_test.go +27 -0
  1625. package/linthost/no_mixed_operators_allows_same_operator_chain_test.go +26 -0
  1626. package/linthost/no_mixed_operators_allows_same_precedence_multiplicative_test.go +26 -0
  1627. package/linthost/no_mixed_operators_allows_ternary_beside_logical_by_default_test.go +27 -0
  1628. package/linthost/no_mixed_operators_custom_groups_omitting_arithmetic_allow_test.go +28 -0
  1629. package/linthost/no_mixed_operators_custom_groups_ternary_flags_logical_test.go +43 -0
  1630. package/linthost/no_mixed_operators_flags_logical_and_left_of_or_test.go +27 -0
  1631. package/linthost/no_mixed_operators_flags_logical_and_right_of_or_test.go +27 -0
  1632. package/linthost/no_mixed_operators_flags_multiplicative_within_additive_test.go +26 -0
  1633. package/linthost/no_mixed_operators_flags_relational_within_equality_test.go +28 -0
  1634. package/linthost/no_mixed_operators_flags_shift_within_bitwise_test.go +28 -0
  1635. package/linthost/no_mixed_operators_reports_both_operator_tokens_test.go +60 -0
  1636. package/linthost/no_namespace_exempts_global_augmentation_test.go +52 -0
  1637. package/linthost/no_param_reassign_complete_semantics_test.go +75 -0
  1638. package/linthost/no_param_reassign_default_props_leaves_property_writes_alone_test.go +38 -0
  1639. package/linthost/no_param_reassign_helpers_test.go +63 -0
  1640. package/linthost/no_param_reassign_options_validation_helpers_test.go +12 -0
  1641. package/linthost/no_param_reassign_options_validation_test.go +58 -0
  1642. package/linthost/no_param_reassign_options_validator_rejects_every_invalid_schema_boundary_test.go +109 -0
  1643. package/linthost/no_param_reassign_props_follows_official_mutation_boundaries_and_ignores_test.go +89 -0
  1644. package/linthost/no_param_reassign_test.go +52 -0
  1645. package/linthost/no_param_reassign_uses_checker_identity_across_nested_scopes_test.go +73 -0
  1646. package/linthost/no_promise_executor_return_allow_void_test.go +80 -0
  1647. package/linthost/no_promise_executor_return_complete_semantics_test.go +145 -0
  1648. package/linthost/no_promise_executor_return_test.go +35 -0
  1649. package/linthost/no_promise_in_fire_event_test.go +36 -0
  1650. package/linthost/no_redeclare_relates_first_definition_test.go +55 -0
  1651. package/linthost/no_render_in_lifecycle_test.go +35 -0
  1652. package/linthost/no_restricted_imports_allow_type_imports_handles_whole_and_inline_type_syntax_test.go +57 -0
  1653. package/linthost/no_restricted_imports_allowed_name_pattern_covers_imports_and_reexports_test.go +32 -0
  1654. package/linthost/no_restricted_imports_allowed_names_reject_only_the_complement_test.go +43 -0
  1655. package/linthost/no_restricted_imports_exact_paths_cover_every_static_module_form_test.go +77 -0
  1656. package/linthost/no_restricted_imports_exact_paths_preserve_module_specifier_whitespace_test.go +31 -0
  1657. package/linthost/no_restricted_imports_groups_keep_gitignore_anchors_globstars_and_unicode_test.go +78 -0
  1658. package/linthost/no_restricted_imports_matches_source_names_and_reports_exact_specifier_ranges_test.go +71 -0
  1659. package/linthost/no_restricted_imports_missing_and_empty_restrictions_are_no_op_test.go +42 -0
  1660. package/linthost/no_restricted_imports_options_helpers_test.go +76 -0
  1661. package/linthost/no_restricted_imports_patterns_honor_negation_case_regex_and_name_patterns_test.go +46 -0
  1662. package/linthost/no_restricted_imports_positional_paths_do_not_reach_dynamic_imports_test.go +32 -0
  1663. package/linthost/no_restricted_imports_string_patterns_keep_gitignore_parent_negation_semantics_test.go +30 -0
  1664. package/linthost/no_restricted_imports_test.go +14 -0
  1665. package/linthost/no_restricted_imports_validator_accepts_every_official_option_branch_test.go +48 -0
  1666. package/linthost/no_restricted_imports_validator_rejects_malformed_configuration_at_the_boundary_test.go +64 -0
  1667. package/linthost/no_restricted_syntax_applies_every_configured_entry_and_custom_message_test.go +45 -0
  1668. package/linthost/no_restricted_syntax_checks_structured_option_uniqueness_by_fields_test.go +40 -0
  1669. package/linthost/no_restricted_syntax_coerces_empty_node_lists_for_numeric_comparisons_test.go +34 -0
  1670. package/linthost/no_restricted_syntax_compares_strings_as_utf16_test.go +37 -0
  1671. package/linthost/no_restricted_syntax_distinguishes_assignment_patterns_from_literals_test.go +81 -0
  1672. package/linthost/no_restricted_syntax_distinguishes_object_binding_properties_from_rest_test.go +44 -0
  1673. package/linthost/no_restricted_syntax_distinguishes_rest_and_spread_aliases_test.go +54 -0
  1674. package/linthost/no_restricted_syntax_exposes_computed_keys_and_property_value_paths_test.go +34 -0
  1675. package/linthost/no_restricted_syntax_exposes_scalar_statement_bodies_test.go +43 -0
  1676. package/linthost/no_restricted_syntax_exposes_switch_case_test_and_consequent_test.go +36 -0
  1677. package/linthost/no_restricted_syntax_helpers_test.go +56 -0
  1678. package/linthost/no_restricted_syntax_inherits_declare_from_variable_statements_test.go +42 -0
  1679. package/linthost/no_restricted_syntax_keeps_template_and_literal_aliases_distinct_test.go +32 -0
  1680. package/linthost/no_restricted_syntax_limits_boolean_properties_and_es_tree_aliases_test.go +51 -0
  1681. package/linthost/no_restricted_syntax_matches_attributes_nested_paths_regex_types_and_lengths_test.go +47 -0
  1682. package/linthost/no_restricted_syntax_matches_classes_alternatives_and_type_script_nodes_test.go +61 -0
  1683. package/linthost/no_restricted_syntax_matches_combinators_fields_pseudos_and_subjects_test.go +111 -0
  1684. package/linthost/no_restricted_syntax_matches_indexed_paths_literal_types_and_prefix_test.go +169 -0
  1685. package/linthost/no_restricted_syntax_preserves_null_across_nested_paths_test.go +35 -0
  1686. package/linthost/no_restricted_syntax_rejects_invalid_configuration_before_dispatch_test.go +58 -0
  1687. package/linthost/no_restricted_syntax_reports_matches_in_source_order_test.go +36 -0
  1688. package/linthost/no_restricted_syntax_stringifies_regular_expression_values_test.go +38 -0
  1689. package/linthost/no_restricted_syntax_test.go +29 -0
  1690. package/linthost/no_restricted_syntax_uses_the_last_message_for_a_repeated_selector_test.go +37 -0
  1691. package/linthost/no_restricted_types_external_config_validates_at_engine_binding_test.go +39 -0
  1692. package/linthost/no_restricted_types_fixes_whole_qualified_generic_and_empty_type_surfaces_test.go +56 -0
  1693. package/linthost/no_restricted_types_has_no_implicit_defaults_test.go +51 -0
  1694. package/linthost/no_restricted_types_helpers_test.go +63 -0
  1695. package/linthost/no_restricted_types_later_whitespace_equivalent_key_wins_test.go +40 -0
  1696. package/linthost/no_restricted_types_matches_every_official_type_surface_exactly_test.go +144 -0
  1697. package/linthost/no_restricted_types_options_accept_complete_runtime_schema_test.go +54 -0
  1698. package/linthost/no_restricted_types_options_reject_malformed_schema_boundaries_test.go +60 -0
  1699. package/linthost/no_restricted_types_rejects_only_exact_type_syntax_test.go +56 -0
  1700. package/linthost/no_restricted_types_runs_on_declaration_files_test.go +36 -0
  1701. package/linthost/no_restricted_types_structured_policy_provides_fix_and_every_suggestion_test.go +172 -0
  1702. package/linthost/no_restricted_types_uses_configured_surface_spelling_across_symbols_test.go +74 -0
  1703. package/linthost/no_restricted_types_validation_helpers_test.go +12 -0
  1704. package/linthost/no_return_assign_allows_parenthesized_assignment_test.go +91 -0
  1705. package/linthost/no_types_test.go +29 -0
  1706. package/linthost/no_undef_init_ignores_const_declarations_test.go +33 -0
  1707. package/linthost/no_uninstalled_addons_test.go +45 -0
  1708. package/linthost/no_unnecessary_act_test.go +38 -0
  1709. package/linthost/no_unnecessary_boolean_literal_compare_test.go +50 -0
  1710. package/linthost/no_unnecessary_condition_test.go +50 -0
  1711. package/linthost/no_unnecessary_qualifier_test.go +121 -0
  1712. package/linthost/no_unnecessary_template_expression_test.go +48 -0
  1713. package/linthost/no_unnecessary_type_arguments_leaves_unresolved_aliases_alone_test.go +42 -0
  1714. package/linthost/no_unnecessary_type_arguments_preserves_callable_semantics_test.go +98 -0
  1715. package/linthost/no_unnecessary_type_arguments_preserves_heritage_defaults_test.go +38 -0
  1716. package/linthost/no_unnecessary_type_arguments_resolves_imported_aliases_test.go +58 -0
  1717. package/linthost/no_unnecessary_type_arguments_test.go +49 -0
  1718. package/linthost/no_unnecessary_type_assertion_test.go +48 -0
  1719. package/linthost/no_unneeded_ternary_fix_false_true_branches_test.go +34 -0
  1720. package/linthost/no_unneeded_ternary_fix_false_true_with_low_precedence_cond_test.go +29 -0
  1721. package/linthost/no_unneeded_ternary_fix_true_false_branches_test.go +28 -0
  1722. package/linthost/no_unneeded_ternary_uses_intrinsic_boolean_coercion_test.go +28 -0
  1723. package/linthost/no_unreachable_reports_one_region_and_exempts_hoisted_declarations_test.go +50 -0
  1724. package/linthost/no_unsafe_argument_test.go +50 -0
  1725. package/linthost/no_unsafe_assignment_aliases_test.go +28 -0
  1726. package/linthost/no_unsafe_assignment_array_destructuring_test.go +33 -0
  1727. package/linthost/no_unsafe_assignment_array_spreads_test.go +29 -0
  1728. package/linthost/no_unsafe_assignment_binding_defaults_test.go +39 -0
  1729. package/linthost/no_unsafe_assignment_class_initializers_test.go +30 -0
  1730. package/linthost/no_unsafe_assignment_destructuring_reassignment_test.go +33 -0
  1731. package/linthost/no_unsafe_assignment_direct_declarations_test.go +28 -0
  1732. package/linthost/no_unsafe_assignment_empty_map_test.go +26 -0
  1733. package/linthost/no_unsafe_assignment_generic_constraints_test.go +33 -0
  1734. package/linthost/no_unsafe_assignment_helpers_test.go +114 -0
  1735. package/linthost/no_unsafe_assignment_jsx_attributes_test.go +31 -0
  1736. package/linthost/no_unsafe_assignment_mapped_types_test.go +29 -0
  1737. package/linthost/no_unsafe_assignment_object_destructuring_test.go +43 -0
  1738. package/linthost/no_unsafe_assignment_object_literals_test.go +31 -0
  1739. package/linthost/no_unsafe_assignment_parameter_defaults_test.go +37 -0
  1740. package/linthost/no_unsafe_assignment_preserves_migrated_assignment_sites_test.go +42 -0
  1741. package/linthost/no_unsafe_assignment_readonly_arrays_test.go +27 -0
  1742. package/linthost/no_unsafe_assignment_reassignment_test.go +29 -0
  1743. package/linthost/no_unsafe_assignment_recursive_generics_test.go +26 -0
  1744. package/linthost/no_unsafe_assignment_recursive_types_test.go +30 -0
  1745. package/linthost/no_unsafe_assignment_tuples_test.go +26 -0
  1746. package/linthost/no_unsafe_assignment_unions_intersections_test.go +40 -0
  1747. package/linthost/no_unsafe_call_test.go +49 -0
  1748. package/linthost/no_unsafe_enum_comparison_test.go +51 -0
  1749. package/linthost/no_unsafe_finally_resolves_jump_targets_inside_and_outside_the_finally_test.go +40 -0
  1750. package/linthost/no_unsafe_member_access_test.go +50 -0
  1751. package/linthost/no_unsafe_optional_chaining_preserves_contiguous_chain_test.go +28 -0
  1752. package/linthost/no_unsafe_return_test.go +52 -0
  1753. package/linthost/no_unsafe_unary_minus_test.go +47 -0
  1754. package/linthost/no_unused_expressions_allows_jsx_by_default_test.go +38 -0
  1755. package/linthost/no_unused_expressions_allows_productive_kinds_test.go +61 -0
  1756. package/linthost/no_unused_expressions_composes_short_circuit_and_ternary_test.go +60 -0
  1757. package/linthost/no_unused_expressions_directive_prologue_positions_test.go +63 -0
  1758. package/linthost/no_unused_expressions_honors_allow_short_circuit_test.go +59 -0
  1759. package/linthost/no_unused_expressions_honors_allow_tagged_templates_test.go +52 -0
  1760. package/linthost/no_unused_expressions_honors_allow_ternary_test.go +58 -0
  1761. package/linthost/no_unused_expressions_honors_enforce_for_jsx_test.go +56 -0
  1762. package/linthost/no_unused_expressions_honors_ignore_directives_test.go +62 -0
  1763. package/linthost/no_unused_expressions_preserves_migrated_default_controls_test.go +29 -0
  1764. package/linthost/no_unused_expressions_ts_wrappers_inherit_classification_test.go +61 -0
  1765. package/linthost/no_useless_catch_reports_a_rethrowing_catch_with_and_without_finally_test.go +42 -0
  1766. package/linthost/no_useless_constructor_preserves_argument_filtering_test.go +44 -0
  1767. package/linthost/no_useless_empty_export_allows_module_marker_test.go +36 -0
  1768. package/linthost/no_useless_escape_flags_regex_character_class_test.go +53 -0
  1769. package/linthost/no_useless_escape_invalid_utf8_names_replacement_character_test.go +63 -0
  1770. package/linthost/no_useless_escape_judges_quotes_and_template_escapes_by_enclosing_delimiter_test.go +58 -0
  1771. package/linthost/no_useless_escape_message_names_decoded_rune_test.go +74 -0
  1772. package/linthost/no_useless_escape_multibyte_range_covers_backslash_only_test.go +71 -0
  1773. package/linthost/no_useless_escape_nested_untagged_template_in_tagged_substitution_test.go +67 -0
  1774. package/linthost/no_useless_escape_v_flag_class_preserves_syntax_char_escapes_test.go +60 -0
  1775. package/linthost/no_useless_rename_declines_fix_when_comment_between_names_test.go +38 -0
  1776. package/linthost/no_useless_rename_offers_withheld_tail_deletion_as_suggestion_test.go +37 -0
  1777. package/linthost/no_var_preserves_loop_body_retained_values_test.go +33 -0
  1778. package/linthost/no_var_skips_ambient_declare_var_test.go +55 -0
  1779. package/linthost/no_var_skips_declaration_file_vars_test.go +41 -0
  1780. package/linthost/no_var_skips_using_declarations_test.go +44 -0
  1781. package/linthost/node_config_loader_env_prepends_nearest_node_modules_test.go +51 -0
  1782. package/linthost/node_package_manifest_from_resolves_a_relative_anchor_test.go +56 -0
  1783. package/linthost/node_package_manifest_from_skips_a_node_modules_directory_test.go +51 -0
  1784. package/linthost/node_platform_pair_matches_the_npm_platform_vocabulary_test.go +62 -0
  1785. package/linthost/node_report_bounds_before_skipping_trivia_test.go +44 -0
  1786. package/linthost/node_spans_multiple_lines_returns_false_for_nil_node_test.go +41 -0
  1787. package/linthost/node_suggestions_preserve_owned_edit_channels_test.go +86 -0
  1788. package/linthost/non_nullable_type_assertion_style_test.go +49 -0
  1789. package/linthost/object_shorthand_declines_fix_when_comment_in_value_span_test.go +38 -0
  1790. package/linthost/object_shorthand_offers_withheld_collapse_as_suggestion_test.go +37 -0
  1791. package/linthost/only_throw_error_test.go +44 -0
  1792. package/linthost/override_glob_matches_a_file_named_through_a_miscased_import_test.go +49 -0
  1793. package/linthost/override_glob_stored_case_preserves_character_class_test.go +41 -0
  1794. package/linthost/parse_config_store_accepts_severity_tuples_test.go +49 -0
  1795. package/linthost/parse_config_store_keeps_ignores_entry_scoped_when_files_present_test.go +56 -0
  1796. package/linthost/parse_config_store_promotes_global_ignores_alongside_rules_test.go +56 -0
  1797. package/linthost/parse_config_store_promotes_global_ignores_with_format_block_test.go +53 -0
  1798. package/linthost/parse_config_store_resolves_files_and_ignores_test.go +70 -0
  1799. package/linthost/parse_external_rule_entry_preserves_three_slot_tuple_test.go +54 -0
  1800. package/linthost/parse_external_rule_entry_treats_null_second_slot_as_no_options_test.go +35 -0
  1801. package/linthost/parse_plugins_blank_payload_returns_nil_test.go +29 -0
  1802. package/linthost/parse_plugins_rejects_bad_json_test.go +31 -0
  1803. package/linthost/parse_plugins_round_trip_test.go +51 -0
  1804. package/linthost/parse_rules_accepts_eslint_tuples_in_standard_inline_config_test.go +64 -0
  1805. package/linthost/parse_rules_accepts_legacy_numeric_severities_test.go +44 -0
  1806. package/linthost/parse_rules_accepts_string_severities_test.go +60 -0
  1807. package/linthost/parse_rules_nil_treated_as_empty_test.go +35 -0
  1808. package/linthost/parse_rules_preserves_positional_options_test.go +75 -0
  1809. package/linthost/parse_subcommand_flags_accepts_common_flag_combinations_test.go +57 -0
  1810. package/linthost/playwright_no_force_option_ignores_non_playwright_options_test.go +35 -0
  1811. package/linthost/playwright_no_networkidle_ignores_non_playwright_wait_until_test.go +35 -0
  1812. package/linthost/prefer_as_const_preserves_migrated_all_family_contexts_test.go +20 -0
  1813. package/linthost/prefer_as_const_property_annotation_offers_exact_suggestion_test.go +41 -0
  1814. package/linthost/prefer_as_const_variable_annotation_offers_exact_suggestion_test.go +41 -0
  1815. package/linthost/prefer_const_allows_reads_in_destructuring_pattern_test.go +43 -0
  1816. package/linthost/prefer_const_counts_non_null_assignment_target_by_symbol_test.go +24 -0
  1817. package/linthost/prefer_const_counts_parenthesized_update_target_by_symbol_test.go +26 -0
  1818. package/linthost/prefer_const_counts_write_forms_by_symbol_test.go +57 -0
  1819. package/linthost/prefer_const_honors_destructuring_option_test.go +77 -0
  1820. package/linthost/prefer_const_honors_ignore_read_before_assign_for_shorthand_read_test.go +30 -0
  1821. package/linthost/prefer_const_honors_ignore_read_before_assign_test.go +58 -0
  1822. package/linthost/prefer_const_preserves_migrated_lexical_fixture_test.go +112 -0
  1823. package/linthost/prefer_const_test.go +57 -0
  1824. package/linthost/prefer_const_tracks_lexical_binding_identity_test.go +60 -0
  1825. package/linthost/prefer_explicit_assert_test.go +36 -0
  1826. package/linthost/prefer_find_test.go +48 -0
  1827. package/linthost/prefer_implicit_assert_test.go +36 -0
  1828. package/linthost/prefer_includes_test.go +49 -0
  1829. package/linthost/prefer_presence_queries_test.go +37 -0
  1830. package/linthost/prefer_promise_reject_errors_test.go +45 -0
  1831. package/linthost/prefer_query_by_disappearance_test.go +35 -0
  1832. package/linthost/prefer_query_matchers_test.go +37 -0
  1833. package/linthost/prefer_readonly_preserves_mutated_private_fields_test.go +57 -0
  1834. package/linthost/prefer_reduce_type_parameter_test.go +56 -0
  1835. package/linthost/prefer_regexp_exec_test.go +48 -0
  1836. package/linthost/prefer_return_this_type_requires_all_completion_paths_test.go +43 -0
  1837. package/linthost/prefer_return_this_type_test.go +55 -0
  1838. package/linthost/prefer_screen_queries_test.go +39 -0
  1839. package/linthost/prefer_string_starts_ends_with_test.go +52 -0
  1840. package/linthost/prefer_template_declines_fix_when_comment_in_concat_span_test.go +50 -0
  1841. package/linthost/prefer_template_fix_embeds_numeric_subchain_as_single_slot_test.go +33 -0
  1842. package/linthost/prefer_template_fix_escapes_backtick_in_literal_test.go +32 -0
  1843. package/linthost/prefer_template_fix_escapes_dollar_brace_seam_test.go +33 -0
  1844. package/linthost/prefer_template_fix_flattens_operands_after_leading_string_test.go +34 -0
  1845. package/linthost/prefer_template_fix_ignores_string_under_other_operator_test.go +32 -0
  1846. package/linthost/prefer_template_fix_keeps_parenthesized_subchain_single_slot_test.go +32 -0
  1847. package/linthost/prefer_template_fix_leading_identifier_chain_test.go +30 -0
  1848. package/linthost/prefer_template_fix_preserves_carriage_return_test.go +33 -0
  1849. package/linthost/prefer_template_fix_preserves_newline_test.go +30 -0
  1850. package/linthost/prefer_template_fix_preserves_template_operand_group_test.go +27 -0
  1851. package/linthost/prefer_template_fix_renders_empty_string_operand_with_default_coercion_test.go +31 -0
  1852. package/linthost/prefer_template_fix_sees_string_through_parens_when_flattening_test.go +34 -0
  1853. package/linthost/prefer_template_fix_three_part_concat_test.go +31 -0
  1854. package/linthost/prefer_template_offers_withheld_template_as_suggestion_test.go +37 -0
  1855. package/linthost/prefer_template_preserves_default_coercion_hint_test.go +30 -0
  1856. package/linthost/prefer_template_skips_all_literal_chain_test.go +27 -0
  1857. package/linthost/prefer_template_skips_numeric_only_chain_test.go +28 -0
  1858. package/linthost/prefer_user_event_setup_ignores_setup_call_test.go +35 -0
  1859. package/linthost/print_arg_list_emits_trailing_comma_when_mode_all_test.go +38 -0
  1860. package/linthost/print_arg_list_omits_trailing_comma_when_mode_es5_test.go +39 -0
  1861. package/linthost/print_arg_list_omits_trailing_comma_when_mode_none_test.go +39 -0
  1862. package/linthost/print_arg_list_returns_parens_for_nil_list_test.go +30 -0
  1863. package/linthost/print_call_expression_falls_back_verbatim_when_args_contain_nil_test.go +43 -0
  1864. package/linthost/print_call_expression_includes_question_dot_token_test.go +36 -0
  1865. package/linthost/print_call_expression_includes_type_arguments_test.go +34 -0
  1866. package/linthost/print_call_expression_returns_empty_for_nil_node_test.go +29 -0
  1867. package/linthost/print_dispatch.go +50 -15
  1868. package/linthost/print_doc.go +206 -41
  1869. package/linthost/print_engine.go +78 -51
  1870. package/linthost/print_new_expression_falls_back_verbatim_when_args_contain_nil_test.go +42 -0
  1871. package/linthost/print_new_expression_includes_type_arguments_test.go +36 -0
  1872. package/linthost/print_new_expression_omits_argument_list_when_absent_test.go +36 -0
  1873. package/linthost/print_new_expression_returns_empty_for_nil_node_test.go +28 -0
  1874. package/linthost/print_node_returns_empty_for_nil_node_test.go +31 -0
  1875. package/linthost/print_nodes_control_flow.go +4 -4
  1876. package/linthost/print_nodes_function.go +9 -11
  1877. package/linthost/print_nodes_imports.go +8 -11
  1878. package/linthost/print_nodes_object.go +3 -6
  1879. package/linthost/printer_test_helpers_test.go +46 -0
  1880. package/linthost/project_companion_preserves_file_scoped_rule_config_test.go +45 -0
  1881. package/linthost/project_contributor_ast_only_marker_keeps_parallel_walk_test.go +54 -0
  1882. package/linthost/project_contributor_generic_accepts_options_method_keeps_legacy_payload_test.go +81 -0
  1883. package/linthost/project_contributor_optionless_marker_rejects_payload_test.go +62 -0
  1884. package/linthost/project_contributor_without_marker_keeps_options_compatibility_test.go +70 -0
  1885. package/linthost/project_contributor_without_marker_keeps_type_checker_test.go +53 -0
  1886. package/linthost/project_engine.go +8 -0
  1887. package/linthost/project_hint_collection_requires_passed_published_state_test.go +105 -0
  1888. package/linthost/project_hint_publication_filters_malformed_and_recovers_panic_test.go +66 -0
  1889. package/linthost/project_identity_mints_distinct_program_lifecycles_test.go +51 -0
  1890. package/linthost/project_input_reader.go +358 -0
  1891. package/linthost/project_input_snapshot_normalizes_windows_case_and_separators_test.go +43 -0
  1892. package/linthost/project_input_snapshot_preserves_missing_files_zero_match_globs_and_config_provenance_test.go +130 -0
  1893. package/linthost/project_input_snapshot_reconciles_options_and_physical_paths_test.go +108 -0
  1894. package/linthost/project_input_snapshot_rejects_remote_urls_test.go +59 -0
  1895. package/linthost/project_inputs.go +31 -4
  1896. package/linthost/project_inputs_command_publishes_configured_snapshot_without_program_test.go +115 -0
  1897. package/linthost/project_rule_config_folds_global_extends_and_options_test.go +68 -0
  1898. package/linthost/project_rule_config_rejects_any_files_selector_test.go +46 -0
  1899. package/linthost/project_rule_live_reports_are_concurrent_and_deterministic_test.go +89 -0
  1900. package/linthost/project_rule_reports_per_finding_severity_test.go +74 -0
  1901. package/linthost/project_rule_results_reach_public_file_context_test.go +172 -0
  1902. package/linthost/project_rule_runs_for_empty_source_set_test.go +52 -0
  1903. package/linthost/project_rule_sources_apply_only_global_ignores_test.go +62 -0
  1904. package/linthost/project_rule_sources_include_imported_sibling_source_test.go +110 -0
  1905. package/linthost/project_rule_state_and_live_failure_reach_file_dispatch_test.go +89 -0
  1906. package/linthost/project_rule_state_and_reporter_are_isolated_between_cycles_test.go +87 -0
  1907. package/linthost/project_source_files_follow_tsconfig_selection_test.go +86 -0
  1908. package/linthost/project_source_selection_preserves_explicit_bundled_roots_test.go +73 -0
  1909. package/linthost/promise_function_async_test.go +49 -0
  1910. package/linthost/public_rule_context_accepts_legacy_reporter_test.go +50 -0
  1911. package/linthost/public_rule_context_legacy_reporter_drops_fix_edits_test.go +57 -0
  1912. package/linthost/public_rule_context_options_are_isolated_test.go +106 -0
  1913. package/linthost/public_rule_context_report_fix_falls_back_when_no_edits_test.go +39 -0
  1914. package/linthost/public_rule_context_report_fix_forwards_to_fixreporter_test.go +102 -0
  1915. package/linthost/public_rule_context_report_fix_off_severity_drops_silently_test.go +41 -0
  1916. package/linthost/public_rule_context_report_fix_skips_nil_node_test.go +34 -0
  1917. package/linthost/public_rule_context_report_range_fix_falls_back_when_no_edits_test.go +38 -0
  1918. package/linthost/public_rule_context_report_range_fix_forwards_to_fixreporter_test.go +49 -0
  1919. package/linthost/public_rule_context_report_related_falls_back_test.go +58 -0
  1920. package/linthost/public_rule_context_report_related_forwards_test.go +108 -0
  1921. package/linthost/public_rule_context_report_suggestion_falls_back_when_unsupported_test.go +41 -0
  1922. package/linthost/public_rule_context_report_suggestion_forwards_to_suggestionreporter_test.go +97 -0
  1923. package/linthost/public_rule_context_report_suggestion_with_no_choices_reports_test.go +33 -0
  1924. package/linthost/radix_accepts_every_integer_radix_from_two_through_thirty_six_test.go +33 -0
  1925. package/linthost/range_suggestion_finding_uses_canonical_bounds_test.go +47 -0
  1926. package/linthost/react_button_has_type_requires_explicit_type_test.go +22 -0
  1927. package/linthost/react_compiler_subset_reports_local_purity_violations_test.go +72 -0
  1928. package/linthost/react_display_name_reports_anonymous_memo_test.go +25 -0
  1929. package/linthost/react_exhaustive_deps_reports_missing_identifiers_test.go +58 -0
  1930. package/linthost/react_helpers_test.go +36 -0
  1931. package/linthost/react_iframe_missing_sandbox_reports_iframe_test.go +21 -0
  1932. package/linthost/react_jsx_key_reports_array_element_test.go +21 -0
  1933. package/linthost/react_jsx_key_reports_conditional_map_element_test.go +23 -0
  1934. package/linthost/react_jsx_key_reports_logical_map_element_test.go +23 -0
  1935. package/linthost/react_jsx_no_duplicate_props_reports_duplicate_test.go +21 -0
  1936. package/linthost/react_jsx_no_script_url_reports_javascript_href_test.go +20 -0
  1937. package/linthost/react_jsx_no_target_blank_reports_missing_rel_test.go +22 -0
  1938. package/linthost/react_jsx_no_undef_declarations_collected_once_per_file_test.go +63 -0
  1939. package/linthost/react_jsx_no_undef_reports_undeclared_component_test.go +25 -0
  1940. package/linthost/react_jsx_no_undef_skips_declared_components_test.go +46 -0
  1941. package/linthost/react_jsx_no_useless_fragment_test.go +29 -0
  1942. package/linthost/react_no_array_index_key_reports_index_key_test.go +21 -0
  1943. package/linthost/react_no_array_index_key_reports_renamed_index_key_test.go +23 -0
  1944. package/linthost/react_no_array_index_key_skips_nested_non_list_element_test.go +22 -0
  1945. package/linthost/react_no_array_index_key_skips_unrelated_index_identifier_test.go +21 -0
  1946. package/linthost/react_no_children_prop_reports_children_prop_test.go +21 -0
  1947. package/linthost/react_no_danger_reports_dangerously_set_inner_html_test.go +21 -0
  1948. package/linthost/react_no_danger_with_children_reports_mixed_content_test.go +22 -0
  1949. package/linthost/react_no_danger_with_children_survives_spread_props_test.go +23 -0
  1950. package/linthost/react_no_direct_mutation_state_reports_state_property_write_test.go +22 -0
  1951. package/linthost/react_no_find_dom_node_reports_call_test.go +20 -0
  1952. package/linthost/react_no_is_mounted_reports_call_test.go +20 -0
  1953. package/linthost/react_no_string_refs_reports_string_ref_test.go +20 -0
  1954. package/linthost/react_no_unescaped_entities_reports_quote_text_test.go +21 -0
  1955. package/linthost/react_only_export_components_honors_allow_options_test.go +41 -0
  1956. package/linthost/react_only_export_components_reports_non_component_export_test.go +41 -0
  1957. package/linthost/react_perf_helpers_test.go +58 -0
  1958. package/linthost/react_perf_jsx_no_jsx_as_prop_test.go +29 -0
  1959. package/linthost/react_perf_jsx_no_new_array_as_prop_test.go +30 -0
  1960. package/linthost/react_perf_jsx_no_new_function_as_prop_test.go +31 -0
  1961. package/linthost/react_perf_jsx_no_new_object_as_prop_test.go +31 -0
  1962. package/linthost/react_perf_native_allow_list_test.go +49 -0
  1963. package/linthost/react_perf_rules_skip_jsx_source_test.go +29 -0
  1964. package/linthost/react_rules_of_hooks_rejects_hook_after_conditional_return_test.go +54 -0
  1965. package/linthost/react_rules_of_hooks_rejects_invalid_call_sites_test.go +65 -0
  1966. package/linthost/react_source_file_rules_handle_tsx_descendants_test.go +77 -0
  1967. package/linthost/react_state_setters_reject_render_and_effect_calls_test.go +62 -0
  1968. package/linthost/react_style_prop_object_reports_string_style_test.go +22 -0
  1969. package/linthost/react_void_dom_elements_no_children_reports_img_child_test.go +22 -0
  1970. package/linthost/regex_optimizer_distinguishes_a_zero_upper_bound_from_an_open_range_test.go +44 -0
  1971. package/linthost/regex_optimizer_preserves_ranges_crossing_meta_sets_test.go +67 -0
  1972. package/linthost/regex_tree_optimizer.go +54 -10
  1973. package/linthost/regexp_alias_rules_test.go +53 -0
  1974. package/linthost/regexp_cache.go +63 -33
  1975. package/linthost/regexp_character_class_and_group_rules_test.go +64 -0
  1976. package/linthost/regexp_duplicate_class_uses_code_points_test.go +41 -0
  1977. package/linthost/regexp_quantifier_and_flag_rules_test.go +52 -0
  1978. package/linthost/regexp_useless_ignore_case_flag_test.go +111 -0
  1979. package/linthost/regexp_useless_multiline_flag_test.go +71 -0
  1980. package/linthost/register_rejects_duplicate_rule_name_test.go +74 -0
  1981. package/linthost/reject_any_type_test.go +50 -0
  1982. package/linthost/reject_function_type_test.go +48 -0
  1983. package/linthost/related_getter_setter_pairs_test.go +56 -0
  1984. package/linthost/render_result_dom_access_and_events_test.go +45 -0
  1985. package/linthost/require_array_sort_compare_test.go +47 -0
  1986. package/linthost/require_await_counts_for_await_and_promise_returns_test.go +76 -0
  1987. package/linthost/require_description_test.go +29 -0
  1988. package/linthost/require_param_description_allows_multiline_continuation_test.go +27 -0
  1989. package/linthost/require_param_description_test.go +29 -0
  1990. package/linthost/require_param_name_test.go +26 -0
  1991. package/linthost/require_property_description_allows_multiline_continuation_test.go +27 -0
  1992. package/linthost/require_property_description_test.go +30 -0
  1993. package/linthost/require_property_name_test.go +26 -0
  1994. package/linthost/require_returns_description_allows_multiline_continuation_test.go +27 -0
  1995. package/linthost/require_returns_description_test.go +29 -0
  1996. package/linthost/required_behavioral_witness_kinds_ignore_non_public_candidates_test.go +51 -0
  1997. package/linthost/resident_apply_change_matches_cold_load_test.go +106 -0
  1998. package/linthost/resident_cache_replaces_a_checker_free_program_when_a_checker_arrives_test.go +57 -0
  1999. package/linthost/resident_cache_retains_program_for_declared_external_change_test.go +61 -0
  2000. package/linthost/resident_cache_serves_a_checker_free_verb_from_the_checker_program_test.go +51 -0
  2001. package/linthost/resident_heritage_update_rebuilds_checker_test.go +70 -0
  2002. package/linthost/resident_regex_cache_retires_reloaded_configurations_test.go +123 -0
  2003. package/linthost/resident_rules_are_reused_only_while_their_config_is_unchanged_test.go +180 -0
  2004. package/linthost/resident_whole_corpus_matches_cold_load_test.go +167 -0
  2005. package/linthost/resolve_config_file_path_uses_tsconfig_directory_test.go +34 -0
  2006. package/linthost/resolve_config_tsgo_falls_back_to_the_project_root_anchor_test.go +36 -0
  2007. package/linthost/resolve_config_tsgo_keeps_an_explicitly_pinned_compiler_test.go +41 -0
  2008. package/linthost/resolve_config_tsgo_prefers_the_config_anchor_over_the_project_root_test.go +41 -0
  2009. package/linthost/resolve_config_tsgo_resolves_the_project_compiler_without_the_environment_test.go +33 -0
  2010. package/linthost/resolve_config_tsgo_resolves_through_a_linked_typescript_install_test.go +48 -0
  2011. package/linthost/resolve_config_tsgo_returns_nothing_without_a_project_typescript_test.go +32 -0
  2012. package/linthost/resolve_config_tsgo_returns_nothing_without_the_platform_package_test.go +40 -0
  2013. package/linthost/resolve_ttsx_launcher_falls_back_to_the_bare_command_test.go +36 -0
  2014. package/linthost/resolve_ttsx_launcher_keeps_an_explicitly_pinned_binary_test.go +40 -0
  2015. package/linthost/resolve_ttsx_launcher_resolves_the_project_launcher_without_the_environment_test.go +33 -0
  2016. package/linthost/restrict_plus_operands_test.go +47 -0
  2017. package/linthost/restrict_template_expressions_test.go +47 -0
  2018. package/linthost/return_await_test.go +54 -0
  2019. package/linthost/rule_codes.go +16 -2
  2020. package/linthost/rule_codes_are_unique_and_banded_across_live_registry_test.go +74 -0
  2021. package/linthost/rule_docs.go +1 -1
  2022. package/linthost/rule_documentation_urls_cover_the_builtin_corpus_test.go +86 -0
  2023. package/linthost/rule_snapshot_engine_requires_a_valid_active_rule_test.go +59 -0
  2024. package/linthost/rules_boundaries.go +19 -7
  2025. package/linthost/rules_consistent_return.go +323 -16
  2026. package/linthost/rules_core_extra.go +41 -82
  2027. package/linthost/rules_default_case.go +1 -1
  2028. package/linthost/rules_escape.go +18 -3
  2029. package/linthost/rules_finally.go +49 -15
  2030. package/linthost/rules_format_arrow_parens.go +8 -10
  2031. package/linthost/rules_format_bracket_spacing.go +14 -19
  2032. package/linthost/rules_format_print_width.go +28 -19
  2033. package/linthost/rules_format_quote_props.go +5 -11
  2034. package/linthost/rules_format_quotes.go +5 -6
  2035. package/linthost/rules_format_sort_imports.go +27 -15
  2036. package/linthost/rules_format_statement_split.go +3 -5
  2037. package/linthost/rules_functional.go +21 -14
  2038. package/linthost/rules_gap.go +9 -12
  2039. package/linthost/rules_jsdoc.go +2 -3
  2040. package/linthost/rules_jsx_a11y.go +2 -0
  2041. package/linthost/rules_logic.go +88 -11
  2042. package/linthost/rules_loops.go +16 -2
  2043. package/linthost/rules_max_nested_callbacks.go +28 -12
  2044. package/linthost/rules_misc.go +38 -8
  2045. package/linthost/rules_no_extend_native.go +52 -13
  2046. package/linthost/rules_no_fallthrough.go +1 -1
  2047. package/linthost/rules_no_invalid_this.go +6 -3
  2048. package/linthost/rules_no_mixed_operators.go +42 -10
  2049. package/linthost/rules_no_param_reassign.go +1 -1
  2050. package/linthost/rules_no_unreachable.go +61 -2
  2051. package/linthost/rules_no_useless_constructor.go +21 -27
  2052. package/linthost/rules_problems.go +26 -2
  2053. package/linthost/rules_regexp.go +76 -28
  2054. package/linthost/rules_security.go +4 -4
  2055. package/linthost/rules_self.go +42 -6
  2056. package/linthost/rules_solid.go +14 -26
  2057. package/linthost/rules_sort_keys.go +12 -14
  2058. package/linthost/rules_storybook.go +16 -26
  2059. package/linthost/rules_strings.go +9 -19
  2060. package/linthost/rules_suggestions.go +79 -45
  2061. package/linthost/rules_testing_library.go +18 -0
  2062. package/linthost/rules_ts_no_restricted_types.go +9 -1
  2063. package/linthost/rules_ts_no_unnecessary_type_arguments.go +44 -47
  2064. package/linthost/rules_ts_prefer_readonly.go +111 -42
  2065. package/linthost/rules_ts_prefer_return_this_type.go +21 -14
  2066. package/linthost/rules_unicorn_no_unnecessary_array_splice_count.go +12 -17
  2067. package/linthost/rules_unicorn_no_unnecessary_await.go +39 -13
  2068. package/linthost/rules_unicorn_no_unnecessary_slice_end.go +7 -10
  2069. package/linthost/rules_unicorn_no_useless_error_capture_stack_trace.go +29 -12
  2070. package/linthost/rules_unicorn_no_useless_fallback_in_spread.go +7 -25
  2071. package/linthost/rules_unicorn_no_useless_length_check.go +19 -19
  2072. package/linthost/rules_unicorn_prefer_array_some.go +1 -2
  2073. package/linthost/rules_unicorn_prefer_bigint_literals.go +21 -18
  2074. package/linthost/rules_unicorn_prefer_date_now.go +7 -17
  2075. package/linthost/rules_unicorn_prefer_default_parameters.go +7 -15
  2076. package/linthost/rules_unicorn_prefer_logical_operator_over_ternary.go +7 -13
  2077. package/linthost/rules_unicorn_prefer_negative_index.go +12 -13
  2078. package/linthost/rules_unicorn_prefer_node_protocol.go +5 -5
  2079. package/linthost/rules_unicorn_prefer_object_from_entries.go +7 -14
  2080. package/linthost/rules_unicorn_prefer_regexp_test_rule.go +17 -19
  2081. package/linthost/rules_unicorn_prefer_single_call.go +12 -6
  2082. package/linthost/rules_unicorn_prefer_spread.go +7 -13
  2083. package/linthost/rules_unicorn_prefer_string_replace_all.go +4 -3
  2084. package/linthost/rules_unicorn_prefer_string_starts_ends_with.go +22 -3
  2085. package/linthost/rules_unicorn_prefer_top_level_await.go +4 -3
  2086. package/linthost/rules_unicorn_relative_url_style.go +33 -14
  2087. package/linthost/rules_var.go +73 -3
  2088. package/linthost/runtime_rule_codes_are_collision_free_and_order_independent_test.go +101 -0
  2089. package/linthost/security_assigned_names_unwrap_assertion_targets_test.go +54 -0
  2090. package/linthost/security_bindings_collected_once_per_file_test.go +63 -0
  2091. package/linthost/security_detect_bidi_characters_test.go +44 -0
  2092. package/linthost/security_name_based_node_api_findings_stay_untagged_test.go +87 -0
  2093. package/linthost/self_compare_and_self_assign_ignore_calls_and_empty_template_curly_is_not_a_placeholder_test.go +50 -0
  2094. package/linthost/semantic_finding_guard_rejects_recovered_execution_failures_test.go +75 -0
  2095. package/linthost/serve.go +42 -25
  2096. package/linthost/set_env_replaces_or_appends_test.go +39 -0
  2097. package/linthost/severity_string_formats_values_test.go +34 -0
  2098. package/linthost/signature_flags_expose_construct_signature_abstractness_test.go +136 -0
  2099. package/linthost/signature_introspection_reaches_runtime_endpoints_test.go +123 -0
  2100. package/linthost/solid_helpers_test.go +92 -0
  2101. package/linthost/solid_import_proxy_and_dependency_rules_test.go +48 -0
  2102. package/linthost/solid_imports_leaves_a_type_only_destination_alone_test.go +42 -0
  2103. package/linthost/solid_imports_relocates_a_misrouted_specifier_test.go +69 -0
  2104. package/linthost/solid_jsx_attribute_guards_test.go +69 -0
  2105. package/linthost/solid_no_react_deps_tags_dependency_array_unnecessary_test.go +106 -0
  2106. package/linthost/solid_reactivity_and_component_returns_test.go +49 -0
  2107. package/linthost/solid_rendering_style_preferences_test.go +59 -0
  2108. package/linthost/solid_self_closing_comp_keeps_text_children_test.go +32 -0
  2109. package/linthost/solid_source_file_rules_handle_jsx_initializers_test.go +47 -0
  2110. package/linthost/solid_style_prop_reports_non_zero_numeric_lengths_test.go +37 -0
  2111. package/linthost/solid_validate_jsx_nesting_test.go +53 -0
  2112. package/linthost/sort_keys_compares_across_a_computed_key_and_resets_at_a_spread_test.go +33 -0
  2113. package/linthost/source_extension_tables_separate_selection_from_widening_test.go +44 -0
  2114. package/linthost/source_has_statement_terminator_detects_semicolon_test.go +28 -0
  2115. package/linthost/source_has_statement_terminator_returns_false_for_empty_string_test.go +27 -0
  2116. package/linthost/source_has_statement_terminator_returns_false_for_unclosed_block_comment_test.go +31 -0
  2117. package/linthost/source_has_statement_terminator_returns_false_when_absent_test.go +29 -0
  2118. package/linthost/source_has_statement_terminator_skips_trailing_block_comment_test.go +30 -0
  2119. package/linthost/source_has_statement_terminator_skips_trailing_whitespace_test.go +31 -0
  2120. package/linthost/standalone_checker_resolves_cross_file_type_after_pooled_diagnostics_test.go +85 -0
  2121. package/linthost/storybook_deletion_findings_tag_unnecessary_test.go +127 -0
  2122. package/linthost/storybook_legacy_api_findings_tag_deprecated_test.go +110 -0
  2123. package/linthost/strict_boolean_expressions_test.go +49 -0
  2124. package/linthost/switch_exhaustiveness_check_advanced_type_shapes_test.go +83 -0
  2125. package/linthost/switch_exhaustiveness_check_finite_members_test.go +76 -0
  2126. package/linthost/switch_exhaustiveness_check_helpers_test.go +99 -0
  2127. package/linthost/switch_exhaustiveness_check_no_unchecked_indexed_access_test.go +56 -0
  2128. package/linthost/switch_exhaustiveness_check_options_test.go +118 -0
  2129. package/linthost/switch_exhaustiveness_check_parser_comment_ranges_test.go +64 -0
  2130. package/linthost/switch_exhaustiveness_check_preserves_migrated_defaults_and_options_test.go +139 -0
  2131. package/linthost/switch_exhaustiveness_check_test.go +73 -0
  2132. package/linthost/tail_is_clean_terminator_returns_false_for_invalid_inputs_test.go +64 -0
  2133. package/linthost/testing_library_helpers_test.go +71 -0
  2134. package/linthost/tsdoc_syntax_test.go +64 -0
  2135. package/linthost/ttsx_command_context_spawns_the_project_launcher_test.go +47 -0
  2136. package/linthost/type_alias_reference_node_uses_borrowed_builder_context_test.go +128 -0
  2137. package/linthost/type_args_start_and_end_guard_branches_test.go +58 -0
  2138. package/linthost/type_instantiation_mappers_reach_runtime_endpoints_test.go +213 -0
  2139. package/linthost/type_mapper_parallel_substitution_avoids_capture_test.go +106 -0
  2140. package/linthost/typed_rule_semantic_helpers_test.go +34 -0
  2141. package/linthost/unbound_method_test.go +53 -0
  2142. package/linthost/unicorn_array_some_requires_an_existence_comparison_test.go +29 -0
  2143. package/linthost/unicorn_await_literal_does_not_assume_an_object_has_no_then_test.go +33 -0
  2144. package/linthost/unicorn_better_regex_constructor_fix_escapes_cooked_pattern_test.go +146 -0
  2145. package/linthost/unicorn_better_regex_fix_is_idempotent_test.go +37 -0
  2146. package/linthost/unicorn_better_regex_leaves_optimal_literals_test.go +36 -0
  2147. package/linthost/unicorn_better_regex_reports_exact_range_and_message_test.go +52 -0
  2148. package/linthost/unicorn_better_regex_reports_without_fix_on_source_member_test.go +38 -0
  2149. package/linthost/unicorn_better_regex_rewrites_regexp_constructor_test.go +70 -0
  2150. package/linthost/unicorn_better_regex_skips_unicode_flag_literals_test.go +34 -0
  2151. package/linthost/unicorn_better_regex_sort_character_classes_option_test.go +39 -0
  2152. package/linthost/unicorn_better_regex_test.go +44 -0
  2153. package/linthost/unicorn_bigint_literal_requires_an_exact_integer_value_test.go +34 -0
  2154. package/linthost/unicorn_consistent_destructuring_jsx_tag_names_are_exempt_test.go +53 -0
  2155. package/linthost/unicorn_consistent_destructuring_skips_valid_forms_test.go +221 -0
  2156. package/linthost/unicorn_consistent_destructuring_suggestion_is_opt_in_and_idempotent_test.go +54 -0
  2157. package/linthost/unicorn_consistent_destructuring_test.go +306 -0
  2158. package/linthost/unicorn_consistent_existence_index_check_fix_is_idempotent_test.go +45 -0
  2159. package/linthost/unicorn_consistent_existence_index_check_fix_rewrites_magnitude_comparisons_test.go +96 -0
  2160. package/linthost/unicorn_consistent_existence_index_check_skips_upstream_valid_forms_test.go +143 -0
  2161. package/linthost/unicorn_consistent_existence_index_check_test.go +212 -0
  2162. package/linthost/unicorn_consistent_function_scoping_chains_blocks_inside_loop_bodies_test.go +53 -0
  2163. package/linthost/unicorn_consistent_function_scoping_checks_arrow_lexical_environment_test.go +48 -0
  2164. package/linthost/unicorn_consistent_function_scoping_checks_returned_arrow_chains_test.go +29 -0
  2165. package/linthost/unicorn_consistent_function_scoping_honors_check_arrow_functions_test.go +42 -0
  2166. package/linthost/unicorn_consistent_function_scoping_keeps_shared_outer_references_together_test.go +28 -0
  2167. package/linthost/unicorn_consistent_function_scoping_outer_reference_pins_recursive_function_test.go +31 -0
  2168. package/linthost/unicorn_consistent_function_scoping_preserves_upstream_factory_exceptions_test.go +59 -0
  2169. package/linthost/unicorn_consistent_function_scoping_protects_super_and_private_names_test.go +57 -0
  2170. package/linthost/unicorn_consistent_function_scoping_reads_class_head_positions_as_lexical_environment_test.go +42 -0
  2171. package/linthost/unicorn_consistent_function_scoping_reports_canonical_head_ranges_test.go +44 -0
  2172. package/linthost/unicorn_consistent_function_scoping_resolves_jsx_component_captures_test.go +44 -0
  2173. package/linthost/unicorn_consistent_function_scoping_test.go +45 -0
  2174. package/linthost/unicorn_consistent_function_scoping_treats_loop_scopes_as_one_boundary_test.go +36 -0
  2175. package/linthost/unicorn_consistent_function_scoping_uses_binding_identity_and_ignores_self_recursion_test.go +42 -0
  2176. package/linthost/unicorn_consistent_function_scoping_validates_the_public_option_shape_test.go +58 -0
  2177. package/linthost/unicorn_consistent_template_literal_escape_command_fix_idempotence_test.go +41 -0
  2178. package/linthost/unicorn_consistent_template_literal_escape_fires_on_declaration_files_test.go +35 -0
  2179. package/linthost/unicorn_consistent_template_literal_escape_fixes_template_literal_types_test.go +35 -0
  2180. package/linthost/unicorn_consistent_template_literal_escape_fixes_upstream_invalid_corpus_test.go +80 -0
  2181. package/linthost/unicorn_consistent_template_literal_escape_honors_backslash_parity_test.go +64 -0
  2182. package/linthost/unicorn_consistent_template_literal_escape_preserves_continuations_crlf_and_unicode_test.go +34 -0
  2183. package/linthost/unicorn_consistent_template_literal_escape_reports_exact_element_ranges_test.go +71 -0
  2184. package/linthost/unicorn_consistent_template_literal_escape_reports_untagged_inside_tagged_test.go +43 -0
  2185. package/linthost/unicorn_consistent_template_literal_escape_skips_tagged_templates_test.go +40 -0
  2186. package/linthost/unicorn_consistent_template_literal_escape_skips_upstream_valid_corpus_test.go +49 -0
  2187. package/linthost/unicorn_date_now_preserves_constructor_arguments_test.go +34 -0
  2188. package/linthost/unicorn_escape_case_bounds_escape_digit_runs_test.go +97 -0
  2189. package/linthost/unicorn_escape_case_honors_backslash_parity_test.go +67 -0
  2190. package/linthost/unicorn_escape_case_reports_interpolated_template_segments_test.go +97 -0
  2191. package/linthost/unicorn_escape_case_skips_tagged_templates_test.go +62 -0
  2192. package/linthost/unicorn_escape_family_survives_crlf_and_astral_literals_test.go +67 -0
  2193. package/linthost/unicorn_filename_case_cases_key_order_shapes_message_test.go +42 -0
  2194. package/linthost/unicorn_filename_case_default_ignored_index_basenames_test.go +40 -0
  2195. package/linthost/unicorn_filename_case_directory_handling_test.go +89 -0
  2196. package/linthost/unicorn_filename_case_extension_lowercase_test.go +72 -0
  2197. package/linthost/unicorn_filename_case_ignore_patterns_match_segments_test.go +78 -0
  2198. package/linthost/unicorn_filename_case_multiple_file_extensions_option_test.go +77 -0
  2199. package/linthost/unicorn_filename_case_option_validation_test.go +74 -0
  2200. package/linthost/unicorn_filename_case_real_project_paths_test.go +50 -0
  2201. package/linthost/unicorn_filename_case_report_anchors_and_no_fix_test.go +59 -0
  2202. package/linthost/unicorn_filename_case_split_name_line_terminator_edge_test.go +37 -0
  2203. package/linthost/unicorn_filename_case_test.go +131 -0
  2204. package/linthost/unicorn_filename_case_unicode_segments_test.go +33 -0
  2205. package/linthost/unicorn_filename_case_upstream_invalid_filenames_test.go +268 -0
  2206. package/linthost/unicorn_filename_case_upstream_valid_filenames_test.go +173 -0
  2207. package/linthost/unicorn_import_style_accepts_mixed_styles_when_all_allowed_test.go +29 -0
  2208. package/linthost/unicorn_import_style_banned_module_reports_dedicated_message_test.go +70 -0
  2209. package/linthost/unicorn_import_style_check_toggles_disable_each_syntax_family_test.go +61 -0
  2210. package/linthost/unicorn_import_style_default_module_policy_matrix_test.go +69 -0
  2211. package/linthost/unicorn_import_style_default_policies_at_exact_ranges_test.go +65 -0
  2212. package/linthost/unicorn_import_style_default_policies_skip_compliant_and_unknown_modules_test.go +37 -0
  2213. package/linthost/unicorn_import_style_disjunction_lists_allowed_styles_in_order_test.go +44 -0
  2214. package/linthost/unicorn_import_style_dynamic_import_expression_forms_test.go +69 -0
  2215. package/linthost/unicorn_import_style_evaluates_static_string_module_names_test.go +58 -0
  2216. package/linthost/unicorn_import_style_extend_default_styles_false_drops_builtin_policies_test.go +46 -0
  2217. package/linthost/unicorn_import_style_named_module_policy_matrix_test.go +81 -0
  2218. package/linthost/unicorn_import_style_namespace_module_policy_matrix_test.go +63 -0
  2219. package/linthost/unicorn_import_style_object_pattern_key_forms_test.go +46 -0
  2220. package/linthost/unicorn_import_style_optional_require_calls_are_never_classified_test.go +24 -0
  2221. package/linthost/unicorn_import_style_rejects_malformed_options_before_linting_test.go +56 -0
  2222. package/linthost/unicorn_import_style_reports_no_automatic_fixes_test.go +31 -0
  2223. package/linthost/unicorn_import_style_skips_non_matching_reference_shapes_test.go +47 -0
  2224. package/linthost/unicorn_import_style_style_overrides_replace_inherited_flags_test.go +69 -0
  2225. package/linthost/unicorn_import_style_test.go +87 -0
  2226. package/linthost/unicorn_import_style_type_only_imports_follow_value_semantics_test.go +53 -0
  2227. package/linthost/unicorn_import_style_unassigned_policy_accepts_unassigned_forms_test.go +31 -0
  2228. package/linthost/unicorn_import_style_unassigned_policy_reports_every_assigned_form_test.go +66 -0
  2229. package/linthost/unicorn_isolated_functions_arguments_test.go +48 -0
  2230. package/linthost/unicorn_isolated_functions_browser_and_page_callees_test.go +63 -0
  2231. package/linthost/unicorn_isolated_functions_comments_test.go +131 -0
  2232. package/linthost/unicorn_isolated_functions_execute_script_func_property_test.go +83 -0
  2233. package/linthost/unicorn_isolated_functions_function_name_callees_test.go +100 -0
  2234. package/linthost/unicorn_isolated_functions_helpers_test.go +76 -0
  2235. package/linthost/unicorn_isolated_functions_override_globals_test.go +92 -0
  2236. package/linthost/unicorn_isolated_functions_parameter_default_capture_test.go +47 -0
  2237. package/linthost/unicorn_isolated_functions_scope_internals_test.go +57 -0
  2238. package/linthost/unicorn_isolated_functions_selector_test.go +43 -0
  2239. package/linthost/unicorn_isolated_functions_test.go +75 -0
  2240. package/linthost/unicorn_isolated_functions_this_and_super_test.go +110 -0
  2241. package/linthost/unicorn_isolated_functions_typeof_this_test.go +45 -0
  2242. package/linthost/unicorn_isolated_functions_typescript_types_test.go +39 -0
  2243. package/linthost/unicorn_isolated_functions_unresolved_reference_test.go +41 -0
  2244. package/linthost/unicorn_known_boundary_observations_test.go +113 -0
  2245. package/linthost/unicorn_length_check_preserves_escaped_foreach_results_test.go +33 -0
  2246. package/linthost/unicorn_negative_index_requires_its_own_receiver_and_index_argument_test.go +32 -0
  2247. package/linthost/unicorn_no_hex_escape_honors_backslash_parity_test.go +63 -0
  2248. package/linthost/unicorn_no_hex_escape_ignores_non_hex_escapes_test.go +75 -0
  2249. package/linthost/unicorn_no_hex_escape_reports_interpolated_template_segments_test.go +86 -0
  2250. package/linthost/unicorn_no_hex_escape_skips_tagged_templates_test.go +57 -0
  2251. package/linthost/unicorn_no_typeof_undefined_check_global_variables_option_test.go +90 -0
  2252. package/linthost/unicorn_no_typeof_undefined_declines_unsafe_fix_test.go +50 -0
  2253. package/linthost/unicorn_no_typeof_undefined_fix_rewrites_comparisons_test.go +43 -0
  2254. package/linthost/unicorn_no_typeof_undefined_skips_upstream_valid_forms_test.go +57 -0
  2255. package/linthost/unicorn_no_typeof_undefined_test.go +88 -0
  2256. package/linthost/unicorn_no_unnecessary_polyfills_checks_only_static_string_specifiers_test.go +50 -0
  2257. package/linthost/unicorn_no_unnecessary_polyfills_config_discovery_test.go +109 -0
  2258. package/linthost/unicorn_no_unnecessary_polyfills_core_js_compat_oracle_test.go +74 -0
  2259. package/linthost/unicorn_no_unnecessary_polyfills_corpus_project_scenario_test.go +30 -0
  2260. package/linthost/unicorn_no_unnecessary_polyfills_custom_stats_discovery_test.go +45 -0
  2261. package/linthost/unicorn_no_unnecessary_polyfills_engine_oracle_test.go +101 -0
  2262. package/linthost/unicorn_no_unnecessary_polyfills_engines_discovery_test.go +29 -0
  2263. package/linthost/unicorn_no_unnecessary_polyfills_option_overrides_config_discovery_test.go +28 -0
  2264. package/linthost/unicorn_no_unnecessary_polyfills_options_test.go +38 -0
  2265. package/linthost/unicorn_no_unnecessary_polyfills_package_json_browserslist_section_test.go +25 -0
  2266. package/linthost/unicorn_no_unnecessary_polyfills_pattern_table_oracle_test.go +47 -0
  2267. package/linthost/unicorn_no_unnecessary_polyfills_rejects_malformed_options_test.go +48 -0
  2268. package/linthost/unicorn_no_unnecessary_polyfills_silent_without_resolvable_targets_test.go +26 -0
  2269. package/linthost/unicorn_no_unnecessary_polyfills_test.go +128 -0
  2270. package/linthost/unicorn_no_unnecessary_polyfills_upstream_invalid_targets_test.go +73 -0
  2271. package/linthost/unicorn_no_unused_properties_corpus_test.go +81 -0
  2272. package/linthost/unicorn_no_unused_properties_key_matching_test.go +83 -0
  2273. package/linthost/unicorn_no_unused_properties_object_literal_semantics_test.go +211 -0
  2274. package/linthost/unicorn_no_unused_properties_reference_identity_test.go +72 -0
  2275. package/linthost/unicorn_no_unused_properties_reporting_shape_test.go +89 -0
  2276. package/linthost/unicorn_no_unused_properties_script_global_scope_test.go +60 -0
  2277. package/linthost/unicorn_no_unused_properties_template_keys_test.go +35 -0
  2278. package/linthost/unicorn_no_unused_properties_type_literal_semantics_test.go +155 -0
  2279. package/linthost/unicorn_number_literal_case_fix_is_idempotent_test.go +54 -0
  2280. package/linthost/unicorn_number_literal_case_fixes_bigint_and_separated_literals_test.go +43 -0
  2281. package/linthost/unicorn_number_literal_case_fixes_every_literal_in_one_pass_test.go +37 -0
  2282. package/linthost/unicorn_number_literal_case_fixes_literals_in_every_syntactic_position_test.go +51 -0
  2283. package/linthost/unicorn_number_literal_case_fixes_radix_prefix_and_hex_digits_test.go +42 -0
  2284. package/linthost/unicorn_number_literal_case_fixes_uppercase_exponent_test.go +42 -0
  2285. package/linthost/unicorn_number_literal_case_reports_exact_range_and_message_test.go +53 -0
  2286. package/linthost/unicorn_number_literal_case_skips_canonical_literals_test.go +38 -0
  2287. package/linthost/unicorn_number_literal_case_uppercases_hex_exponent_digits_test.go +44 -0
  2288. package/linthost/unicorn_prefer_number_properties_autofixes_is_na_n_with_number_argument_test.go +24 -0
  2289. package/linthost/unicorn_prefer_number_properties_autofixes_safe_global_test.go +24 -0
  2290. package/linthost/unicorn_prefer_number_properties_checks_infinity_when_enabled_test.go +43 -0
  2291. package/linthost/unicorn_prefer_number_properties_checks_na_n_when_enabled_test.go +30 -0
  2292. package/linthost/unicorn_prefer_number_properties_expands_shorthand_fix_test.go +24 -0
  2293. package/linthost/unicorn_prefer_number_properties_fixes_negative_infinity_test.go +25 -0
  2294. package/linthost/unicorn_prefer_number_properties_interpolates_message_test.go +33 -0
  2295. package/linthost/unicorn_prefer_number_properties_leaves_infinity_and_na_n_under_defaults_test.go +24 -0
  2296. package/linthost/unicorn_prefer_number_properties_reports_object_value_positions_test.go +37 -0
  2297. package/linthost/unicorn_prefer_number_properties_skips_base10_and_missing_radix_test.go +35 -0
  2298. package/linthost/unicorn_prefer_number_properties_skips_shadowed_bindings_test.go +40 -0
  2299. package/linthost/unicorn_prefer_number_properties_suggests_unsafe_is_na_n_test.go +38 -0
  2300. package/linthost/unicorn_prefer_number_properties_test.go +81 -0
  2301. package/linthost/unicorn_prefer_number_properties_validates_options_test.go +64 -0
  2302. package/linthost/unicorn_prefer_optional_catch_binding_test.go +53 -0
  2303. package/linthost/unicorn_prefer_simple_condition_first_handles_or_chains_and_non_logical_type_wrappers_test.go +45 -0
  2304. package/linthost/unicorn_prefer_simple_condition_first_parser_aware_comments_do_not_mistake_literal_text_test.go +28 -0
  2305. package/linthost/unicorn_prefer_simple_condition_first_preserves_mixed_operators_and_parentheses_test.go +32 -0
  2306. package/linthost/unicorn_prefer_simple_condition_first_reports_exact_safe_finding_and_stable_fix_test.go +64 -0
  2307. package/linthost/unicorn_prefer_simple_condition_first_restricts_reports_to_boolean_contexts_test.go +68 -0
  2308. package/linthost/unicorn_prefer_simple_condition_first_reviews_each_homogeneous_mixed_operator_chain_test.go +55 -0
  2309. package/linthost/unicorn_prefer_simple_condition_first_uses_canonical_simple_expression_grammar_test.go +105 -0
  2310. package/linthost/unicorn_prefer_simple_condition_first_withholds_unsafe_and_syntax_owned_fixes_test.go +57 -0
  2311. package/linthost/unicorn_prefer_string_raw_survives_unterminated_literals_test.go +36 -0
  2312. package/linthost/unicorn_prevent_abbreviations_allows_generated_names_to_shadow_without_capture_test.go +23 -0
  2313. package/linthost/unicorn_prevent_abbreviations_allows_reserved_words_in_property_suggestions_test.go +43 -0
  2314. package/linthost/unicorn_prevent_abbreviations_applies_import_controls_to_static_require_bindings_test.go +29 -0
  2315. package/linthost/unicorn_prevent_abbreviations_applies_import_mode_to_external_import_equals_test.go +29 -0
  2316. package/linthost/unicorn_prevent_abbreviations_applies_internal_import_defaults_and_preserves_imported_names_test.go +40 -0
  2317. package/linthost/unicorn_prevent_abbreviations_avoids_catch_parameter_body_redeclarations_test.go +23 -0
  2318. package/linthost/unicorn_prevent_abbreviations_avoids_compiler_provided_global_bindings_test.go +23 -0
  2319. package/linthost/unicorn_prevent_abbreviations_avoids_var_lexical_early_error_collisions_test.go +23 -0
  2320. package/linthost/unicorn_prevent_abbreviations_checks_physical_filename_without_offering_edits_test.go +52 -0
  2321. package/linthost/unicorn_prevent_abbreviations_checks_shorthand_destructuring_only_when_enabled_test.go +25 -0
  2322. package/linthost/unicorn_prevent_abbreviations_does_not_apply_require_mode_to_qualified_import_equals_test.go +24 -0
  2323. package/linthost/unicorn_prevent_abbreviations_does_not_capture_outer_reads_with_unused_inner_bindings_test.go +23 -0
  2324. package/linthost/unicorn_prevent_abbreviations_does_not_capture_unresolved_names_test.go +23 -0
  2325. package/linthost/unicorn_prevent_abbreviations_does_not_report_destructuring_assignment_keys_as_properties_test.go +23 -0
  2326. package/linthost/unicorn_prevent_abbreviations_does_not_treat_destructuring_property_keys_as_collisions_test.go +23 -0
  2327. package/linthost/unicorn_prevent_abbreviations_expands_compound_and_cased_names_but_skips_constants_test.go +23 -0
  2328. package/linthost/unicorn_prevent_abbreviations_false_replacement_disables_compound_matches_test.go +23 -0
  2329. package/linthost/unicorn_prevent_abbreviations_false_replacement_stops_case_variant_fallback_test.go +22 -0
  2330. package/linthost/unicorn_prevent_abbreviations_honors_negative_replacement_and_allow_list_patches_test.go +40 -0
  2331. package/linthost/unicorn_prevent_abbreviations_honors_replacement_allow_and_ignore_options_test.go +42 -0
  2332. package/linthost/unicorn_prevent_abbreviations_ignores_detached_js_doc_when_deciding_fix_safety_test.go +47 -0
  2333. package/linthost/unicorn_prevent_abbreviations_ignores_non_lexical_jsx_and_tuple_names_for_collisions_test.go +24 -0
  2334. package/linthost/unicorn_prevent_abbreviations_keeps_exported_js_doc_and_jsx_bindings_diagnostic_only_test.go +107 -0
  2335. package/linthost/unicorn_prevent_abbreviations_keeps_independent_loop_and_switch_scopes_independent_test.go +23 -0
  2336. package/linthost/unicorn_prevent_abbreviations_keeps_mapped_and_conditional_type_scopes_independent_test.go +23 -0
  2337. package/linthost/unicorn_prevent_abbreviations_keeps_shadowed_bindings_independent_and_avoids_collisions_test.go +23 -0
  2338. package/linthost/unicorn_prevent_abbreviations_keeps_type_script_signature_scopes_independent_test.go +23 -0
  2339. package/linthost/unicorn_prevent_abbreviations_offers_whole_binding_suggestions_for_ambiguous_names_test.go +40 -0
  2340. package/linthost/unicorn_prevent_abbreviations_preserves_astral_first_rune_casing_test.go +27 -0
  2341. package/linthost/unicorn_prevent_abbreviations_preserves_canonical_upper_first_for_uncased_prefixes_test.go +23 -0
  2342. package/linthost/unicorn_prevent_abbreviations_preserves_explicit_imported_alias_names_test.go +22 -0
  2343. package/linthost/unicorn_prevent_abbreviations_preserves_exported_alias_names_test.go +35 -0
  2344. package/linthost/unicorn_prevent_abbreviations_property_checks_are_opt_in_and_suggestion_only_test.go +34 -0
  2345. package/linthost/unicorn_prevent_abbreviations_recognizes_only_canonical_static_require_calls_test.go +43 -0
  2346. package/linthost/unicorn_prevent_abbreviations_rejects_malformed_options_test.go +36 -0
  2347. package/linthost/unicorn_prevent_abbreviations_renames_class_inner_and_outer_references_together_test.go +23 -0
  2348. package/linthost/unicorn_prevent_abbreviations_renames_default_export_local_names_test.go +23 -0
  2349. package/linthost/unicorn_prevent_abbreviations_renames_merged_type_and_value_references_together_test.go +23 -0
  2350. package/linthost/unicorn_prevent_abbreviations_renames_type_predicate_references_test.go +23 -0
  2351. package/linthost/unicorn_prevent_abbreviations_reports_binding_once_and_fixes_every_reference_test.go +31 -0
  2352. package/linthost/unicorn_prevent_abbreviations_separates_generated_names_at_cross_scope_reads_test.go +23 -0
  2353. package/linthost/unicorn_prevent_abbreviations_separates_generated_names_in_one_scope_test.go +23 -0
  2354. package/linthost/unicorn_prevent_abbreviations_supports_canonical_empty_replacement_spelling_test.go +23 -0
  2355. package/linthost/unicorn_prevent_abbreviations_test.go +34 -0
  2356. package/linthost/unicorn_prevent_abbreviations_uses_default_import_control_for_named_default_syntax_test.go +25 -0
  2357. package/linthost/unicorn_prevent_abbreviations_uses_function_scope_for_destructured_var_collisions_test.go +23 -0
  2358. package/linthost/unicorn_prevent_abbreviations_uses_function_scope_for_var_collisions_test.go +23 -0
  2359. package/linthost/unicorn_prevent_abbreviations_uses_java_script_full_unicode_casing_test.go +29 -0
  2360. package/linthost/unicorn_prevent_abbreviations_uses_strict_binding_grammar_for_custom_replacements_test.go +51 -0
  2361. package/linthost/unicorn_regexp_test_requires_a_boolean_result_consumer_test.go +33 -0
  2362. package/linthost/unicorn_relative_url_style_preserves_leading_trimmed_characters_test.go +47 -0
  2363. package/linthost/unicorn_report_only_advice_exposes_semantic_preconditions_test.go +48 -0
  2364. package/linthost/unicorn_rule_finding_helpers_test.go +14 -0
  2365. package/linthost/unicorn_rule_names_helpers_test.go +11 -0
  2366. package/linthost/unicorn_single_call_excludes_event_listener_registration_test.go +30 -0
  2367. package/linthost/unicorn_slice_end_preserves_other_receiver_bounds_test.go +30 -0
  2368. package/linthost/unicorn_splice_count_preserves_bounds_and_insertions_test.go +33 -0
  2369. package/linthost/unicorn_spread_fallback_is_load_bearing_for_arrays_test.go +31 -0
  2370. package/linthost/unicorn_string_content_applies_first_matching_pattern_in_configured_order_test.go +55 -0
  2371. package/linthost/unicorn_string_content_escapes_backticks_and_dollars_in_template_fix_test.go +75 -0
  2372. package/linthost/unicorn_string_content_escapes_delimiter_quotes_in_literal_fix_test.go +60 -0
  2373. package/linthost/unicorn_string_content_escapes_line_separators_keeps_other_whitespace_raw_test.go +79 -0
  2374. package/linthost/unicorn_string_content_fix_false_reports_suggestion_only_test.go +73 -0
  2375. package/linthost/unicorn_string_content_honors_custom_message_and_placeholders_test.go +41 -0
  2376. package/linthost/unicorn_string_content_jsx_attribute_fix_uses_html_entities_test.go +103 -0
  2377. package/linthost/unicorn_string_content_matches_case_insensitively_when_configured_test.go +68 -0
  2378. package/linthost/unicorn_string_content_normalizes_template_line_endings_like_acorn_test.go +87 -0
  2379. package/linthost/unicorn_string_content_preserves_control_escapes_in_literal_fix_test.go +93 -0
  2380. package/linthost/unicorn_string_content_rejects_malformed_options_before_linting_test.go +79 -0
  2381. package/linthost/unicorn_string_content_reports_and_fixes_plain_string_literal_test.go +54 -0
  2382. package/linthost/unicorn_string_content_reports_each_template_quasi_at_exact_ranges_test.go +61 -0
  2383. package/linthost/unicorn_string_content_selector_matches_keep_ignored_tag_exemption_test.go +33 -0
  2384. package/linthost/unicorn_string_content_selectors_restrict_checked_nodes_test.go +68 -0
  2385. package/linthost/unicorn_string_content_skips_empty_and_non_string_literals_test.go +43 -0
  2386. package/linthost/unicorn_string_content_skips_ignored_template_tags_test.go +81 -0
  2387. package/linthost/unicorn_string_content_stays_silent_without_pattern_options_test.go +34 -0
  2388. package/linthost/unicorn_string_content_treats_pattern_as_regular_expression_test.go +77 -0
  2389. package/linthost/unicorn_switch_case_break_position_declines_unsafe_or_semantic_moves_test.go +111 -0
  2390. package/linthost/unicorn_switch_case_break_position_fix_preserves_statements_comments_and_eol_test.go +187 -0
  2391. package/linthost/unicorn_switch_case_break_position_reports_every_supported_terminator_at_exact_range_test.go +132 -0
  2392. package/linthost/unicorn_switch_case_break_position_requires_sole_non_empty_block_then_direct_terminator_test.go +112 -0
  2393. package/linthost/unicorn_template_indent_accepts_parenthesized_jest_inline_snapshot_test.go +26 -0
  2394. package/linthost/unicorn_template_indent_detects_tabs_outside_templates_test.go +31 -0
  2395. package/linthost/unicorn_template_indent_falls_back_to_two_spaces_without_any_indent_signal_test.go +23 -0
  2396. package/linthost/unicorn_template_indent_fix_preserves_quasis_substitutions_escapes_and_blank_lines_test.go +71 -0
  2397. package/linthost/unicorn_template_indent_fixes_empty_boundary_quasis_with_insertions_test.go +37 -0
  2398. package/linthost/unicorn_template_indent_fixes_nested_templates_without_touching_expressions_test.go +52 -0
  2399. package/linthost/unicorn_template_indent_honors_configured_tags_functions_comments_and_selectors_test.go +69 -0
  2400. package/linthost/unicorn_template_indent_honors_numeric_and_whitespace_indent_options_test.go +51 -0
  2401. package/linthost/unicorn_template_indent_pins_every_default_matcher_test.go +46 -0
  2402. package/linthost/unicorn_template_indent_preserves_content_trailing_spaces_test.go +31 -0
  2403. package/linthost/unicorn_template_indent_preserves_crlf_test.go +35 -0
  2404. package/linthost/unicorn_template_indent_preserves_every_interior_ecma_script_line_ending_test.go +39 -0
  2405. package/linthost/unicorn_template_indent_preserves_leading_byte_order_mark_test.go +27 -0
  2406. package/linthost/unicorn_template_indent_preserves_mixed_interior_line_endings_test.go +35 -0
  2407. package/linthost/unicorn_template_indent_recognizes_every_ecma_script_source_line_separator_test.go +48 -0
  2408. package/linthost/unicorn_template_indent_rejects_jest_inline_snapshot_near_misses_test.go +35 -0
  2409. package/linthost/unicorn_template_indent_rejects_malformed_options_before_linting_test.go +52 -0
  2410. package/linthost/unicorn_template_indent_selects_every_official_entry_point_at_exact_range_test.go +56 -0
  2411. package/linthost/unicorn_template_indent_skips_unselected_single_line_and_already_correct_templates_test.go +37 -0
  2412. package/linthost/unicorn_template_indent_test.go +20 -0
  2413. package/linthost/unicorn_text_encoding_identifier_case_enforces_dash_in_jsx_charset_attributes_test.go +69 -0
  2414. package/linthost/unicorn_text_encoding_identifier_case_enforces_dash_in_text_decoder_test.go +47 -0
  2415. package/linthost/unicorn_text_encoding_identifier_case_fixes_fs_read_file_encoding_test.go +44 -0
  2416. package/linthost/unicorn_text_encoding_identifier_case_handles_template_literals_test.go +46 -0
  2417. package/linthost/unicorn_text_encoding_identifier_case_reports_suggestion_range_and_message_test.go +78 -0
  2418. package/linthost/unicorn_text_encoding_identifier_case_skips_canonical_and_unknown_labels_test.go +35 -0
  2419. package/linthost/unicorn_text_encoding_identifier_case_suggests_without_fixing_off_read_file_positions_test.go +36 -0
  2420. package/linthost/unicorn_text_encoding_identifier_case_withdash_option_prefers_dash_test.go +52 -0
  2421. package/linthost/unicorn_throw_new_error_fix_parenthesizes_a_shielded_call_chain_test.go +69 -0
  2422. package/linthost/unicorn_throw_new_error_fix_spaces_an_abutting_throw_keyword_test.go +64 -0
  2423. package/linthost/unicorn_throw_new_error_fixes_every_throw_in_one_pass_test.go +42 -0
  2424. package/linthost/unicorn_throw_new_error_fixes_upstream_invalid_corpus_test.go +114 -0
  2425. package/linthost/unicorn_throw_new_error_reports_custom_and_member_callees_test.go +62 -0
  2426. package/linthost/unicorn_throw_new_error_skips_non_matching_callees_test.go +68 -0
  2427. package/linthost/unregistered_rule_code_lookup_preserves_registered_assignments_test.go +102 -0
  2428. package/linthost/use_unknown_in_catch_callback_variable_test.go +48 -0
  2429. package/linthost/user_pattern_cache_follows_resolver_ownership_test.go +87 -0
  2430. package/linthost/user_pattern_cache_parallel_reuses_results_test.go +67 -0
  2431. package/linthost/user_source_files_exclude_imported_declarations_and_javascript_test.go +82 -0
  2432. package/linthost/user_source_files_span_program_typescript_sources_test.go +72 -0
  2433. package/linthost/valid_typeof_equality_operator_scope_test.go +173 -0
  2434. package/linthost/verbatim_range_returns_empty_for_invalid_range_test.go +53 -0
  2435. package/linthost/verbatim_returns_empty_for_nil_node_test.go +30 -0
  2436. package/linthost/verbatim_returns_empty_for_out_of_range_node_test.go +52 -0
  2437. package/linthost/vitest_expect_expect_reports_empty_test_test.go +35 -0
  2438. package/linthost/vitest_finding_helpers_test.go +14 -0
  2439. package/linthost/vitest_no_conditional_expect_reports_expect_inside_if_test.go +37 -0
  2440. package/linthost/vitest_no_conditional_tests_reports_test_inside_if_test.go +35 -0
  2441. package/linthost/vitest_no_disabled_tests_reports_skip_test.go +34 -0
  2442. package/linthost/vitest_no_done_callback_reports_test_parameter_test.go +34 -0
  2443. package/linthost/vitest_no_focused_tests_reports_only_test.go +34 -0
  2444. package/linthost/vitest_no_identical_title_reports_duplicate_sibling_test.go +35 -0
  2445. package/linthost/vitest_no_standalone_expect_reports_top_level_expect_test.go +33 -0
  2446. package/linthost/vitest_no_test_return_statement_reports_return_test.go +35 -0
  2447. package/linthost/vitest_prefer_to_have_length_reports_length_matcher_test.go +34 -0
  2448. package/linthost/vitest_valid_describe_callback_reports_async_callback_test.go +34 -0
  2449. package/linthost/vitest_valid_expect_reports_missing_matcher_test.go +35 -0
  2450. package/linthost/vitest_valid_title_reports_empty_title_test.go +34 -0
  2451. package/linthost/wait_for_assertion_and_side_effect_guards_test.go +55 -0
  2452. package/linthost/windows_junction_dependency_entry_matches_node_fingerprint_test.go +55 -0
  2453. package/linthost/windows_loader_temp_base_stays_on_config_volume_test.go +98 -0
  2454. package/linthost/windows_project_source_selection_preserves_physical_aliases_test.go +69 -0
  2455. package/linthost/windows_real_project_path_expands_windows_short_ancestor_test.go +47 -0
  2456. package/linthost/windows_resolve_config_tsgo_through_linked_typescript_install_test.go +52 -0
  2457. package/linthost/windows_short_path_other_test.go +11 -0
  2458. package/linthost/windows_short_path_windows_test.go +39 -0
  2459. package/linthost/workspace_link_resolves_a_sibling_package_to_its_source_test.go +86 -0
  2460. package/package.json +5 -3
  2461. package/rule/astutil/astutil.go +165 -59
  2462. package/rule/context_decode_options_preserves_defaults_and_decoder_errors_test.go +87 -0
  2463. package/rule/graph.go +82 -16
  2464. package/rule/hint.go +95 -28
  2465. package/rule/new_project_context_preserves_snapshot_ownership_test.go +62 -0
  2466. package/rule/new_project_input_context_preserves_owned_options_test.go +59 -0
  2467. package/rule/new_project_rule_result_preserves_snapshot_ownership_test.go +63 -0
  2468. package/rule/project.go +382 -22
  2469. package/rule/project_input_reader.go +163 -0
  2470. package/rule/rule.go +540 -92
  2471. package/src/createTtscPlugin.ts +3010 -0
  2472. package/src/index.ts +1 -2974
  2473. package/src/internal/configEvaluatorFailure.ts +17 -9
  2474. package/src/internal/lintTrace.ts +106 -0
  2475. package/src/internal/normalizeContributors.ts +79 -0
  2476. package/src/structures/ITtscLintConfig.ts +27 -8
  2477. package/src/structures/ITtscLintPlugin.ts +13 -8
  2478. package/src/structures/ITtscLintPluginConfig.ts +18 -7
  2479. package/src/structures/ITtscLintPluginMeta.ts +10 -7
  2480. package/src/structures/TtscLintRuleSetting.ts +18 -13
  2481. package/src/structures/TtscLintSeverity.ts +5 -0
  2482. package/src/structures/format/ITtscLintFormat.ts +14 -8
  2483. package/src/structures/format/ITtscLintFormatJsDoc.ts +8 -1
  2484. package/src/structures/format/ITtscLintFormatSortImports.ts +14 -8
  2485. package/src/structures/rules/ITtscLintBoundariesRuleOptions.ts +133 -25
  2486. package/src/structures/rules/ITtscLintBoundariesRules.ts +10 -5
  2487. package/src/structures/rules/ITtscLintContributorRules.ts +20 -13
  2488. package/src/structures/rules/ITtscLintCoreRuleOptions.ts +226 -24
  2489. package/src/structures/rules/ITtscLintCoreRules.ts +92 -72
  2490. package/src/structures/rules/ITtscLintCypressRuleOptions.ts +8 -1
  2491. package/src/structures/rules/ITtscLintCypressRules.ts +24 -21
  2492. package/src/structures/rules/ITtscLintFunctionalRuleOptions.ts +140 -24
  2493. package/src/structures/rules/ITtscLintFunctionalRules.ts +20 -12
  2494. package/src/structures/rules/ITtscLintJestRules.ts +22 -16
  2495. package/src/structures/rules/ITtscLintJsdocRules.ts +5 -0
  2496. package/src/structures/rules/ITtscLintJsxA11yRules.ts +24 -21
  2497. package/src/structures/rules/ITtscLintNextjsRules.ts +40 -42
  2498. package/src/structures/rules/ITtscLintPlaywrightRules.ts +24 -14
  2499. package/src/structures/rules/ITtscLintPromiseRules.ts +23 -14
  2500. package/src/structures/rules/ITtscLintReactPerfRuleOptions.ts +8 -1
  2501. package/src/structures/rules/ITtscLintReactPerfRules.ts +18 -15
  2502. package/src/structures/rules/ITtscLintReactRuleOptions.ts +14 -4
  2503. package/src/structures/rules/ITtscLintReactRules.ts +33 -27
  2504. package/src/structures/rules/ITtscLintRegexpRules.ts +18 -4
  2505. package/src/structures/rules/ITtscLintRuleOptionsMap.ts +150 -15
  2506. package/src/structures/rules/ITtscLintRules.ts +13 -9
  2507. package/src/structures/rules/ITtscLintSecurityRules.ts +33 -23
  2508. package/src/structures/rules/ITtscLintSolidRules.ts +57 -47
  2509. package/src/structures/rules/ITtscLintStorybookRuleOptions.ts +10 -2
  2510. package/src/structures/rules/ITtscLintStorybookRules.ts +52 -62
  2511. package/src/structures/rules/ITtscLintTanstackQueryRules.ts +34 -30
  2512. package/src/structures/rules/ITtscLintTestingLibraryRuleOptions.ts +12 -3
  2513. package/src/structures/rules/ITtscLintTestingLibraryRules.ts +20 -15
  2514. package/src/structures/rules/ITtscLintTypeScriptRuleOptions.ts +116 -16
  2515. package/src/structures/rules/ITtscLintTypeScriptRules.ts +62 -51
  2516. package/src/structures/rules/ITtscLintUnicornRuleOptions.ts +241 -48
  2517. package/src/structures/rules/ITtscLintUnicornRules.ts +97 -44
  2518. package/src/structures/rules/ITtscLintVitestRules.ts +19 -11
  2519. package/src/structures/rules/TtscLintContributorOverlay.ts +40 -0
  2520. package/src/structures/rules/index.ts +1 -0
@@ -0,0 +1,3010 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { spawnSync } from "node:child_process";
3
+ import { createHash, randomUUID } from "node:crypto";
4
+ import fs from "node:fs";
5
+ import { createRequire } from "node:module";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
+ import { pathToFileURL } from "node:url";
9
+
10
+ import {
11
+ configEvaluatorFailureReason,
12
+ configEvaluatorProcessFailure,
13
+ } from "./internal/configEvaluatorFailure";
14
+ import { beginLintTrace } from "./internal/lintTrace";
15
+ import { normalizeContributors } from "./internal/normalizeContributors";
16
+ import type { ITtscLintPluginConfig } from "./structures";
17
+
18
+ /** A resolved contributor: Go sub-package name + absolute source directory. */
19
+ type TtscPluginContributor = {
20
+ name: string;
21
+ source: string;
22
+ };
23
+
24
+ /** Descriptor shape returned to ttsc's plugin builder by the factory. */
25
+ type TtscPluginDescriptor = {
26
+ capabilities?: {
27
+ checkObservations?: true;
28
+ compilerArgsCwd?: true;
29
+ diagnosticsTiming?: boolean;
30
+ graphNodes?: boolean;
31
+ lsp?: boolean;
32
+ projectContextArgs?: boolean;
33
+ projectDiagnostics?: boolean;
34
+ projectInputs?: boolean;
35
+ residentCheck?: boolean;
36
+ threadingArgs?: boolean;
37
+ };
38
+ contributors?: TtscPluginContributor[];
39
+ hostInputHashes?: Record<string, string | null>;
40
+ hostInputRealpaths?: Record<string, string | null>;
41
+ hostInputs?: string[];
42
+ name: string;
43
+ reportsTypeScriptDiagnostics?: boolean;
44
+ source: string;
45
+ stage?: "check" | "transform";
46
+ };
47
+
48
+ /**
49
+ * Context object injected by ttsc into every plugin factory call. The generic
50
+ * `TConfig` is the tsconfig plugin entry shape.
51
+ */
52
+ type TtscPluginFactoryContext<TConfig> = {
53
+ binary: string;
54
+ cwd: string;
55
+
56
+ /** This descriptor's own directory — the ESM-safe replacement for `__dirname`. */
57
+ dirname: string;
58
+
59
+ /** This descriptor's own path — the ESM-safe replacement for `__filename`. */
60
+ filename: string;
61
+
62
+ plugin: TConfig;
63
+
64
+ /**
65
+ * Caller-declared anchor for plugin config-file discovery, present when the
66
+ * embedder compiles through a generated tsconfig outside the project (see
67
+ * `ITtscPluginFactoryContext.pluginConfigDir`).
68
+ */
69
+ pluginConfigDir?: string;
70
+
71
+ projectRoot: string;
72
+ tsconfig: string;
73
+ };
74
+
75
+ // Namespace becomes the rule-name prefix (`<ns>/<rule>`). Mirrors ESLint
76
+ // plugin namespace conventions: lowercase ASCII, digits, hyphens, and
77
+ // underscores; leading character must be alphabetic so the prefix never
78
+ // collides with a rule name that itself starts with a digit. Hyphens
79
+ // are encoded into underscores for the Go sub-package name (see
80
+ // `goSubpackageName`); the user-facing prefix keeps the original form.
81
+ const NAMESPACE_PATTERN = /^[a-z][a-z0-9_-]*$/;
82
+
83
+ const LINT_CONFIG_FILENAMES = [
84
+ "lint.config.json",
85
+ "lint.config.js",
86
+ "lint.config.mjs",
87
+ "lint.config.cjs",
88
+ "lint.config.ts",
89
+ "lint.config.mts",
90
+ "lint.config.cts",
91
+ "ttsc-lint.config.json",
92
+ "ttsc-lint.config.js",
93
+ "ttsc-lint.config.mjs",
94
+ "ttsc-lint.config.cjs",
95
+ "ttsc-lint.config.ts",
96
+ "ttsc-lint.config.mts",
97
+ "ttsc-lint.config.cts",
98
+ ];
99
+
100
+ /**
101
+ * Tsconfig plugin-entry keys owned by the ttsc host framework. They are
102
+ * accepted alongside the single lint-specific `configFile` key; every other key
103
+ * is rejected so a stale inline option (`rules`, `format`, `extends`, legacy
104
+ * `config`, `plugins`) surfaces as a clear migration error instead of being
105
+ * silently ignored. Mirrors `@ttsc/banner` and `@ttsc/strip`.
106
+ */
107
+ const FRAMEWORK_KEYS = new Set<string>(["enabled", "transform"]);
108
+
109
+ /**
110
+ * Plugin descriptor factory consumed by ttsc package discovery.
111
+ *
112
+ * Contributor lint plugins come from one place: the project's lint config file
113
+ * (`lint.config.{ts,cts,mts,js,cjs,mjs,json}` or `ttsc-lint.config.*`). The
114
+ * tsconfig plugin entry carries no rule or plugin surface — it optionally names
115
+ * the config file via `configFile`, otherwise the file is discovered by walking
116
+ * upward from the tsconfig directory (or from the caller-declared
117
+ * `pluginConfigDir` when the resolved tsconfig is a generated wrapper in a temp
118
+ * directory).
119
+ *
120
+ * The factory locates the config file and evaluates contributor-bearing configs
121
+ * in an isolated ttsx process. JSON without plugins or an extends chain needs
122
+ * no evaluator. The extractor reads plugin maps from the resolved config and
123
+ * its bases and forwards contributor Go sources to the descriptor's
124
+ * `contributors` field. Its dependency envelope owns config observations; the
125
+ * child's bootstrap does not inherit the parent descriptor's observation
126
+ * channel.
127
+ *
128
+ * @evidence contracts/common.md#principled-implementation Entry validation and config-origin discovery resolve registered contributor sources and observed inputs before constructing the check-stage descriptor with supported capabilities.
129
+ * @evidence contracts/common.md#clear-and-simple-design The exported factory composes validation, discovery and descriptor construction; helpers own module loading and dependency fingerprints separately.
130
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Contributors use the supported Go-source extension boundary and config-file schema; no foreign method replacement or fixture-specific descriptor is installed.
131
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain config origins, evaluator formats and contributor forwarding; separated prose and tags follow documentation guidance.
132
+ */
133
+ export default function createTtscPlugin(
134
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
135
+ ): TtscPluginDescriptor {
136
+ rejectUnsupportedEntryKeys(context.plugin);
137
+ const resolvedConfig = resolveConfigFileContributors(context);
138
+ // Build the descriptor without a `contributors` key when none were
139
+ // declared, so consumers (and the existing key-shape regression
140
+ // tests) see the same surface as before this feature shipped.
141
+ const descriptor: TtscPluginDescriptor = {
142
+ capabilities: {
143
+ checkObservations: true,
144
+ compilerArgsCwd: true,
145
+ diagnosticsTiming: true,
146
+ graphNodes: true,
147
+ lsp: true,
148
+ projectContextArgs: true,
149
+ projectDiagnostics: true,
150
+ projectInputs: true,
151
+ residentCheck: true,
152
+ threadingArgs: true,
153
+ },
154
+ hostInputHashes: resolvedConfig.hostInputHashes,
155
+ hostInputRealpaths: resolvedConfig.hostInputRealpaths,
156
+ hostInputs: resolvedConfig.hostInputs,
157
+ name: "@ttsc/lint",
158
+ reportsTypeScriptDiagnostics: true,
159
+ // `context.dirname` is this descriptor's own directory in every load mode —
160
+ // the ESM-safe replacement for `__dirname`, which is undefined when ttsc
161
+ // loads a descriptor as `.ts` source or ESM.
162
+ source: path.resolve(context.dirname, "..", "plugin"),
163
+ stage: "check",
164
+ };
165
+ if (resolvedConfig.contributors.length > 0) {
166
+ descriptor.contributors = resolvedConfig.contributors;
167
+ }
168
+ return descriptor;
169
+ }
170
+
171
+ // ────────────────────────────────────────────────────────────────────────────
172
+ // lint.config.* discovery + evaluation
173
+ // ────────────────────────────────────────────────────────────────────────────
174
+
175
+ /** Plugin entries observed in a lint config file, normalized per file. */
176
+ type ConfigPluginEntry = { namespace: string; source: string };
177
+
178
+ type ConfigDependencyFingerprint = {
179
+ digest: string;
180
+ identityStable: boolean;
181
+ kind: "directory" | "file" | "optional-file";
182
+ path: string;
183
+ realpath: string | null;
184
+ scope: "cache" | "watch";
185
+ };
186
+
187
+ type ConfigPluginEvaluation = {
188
+ dependencies: ConfigDependencyFingerprint[];
189
+ entries: ConfigPluginEntry[];
190
+ };
191
+
192
+ /**
193
+ * Resolves the contributor lint plugins declared in the project's lint config
194
+ * file.
195
+ *
196
+ * - When the tsconfig plugin entry sets `configFile`, that exact file is loaded
197
+ * (relative paths resolve against the tsconfig directory, or against the
198
+ * caller-declared `pluginConfigDir` when present).
199
+ * - Otherwise a `lint.config.*` / `ttsc-lint.config.*` file is discovered by
200
+ * walking upward from the tsconfig directory (or from `pluginConfigDir` when
201
+ * present).
202
+ *
203
+ * Returns no contributors while preserving observed discovery inputs when no
204
+ * config file is set or discovered. The Go sidecar reports a missing config.
205
+ */
206
+ function resolveConfigFileContributors(
207
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
208
+ ): {
209
+ contributors: TtscPluginContributor[];
210
+ hostInputHashes: Record<string, string | null>;
211
+ hostInputRealpaths: Record<string, string | null>;
212
+ hostInputs: string[];
213
+ } {
214
+ const configFile = readConfigFileOption(context);
215
+ const explicitConfigPath =
216
+ configFile === undefined
217
+ ? undefined
218
+ : path.resolve(pluginConfigBaseDir(context), configFile);
219
+ const discovery =
220
+ explicitConfigPath === undefined
221
+ ? discoverLintConfigFile(context)
222
+ : {
223
+ configPath: explicitConfigPath,
224
+ hostInputHashes: hashHostInputPaths([explicitConfigPath]),
225
+ hostInputRealpaths: realpathHostInputPaths([explicitConfigPath]),
226
+ hostInputs: [explicitConfigPath],
227
+ };
228
+ const { configPath } = discovery;
229
+ if (!configPath || !fs.existsSync(configPath)) {
230
+ return {
231
+ contributors: [],
232
+ hostInputHashes: discovery.hostInputHashes,
233
+ hostInputRealpaths: discovery.hostInputRealpaths,
234
+ hostInputs: discovery.hostInputs,
235
+ };
236
+ }
237
+
238
+ const evaluation = readConfigPluginEntries(configPath, context);
239
+ const entries = evaluation.entries;
240
+ const out = normalizeContributors(entries, configPath);
241
+ const dependencyInputs = evaluation.dependencies
242
+ .filter(
243
+ (dependency) =>
244
+ dependency.scope === "watch" && dependency.kind !== "directory",
245
+ )
246
+ .map((dependency) => dependency.path);
247
+ const hostInputHashes = { ...discovery.hostInputHashes };
248
+ const hostInputRealpaths = { ...discovery.hostInputRealpaths };
249
+ const unstableRealpaths = new Set<string>();
250
+ const unprovenInputs = new Set<string>();
251
+ const missingOptionalDigest = createHash("sha256")
252
+ .update("missing\0")
253
+ .digest("hex");
254
+ const directoryCandidateDigest = createHash("sha256")
255
+ .update("ttsc:host-input:directory\0")
256
+ .digest("hex");
257
+ for (const dependency of evaluation.dependencies) {
258
+ if (dependency.scope !== "watch" || dependency.kind === "directory") {
259
+ continue;
260
+ }
261
+ const input = path.resolve(dependency.path);
262
+ const realpath = dependency.realpath;
263
+ if (!dependency.identityStable) {
264
+ delete hostInputRealpaths[input];
265
+ delete hostInputHashes[input];
266
+ unstableRealpaths.add(input);
267
+ unprovenInputs.add(input);
268
+ continue;
269
+ }
270
+ if (
271
+ Object.prototype.hasOwnProperty.call(hostInputRealpaths, input) &&
272
+ hostInputRealpaths[input] !== realpath
273
+ ) {
274
+ delete hostInputRealpaths[input];
275
+ delete hostInputHashes[input];
276
+ unstableRealpaths.add(input);
277
+ } else if (!unstableRealpaths.has(input)) {
278
+ hostInputRealpaths[input] = realpath;
279
+ }
280
+ let hash: string | null | undefined;
281
+ if (
282
+ dependency.kind === "file" &&
283
+ /^[0-9a-f]{64}$/.test(dependency.digest)
284
+ ) {
285
+ hash = dependency.digest;
286
+ } else if (dependency.digest === missingOptionalDigest) {
287
+ // The evaluator's optional-file digest includes a state prefix. The
288
+ // public host-input contract uses null for the observed missing state.
289
+ hash = null;
290
+ } else if (dependency.digest === directoryCandidateDigest) {
291
+ // A path that is currently a directory is still an exact file candidate:
292
+ // replacing it with a file changes module/config selection.
293
+ hash = directoryCandidateDigest;
294
+ }
295
+ if (hash === undefined) {
296
+ delete hostInputHashes[input];
297
+ unprovenInputs.add(input);
298
+ } else if (unprovenInputs.has(input)) {
299
+ // A later observation cannot revive proof another evaluation stage
300
+ // could not provide for the same combined descriptor result.
301
+ } else if (
302
+ Object.prototype.hasOwnProperty.call(hostInputHashes, input) &&
303
+ hostInputHashes[input] !== hash
304
+ ) {
305
+ delete hostInputHashes[input];
306
+ unprovenInputs.add(input);
307
+ } else {
308
+ hostInputHashes[input] = hash;
309
+ }
310
+ }
311
+ return {
312
+ contributors: out,
313
+ hostInputHashes,
314
+ hostInputRealpaths,
315
+ hostInputs: [...discovery.hostInputs, ...dependencyInputs],
316
+ };
317
+ }
318
+
319
+ /** Snapshot config candidates before any discovery/evaluation side effect. */
320
+ function hashHostInputPaths(
321
+ inputs: readonly string[],
322
+ ): Record<string, string | null> {
323
+ return Object.fromEntries(
324
+ inputs.map((input) => {
325
+ const file = path.resolve(input);
326
+ try {
327
+ if (fs.statSync(file).isDirectory()) {
328
+ return [
329
+ file,
330
+ createHash("sha256")
331
+ .update("ttsc:host-input:directory\0")
332
+ .digest("hex"),
333
+ ] as const;
334
+ }
335
+ return [
336
+ file,
337
+ createHash("sha256").update(fs.readFileSync(file)).digest("hex"),
338
+ ] as const;
339
+ } catch {
340
+ return [file, null] as const;
341
+ }
342
+ }),
343
+ );
344
+ }
345
+
346
+ function hostInputRealpath(file: string): string | null {
347
+ try {
348
+ return fs.realpathSync.native(file);
349
+ } catch {
350
+ return null;
351
+ }
352
+ }
353
+
354
+ function realpathHostInputPaths(
355
+ inputs: readonly string[],
356
+ ): Record<string, string | null> {
357
+ return Object.fromEntries(
358
+ inputs.map((input) => {
359
+ const file = path.resolve(input);
360
+ return [file, hostInputRealpath(file)] as const;
361
+ }),
362
+ );
363
+ }
364
+
365
+ /** Mirror native discovery and fingerprint every candidate before selecting. */
366
+ function discoverLintConfigFile(
367
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
368
+ ): {
369
+ configPath?: string;
370
+ hostInputHashes: Record<string, string | null>;
371
+ hostInputRealpaths: Record<string, string | null>;
372
+ hostInputs: string[];
373
+ } {
374
+ const hostInputHashes: Record<string, string | null> = {};
375
+ const hostInputRealpaths: Record<string, string | null> = {};
376
+ const hostInputs: string[] = [];
377
+ const recordCandidates = (candidates: readonly string[]): void => {
378
+ for (const candidate of candidates) {
379
+ const absolute = path.resolve(candidate);
380
+ if (Object.prototype.hasOwnProperty.call(hostInputHashes, absolute)) {
381
+ continue;
382
+ }
383
+ hostInputs.push(absolute);
384
+ Object.assign(hostInputHashes, hashHostInputPaths([absolute]));
385
+ Object.assign(hostInputRealpaths, realpathHostInputPaths([absolute]));
386
+ }
387
+ };
388
+ for (const origin of discoveryConfigBaseDirs(context)) {
389
+ for (let directory = origin; ; directory = path.dirname(directory)) {
390
+ const candidates = LINT_CONFIG_FILENAMES.map((name) =>
391
+ path.join(directory, name),
392
+ );
393
+ recordCandidates(candidates);
394
+ const matches = lintConfigMatchesIn(directory);
395
+ if (matches.length === 1) {
396
+ return {
397
+ configPath: matches[0],
398
+ hostInputHashes,
399
+ hostInputRealpaths,
400
+ hostInputs,
401
+ };
402
+ }
403
+ if (matches.length > 1) {
404
+ throw new Error(
405
+ `@ttsc/lint: multiple lint config files found in ${directory} (${matches
406
+ .map((file) => path.basename(file))
407
+ .join(", ")}); set "configFile" explicitly`,
408
+ );
409
+ }
410
+ const parent = path.dirname(directory);
411
+ if (parent === directory) break;
412
+ }
413
+ }
414
+ return { hostInputHashes, hostInputRealpaths, hostInputs };
415
+ }
416
+
417
+ /**
418
+ * Rejects any tsconfig plugin-entry key that is neither a host framework key
419
+ * nor the single lint-specific `configFile` key. Rule, format, and plugin
420
+ * settings live only in the lint config file, so a leftover inline key is
421
+ * surfaced as an explicit migration error rather than silently ignored.
422
+ */
423
+ function rejectUnsupportedEntryKeys(entry: ITtscLintPluginConfig): void {
424
+ for (const key of Object.keys(entry as Record<string, unknown>)) {
425
+ if (FRAMEWORK_KEYS.has(key) || key === "configFile") {
426
+ continue;
427
+ }
428
+ throw new Error(
429
+ `@ttsc/lint: tsconfig plugin entry contains unsupported key ${JSON.stringify(key)}. ` +
430
+ `Only "transform", "enabled", and "configFile" are accepted here; ` +
431
+ `put lint rules, format, and contributors in a ` +
432
+ `lint.config.{ts,cts,mts,js,cjs,mjs,json} file.`,
433
+ );
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Reads the optional `configFile` key from the tsconfig plugin entry. It is the
439
+ * only lint-specific key the entry accepts; when present it overrides
440
+ * auto-discovery of the lint config file.
441
+ */
442
+ function readConfigFileOption(
443
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
444
+ ): string | undefined {
445
+ const value = (context.plugin as { configFile?: unknown }).configFile;
446
+ if (value === undefined) return undefined;
447
+ if (typeof value !== "string" || value.length === 0) {
448
+ throw new Error(`@ttsc/lint: "configFile" must be a non-empty string path`);
449
+ }
450
+ return value;
451
+ }
452
+
453
+ function discoveryConfigBaseDirs(
454
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
455
+ ): string[] {
456
+ if (context.pluginConfigDir) {
457
+ return [path.resolve(context.cwd ?? ".", context.pluginConfigDir)];
458
+ }
459
+ const tsconfigDir = tsconfigBaseDir(context);
460
+ const cwd = path.resolve(context.cwd ?? context.projectRoot);
461
+ return tsconfigDir === cwd ? [tsconfigDir] : [tsconfigDir, cwd];
462
+ }
463
+
464
+ /** Return the non-directory candidates native discovery recognizes. */
465
+ function lintConfigMatchesIn(directory: string): string[] {
466
+ const matches: string[] = [];
467
+ for (const name of LINT_CONFIG_FILENAMES) {
468
+ const candidate = path.join(directory, name);
469
+ try {
470
+ // Go's os.Stat follows symlinks and junctions. Follow them here too so a
471
+ // directory or dangling link cannot stop descriptor discovery before
472
+ // the native host reaches a valid ancestor config. Probing the canonical
473
+ // candidate spelling also preserves Go's behavior on case-insensitive
474
+ // filesystems when the directory entry uses different casing.
475
+ if (!fs.statSync(candidate).isDirectory()) matches.push(candidate);
476
+ } catch {
477
+ // Missing, dangling, and unreadable candidates are not native matches.
478
+ }
479
+ }
480
+ return matches;
481
+ }
482
+
483
+ /**
484
+ * Base directory for resolving a relative `configFile` from the tsconfig plugin
485
+ * entry. Mirrors the Go side (driver.PluginConfigBaseDir): the caller-declared
486
+ * pluginConfigDir wins when present — the resolved tsconfig is then a generated
487
+ * wrapper in a temp directory that no longer identifies the project — otherwise
488
+ * the tsconfig directory, falling back to the working directory.
489
+ */
490
+ function pluginConfigBaseDir(
491
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
492
+ ): string {
493
+ if (context.pluginConfigDir) {
494
+ return path.resolve(context.cwd ?? ".", context.pluginConfigDir);
495
+ }
496
+ return tsconfigBaseDir(context);
497
+ }
498
+
499
+ function tsconfigBaseDir(
500
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
501
+ ): string {
502
+ const cwd = context.cwd ?? context.projectRoot;
503
+ if (context.tsconfig) {
504
+ return path.dirname(
505
+ path.isAbsolute(context.tsconfig)
506
+ ? context.tsconfig
507
+ : path.join(cwd, context.tsconfig),
508
+ );
509
+ }
510
+ return path.resolve(cwd);
511
+ }
512
+
513
+ function readConfigPluginEntries(
514
+ configPath: string,
515
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
516
+ ): ConfigPluginEvaluation {
517
+ // A JSON config that can bring no contributor with it — no `plugins` map and
518
+ // no `extends` chain to follow — has nothing to extract, and reading it runs
519
+ // no user code, so the isolated evaluator is not needed to keep its strings
520
+ // away from stdout. Skipping it there matters beyond the cost: the evaluator
521
+ // is a real subprocess, and a host that only wanted to know whether there
522
+ // were contributors would otherwise depend on a launcher being resolvable and
523
+ // on a compiler accepting one more invocation.
524
+ if (jsonConfigDeclaresNoContributor(configPath)) {
525
+ return { dependencies: [], entries: [] };
526
+ }
527
+ // Every other config uses the same isolated evaluator. Executable config can
528
+ // name contributor packages whose top-level code writes to stdout, so loading
529
+ // it in this host process would corrupt CLI JSON or preface the first LSP
530
+ // frame.
531
+ return readTtsxConfigPlugins(configPath, context);
532
+ }
533
+
534
+ function jsonConfigDeclaresNoContributor(configPath: string): boolean {
535
+ if (path.extname(configPath).toLowerCase() !== ".json") return false;
536
+ try {
537
+ const value: unknown = JSON.parse(fs.readFileSync(configPath, "utf8"));
538
+ return !configMayDeclareContributor(value);
539
+ } catch {
540
+ // A malformed config is the evaluator's diagnostic to report, not this
541
+ // shortcut's, so it falls through to the path that reports it.
542
+ return false;
543
+ }
544
+ }
545
+
546
+ /**
547
+ * Whether any object in a config could still bring a contributor with it.
548
+ *
549
+ * A `plugins` map names one directly. An `extends` chain names one indirectly:
550
+ * the base it points at may be executable and may declare contributors of its
551
+ * own, and following that chain is the evaluator's job. Treating a config that
552
+ * extends anything as undecidable here is what keeps this shortcut from
553
+ * silently dropping a contributor the base would have supplied.
554
+ */
555
+ function configMayDeclareContributor(value: unknown): boolean {
556
+ if (Array.isArray(value)) {
557
+ return value.some((entry) => configMayDeclareContributor(entry));
558
+ }
559
+ if (value === null || typeof value !== "object") return false;
560
+ const record = value as Record<string, unknown>;
561
+ for (const key of ["plugins", "extends"]) {
562
+ const declared = record[key];
563
+ if (declared !== undefined && declared !== null) return true;
564
+ }
565
+ return false;
566
+ }
567
+
568
+ // TypeScript source written to a temp file and executed via ttsx. The
569
+ // %CONFIG_IMPORT% placeholder is replaced with a JSON-quoted file URL
570
+ // before the file hits disk. The script walks the exported config object,
571
+ // collects plugin source paths and dependency fingerprints into one JSON
572
+ // envelope for the parent. Arbitrary in-memory plugin objects do not need to
573
+ // cross the process boundary.
574
+ // The URL lives in a variable so tsgo does not statically resolve it.
575
+ /**
576
+ * The descriptor extractor's emitted source.
577
+ *
578
+ * Exported so a regression can inspect the same bytes the loader executes. The
579
+ * template consumes its own escapes, so reading this file's text instead would
580
+ * check characters no consumer ever sees.
581
+ */
582
+ export const TTSX_EXTRACTOR_SCRIPT = `// @ts-ignore -- internal loader must not require user-installed Node typings.
583
+ import * as fs from "node:fs";
584
+ // @ts-ignore -- internal loader must not require user-installed Node typings.
585
+ import { Buffer } from "node:buffer";
586
+ // @ts-ignore -- internal loader must not require user-installed Node typings.
587
+ import { createHash } from "node:crypto";
588
+ // @ts-ignore -- internal loader must not require user-installed Node typings.
589
+ import { createRequire, registerHooks } from "node:module";
590
+ // @ts-ignore -- internal loader must not require user-installed Node typings.
591
+ import * as path from "node:path";
592
+ // @ts-ignore -- internal loader must not require user-installed Node typings.
593
+ import { fileURLToPath, pathToFileURL } from "node:url";
594
+
595
+ const configUrl = %CONFIG_IMPORT%;
596
+ const outputPath = %CONFIG_OUTPUT%;
597
+ const resolutionRoot = path.resolve(%CONFIG_ROOT%);
598
+ const CONFIG_KEYS = new Set<string>([
599
+ "files",
600
+ "ignores",
601
+ "extends",
602
+ "plugins",
603
+ "rules",
604
+ "format",
605
+ ]);
606
+ const dependencies = new Map<string, {
607
+ digest: string;
608
+ identityStable: boolean;
609
+ kind: "directory" | "file" | "optional-file";
610
+ path: string;
611
+ owners: Set<string>;
612
+ realpath: string | null;
613
+ }>();
614
+ const graphNodes = new Map<string, string>();
615
+ const graphEdges: Array<{
616
+ child: string;
617
+ packageBoundary: boolean;
618
+ parent: string;
619
+ }> = [];
620
+ const configLocation = fileURLToPath(configUrl);
621
+ // Every spelling of this config the module system might key an edge under.
622
+ //
623
+ // Which one it uses is not knowable from here, and guessing has failed in both
624
+ // directions. A path handed in by another producer can be escaped by a rule
625
+ // Node does not share. Node respells a resolved file module through its real
626
+ // path unless "--preserve-symlinks" is set, so a config reached through a
627
+ // symlinked directory is keyed by its target. And a Windows 8.3 short name is
628
+ // not a symlink: fs.realpathSync expands it, the module resolver does not, so
629
+ // asking the volume there produces a spelling no edge carries.
630
+ //
631
+ // A seed that names a URL no edge was keyed under sits on a node with no
632
+ // outgoing edges, the walk ends immediately, and every dependency recorded
633
+ // after the first import is demoted from watch to cache. That failure is
634
+ // silent: the build still succeeds and simply stops reacting. Seeding every
635
+ // spelling costs one extra queue entry and cannot be wrong.
636
+ const configUrlSpellings = [
637
+ ...new Set([
638
+ configUrl,
639
+ pathToFileURL(configLocation).href,
640
+ pathToFileURL(realConfigLocation()).href,
641
+ ]),
642
+ ];
643
+ const configEntryUrls = new Set(configUrlSpellings);
644
+ const moduleProbeExtensions = [
645
+ ".ts",
646
+ ".tsx",
647
+ ".mts",
648
+ ".cts",
649
+ ".js",
650
+ ".mjs",
651
+ ".cjs",
652
+ ".json",
653
+ ".node",
654
+ ] as const;
655
+ const jsToTsProbeExtensions = new Map<string, readonly string[]>([
656
+ [".js", [".ts", ".tsx"]],
657
+ [".jsx", [".tsx"]],
658
+ [".mjs", [".mts"]],
659
+ [".cjs", [".cts"]],
660
+ ]);
661
+ for (const spelling of configUrlSpellings) {
662
+ graphNodes.set(spelling, configLocation);
663
+ }
664
+ recordDependency(
665
+ "file",
666
+ configLocation,
667
+ createHash("sha256").update(fs.readFileSync(configLocation)).digest("hex"),
668
+ configUrlSpellings,
669
+ );
670
+ recordPackageManifests(configLocation, configUrlSpellings);
671
+
672
+ declare const process: {
673
+ cwd(): string;
674
+ platform: string;
675
+ stdout: { write(value: string): void };
676
+ stderr: { write(value: string): void };
677
+ exit(code?: number): never;
678
+ };
679
+
680
+ const hooks = registerHooks({
681
+ resolve(specifier, context, nextResolve) {
682
+ const requestedParent =
683
+ context.parentURL && new URL(context.parentURL).href;
684
+ if (requestedParent !== undefined && graphNodes.has(requestedParent)) {
685
+ recordLocalResolutionCandidates(specifier, requestedParent);
686
+ }
687
+ const resolved = nextResolve(specifier, context);
688
+ if (typeof resolved.url !== "string" || !resolved.url.startsWith("file:")) {
689
+ return resolved;
690
+ }
691
+ const url = new URL(resolved.url).href;
692
+ const parent = context.parentURL && new URL(context.parentURL).href;
693
+ const location = fileURLToPath(url);
694
+ // The entry is recognized by what was asked for, not only by what came
695
+ // back. A module URL is assigned by whoever loaded it: a compiling loader
696
+ // can serve the config from its emitted output, and a platform can hand
697
+ // back a different spelling of the same file. Either way the URL bears no
698
+ // resemblance to the one this process was given, so the config's own
699
+ // imports would be rejected here — their parent is a URL no node was
700
+ // recorded under — and the graph would collapse to the records made before
701
+ // the first import. The request itself is unambiguous, so it decides.
702
+ const entry =
703
+ configEntryUrls.has(specifier) ||
704
+ url === new URL(configUrl).href ||
705
+ samePhysicalPath(location, configLocation);
706
+ if (!entry && (parent === undefined || !graphNodes.has(parent))) {
707
+ return resolved;
708
+ }
709
+ graphNodes.set(url, location);
710
+ if (entry && configEntryUrls.has(specifier) && specifier !== url) {
711
+ graphEdges.push({ child: url, packageBoundary: false, parent: specifier });
712
+ }
713
+ if (parent !== undefined) {
714
+ graphEdges.push({
715
+ child: url,
716
+ packageBoundary:
717
+ pathHasNodeModules(location) && !isLocalModuleSpecifier(specifier),
718
+ parent,
719
+ });
720
+ recordResolutionTopology(
721
+ specifier,
722
+ parent,
723
+ url,
724
+ location,
725
+ context.conditions,
726
+ );
727
+ }
728
+ try {
729
+ recordDependency(
730
+ "file",
731
+ location,
732
+ createHash("sha256").update(fs.readFileSync(location)).digest("hex"),
733
+ [url],
734
+ );
735
+ } catch {
736
+ // The evaluator remains authoritative for the load error. An unreadable
737
+ // dependency simply makes this result non-cacheable in the parent.
738
+ recordDependency("file", location, "", [url]);
739
+ }
740
+ return resolved;
741
+ },
742
+ });
743
+
744
+ // Wrapped and settled explicitly rather than written as a top-level await.
745
+ // The loader tsconfig's "module" now follows the config's own package, and
746
+ // TS1378 rejects top-level await under a CommonJS module option however this
747
+ // .mts file emits. The trailing catch is what a top-level await gave for
748
+ // free: without it a throw from the finally would leave the promise
749
+ // unsettled instead of failing the load.
750
+ (async () => {
751
+ try {
752
+ const importedConfig = configLocation.toLowerCase().endsWith(".json")
753
+ ? JSON.parse(fs.readFileSync(configLocation, "utf8").replace(/^\uFEFF/, ""))
754
+ : await import(configUrl);
755
+ const current = await resolveConfig(importedConfig, true);
756
+ const entries = await collectPluginEntries(current, configLocation, %CONFIG_CHAIN%);
757
+ fs.writeFileSync(outputPath, JSON.stringify({
758
+ dependencies: finalizeDependencies(),
759
+ entries,
760
+ }), "utf8");
761
+ } catch (error) {
762
+ reportLoaderFailure(error);
763
+ } finally {
764
+ hooks.deregister();
765
+ }
766
+ })().catch((error) => {
767
+ // Reached only when the finally above throws: the catch already ends the
768
+ // process, so this is the deregistration's own failure, not the config's.
769
+ reportLoaderFailure(error);
770
+ });
771
+
772
+ // reportLoaderFailure ends this loader on an error it can name, on both of the
773
+ // channels the parent uses.
774
+ //
775
+ // The stack is for a reader and streams to stderr as it is written. The reason
776
+ // is a fact about the user's config that a caller has to act on, so it travels
777
+ // as data through the result file the parent already reads. Only a well-formed
778
+ // envelope is honoured there, so a partially written or unrelated file leaves
779
+ // the process status to speak for itself.
780
+ function reportLoaderFailure(error: unknown): never {
781
+ // The trailing newline ends the stack as a line of its own. Without it the
782
+ // parent's own message, written to this same stream, starts mid-line.
783
+ process.stderr.write((error instanceof Error && error.stack ? error.stack : String(error)) + "\\n");
784
+ try {
785
+ fs.writeFileSync(
786
+ outputPath,
787
+ JSON.stringify({ __ttscLoaderError: error instanceof Error ? error.message : String(error) }),
788
+ "utf8",
789
+ );
790
+ } catch {
791
+ // A reason that cannot be written leaves the exit status as the report.
792
+ }
793
+ return process.exit(1);
794
+ }
795
+
796
+ function isObject(value: unknown): value is Record<string, unknown> {
797
+ return value !== null && typeof value === "object";
798
+ }
799
+
800
+ function recordDependency(
801
+ kind: "directory" | "file" | "optional-file",
802
+ location: string,
803
+ digest: string,
804
+ owners: readonly string[],
805
+ ): void {
806
+ const key = kind + "\\0" + location;
807
+ const previous = dependencies.get(key);
808
+ const mergedOwners = previous?.owners ?? new Set<string>();
809
+ for (const owner of owners) mergedOwners.add(owner);
810
+ const realpath = dependencyRealpath(location);
811
+ const identityStable =
812
+ previous?.identityStable !== false &&
813
+ (previous === undefined || previous.realpath === realpath);
814
+ dependencies.set(key, {
815
+ digest:
816
+ !identityStable ||
817
+ (previous !== undefined && previous.digest !== digest)
818
+ ? ""
819
+ : digest,
820
+ identityStable,
821
+ kind,
822
+ owners: mergedOwners,
823
+ path: location,
824
+ realpath,
825
+ });
826
+ }
827
+
828
+ function dependencyRealpath(location: string): string | null {
829
+ try {
830
+ return realPath(location);
831
+ } catch {
832
+ return null;
833
+ }
834
+ }
835
+
836
+ function isLocalModuleSpecifier(specifier: string): boolean {
837
+ return specifier.startsWith(".") ||
838
+ specifier.startsWith("/") ||
839
+ specifier.startsWith("file:") ||
840
+ /^[A-Za-z]:[\\\\/]/.test(specifier);
841
+ }
842
+
843
+ function pathHasNodeModules(location: string): boolean {
844
+ return location.replaceAll("\\\\", "/").split("/").includes("node_modules");
845
+ }
846
+
847
+ function recordResolutionTopology(
848
+ specifier: string,
849
+ parentUrl: string,
850
+ childUrl: string,
851
+ childLocation: string,
852
+ conditions: readonly string[],
853
+ ): void {
854
+ const owners = [parentUrl, childUrl];
855
+ const parentLocation = graphNodes.get(parentUrl);
856
+ if (parentLocation !== undefined && isLocalModuleSpecifier(specifier)) {
857
+ recordDirectoryDependency(path.dirname(parentLocation), owners);
858
+ }
859
+ recordDirectoryDependency(path.dirname(childLocation), owners);
860
+ recordPackageManifests(childLocation, owners);
861
+ if (parentLocation !== undefined && !isLocalModuleSpecifier(specifier)) {
862
+ recordNodeModulesSearchDirectories(
863
+ parentLocation,
864
+ specifier,
865
+ childLocation,
866
+ owners,
867
+ conditions,
868
+ );
869
+ }
870
+ }
871
+
872
+ function recordDirectoryDependency(
873
+ location: string,
874
+ owners: readonly string[],
875
+ ): void {
876
+ try {
877
+ recordDependency("directory", location, directoryDigest(location), owners);
878
+ } catch {
879
+ recordDependency("directory", location, "", owners);
880
+ }
881
+ }
882
+
883
+ function directoryDigest(location: string): string {
884
+ const entries: Buffer[] = [];
885
+ if (process.platform === "win32") {
886
+ for (const entry of fs.readdirSync(location, { withFileTypes: true })) {
887
+ let target = Buffer.alloc(0);
888
+ if (entry.isSymbolicLink()) {
889
+ try {
890
+ target = Buffer.from(
891
+ fs.readlinkSync(path.join(location, entry.name)),
892
+ "utf8",
893
+ );
894
+ } catch {
895
+ target = Buffer.from("<unreadable>");
896
+ }
897
+ }
898
+ entries.push(directoryDigestRecord(Buffer.from(entry.name), entry, target));
899
+ }
900
+ } else {
901
+ for (const entry of fs.readdirSync(location, {
902
+ encoding: "buffer",
903
+ withFileTypes: true,
904
+ })) {
905
+ let target = Buffer.alloc(0);
906
+ if (entry.isSymbolicLink()) {
907
+ try {
908
+ target = fs.readlinkSync(
909
+ Buffer.concat([
910
+ Buffer.from(location),
911
+ Buffer.from(path.sep),
912
+ entry.name,
913
+ ]),
914
+ { encoding: "buffer" },
915
+ );
916
+ } catch {
917
+ target = Buffer.from("<unreadable>");
918
+ }
919
+ }
920
+ entries.push(directoryDigestRecord(entry.name, entry, target));
921
+ }
922
+ }
923
+ entries.sort(Buffer.compare);
924
+ const serialized = Buffer.concat(
925
+ entries.flatMap((entry, index) =>
926
+ index === 0 ? [entry] : [Buffer.from([0]), entry],
927
+ ),
928
+ );
929
+ return createHash("sha256").update(serialized).digest("hex");
930
+ }
931
+
932
+ function directoryDigestRecord(
933
+ name: Buffer,
934
+ entry: {
935
+ isDirectory(): boolean;
936
+ isFile(): boolean;
937
+ isSymbolicLink(): boolean;
938
+ },
939
+ target: Buffer,
940
+ ): Buffer {
941
+ const kind = entry.isDirectory()
942
+ ? "directory"
943
+ : entry.isFile()
944
+ ? "file"
945
+ : entry.isSymbolicLink()
946
+ ? "symlink"
947
+ : "other";
948
+ return Buffer.concat([name, Buffer.from("\\0" + kind + "\\0"), target]);
949
+ }
950
+
951
+ function optionalFileDigest(location: string): string {
952
+ try {
953
+ const entry = fs.statSync(location);
954
+ if (entry.isFile()) {
955
+ return createHash("sha256")
956
+ .update(Buffer.concat([Buffer.from("file\\0"), fs.readFileSync(location)]))
957
+ .digest("hex");
958
+ }
959
+ if (entry.isDirectory()) {
960
+ return createHash("sha256")
961
+ .update("ttsc:host-input:directory\\0")
962
+ .digest("hex");
963
+ }
964
+ } catch {
965
+ // Missing and unreadable candidates share the absent state.
966
+ }
967
+ return createHash("sha256").update("missing\\0").digest("hex");
968
+ }
969
+
970
+ function recordOptionalFileDependency(
971
+ location: string,
972
+ owners: readonly string[],
973
+ ): boolean {
974
+ try {
975
+ if (fs.statSync(location).isFile()) {
976
+ recordDependency(
977
+ "file",
978
+ location,
979
+ createHash("sha256").update(fs.readFileSync(location)).digest("hex"),
980
+ owners,
981
+ );
982
+ return true;
983
+ }
984
+ } catch {
985
+ // The exact missing path remains a dependency of the resolution result.
986
+ }
987
+ recordDependency("optional-file", location, optionalFileDigest(location), owners);
988
+ return false;
989
+ }
990
+
991
+ function moduleResolutionCandidates(base: string): string[] {
992
+ const extension = path.extname(base).toLowerCase();
993
+ const substitutions = jsToTsProbeExtensions.get(extension) ?? [];
994
+ const stem = base.slice(0, base.length - extension.length);
995
+ return [
996
+ base,
997
+ ...substitutions.map((candidate) => stem + candidate),
998
+ ...moduleProbeExtensions.map((candidate) => base + candidate),
999
+ path.join(base, "package.json"),
1000
+ ...moduleProbeExtensions.map((candidate) =>
1001
+ path.join(base, "index" + candidate),
1002
+ ),
1003
+ ];
1004
+ }
1005
+
1006
+ /** Record exact local probes before the runtime resolver chooses one. */
1007
+ function recordLocalResolutionCandidates(
1008
+ specifier: string,
1009
+ parentUrl: string,
1010
+ ): void {
1011
+ if (!isLocalModuleSpecifier(specifier)) return;
1012
+ let bases: string[];
1013
+ try {
1014
+ if (specifier.startsWith("file:")) {
1015
+ bases = [fileURLToPath(specifier)];
1016
+ } else {
1017
+ const directory = path.dirname(fileURLToPath(parentUrl));
1018
+ const raw = path.resolve(directory, specifier);
1019
+ const suffixStart = specifier.search(/[?#]/);
1020
+ const pathname =
1021
+ suffixStart === -1 ? specifier : specifier.slice(0, suffixStart);
1022
+ bases = pathname === ""
1023
+ ? [raw]
1024
+ : [...new Set([raw, path.resolve(directory, pathname)])];
1025
+ }
1026
+ } catch {
1027
+ return;
1028
+ }
1029
+ const owners = [parentUrl];
1030
+ for (const base of bases) {
1031
+ try {
1032
+ if (fs.statSync(base).isFile()) {
1033
+ recordOptionalFileDependency(base, owners);
1034
+ continue;
1035
+ }
1036
+ } catch {
1037
+ // A missing exact spelling falls through to source/extension/directory
1038
+ // probes, all of which can redirect a later evaluation.
1039
+ }
1040
+ for (const candidate of moduleResolutionCandidates(base)) {
1041
+ recordOptionalFileDependency(candidate, owners);
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ /** CommonJS LOAD_AS_FILE / LOAD_AS_DIRECTORY candidates for one legacy path. */
1047
+ function recordLegacyPackagePathCandidates(
1048
+ candidate: string,
1049
+ owners: readonly string[],
1050
+ ): void {
1051
+ for (const file of [
1052
+ candidate,
1053
+ candidate + ".js",
1054
+ candidate + ".json",
1055
+ candidate + ".node",
1056
+ path.join(candidate, "package.json"),
1057
+ path.join(candidate, "index.js"),
1058
+ path.join(candidate, "index.json"),
1059
+ path.join(candidate, "index.node"),
1060
+ ]) {
1061
+ recordOptionalFileDependency(file, owners);
1062
+ }
1063
+ }
1064
+
1065
+ function recordPackageManifests(
1066
+ location: string,
1067
+ owners: readonly string[],
1068
+ ): void {
1069
+ let current = path.dirname(location);
1070
+ while (true) {
1071
+ const manifest = path.join(current, "package.json");
1072
+ if (recordOptionalFileDependency(manifest, owners)) return;
1073
+ const parent = path.dirname(current);
1074
+ if (parent === current || path.basename(current) === "node_modules") return;
1075
+ current = parent;
1076
+ }
1077
+ }
1078
+
1079
+ function recordNodeModulesSearchDirectories(
1080
+ parentLocation: string,
1081
+ specifier: string,
1082
+ childLocation: string,
1083
+ owners: readonly string[],
1084
+ conditions: readonly string[],
1085
+ ): void {
1086
+ const packageName = modulePackageName(specifier);
1087
+ const scope =
1088
+ specifier.startsWith("@") && specifier.includes("/")
1089
+ ? specifier.slice(0, specifier.indexOf("/"))
1090
+ : undefined;
1091
+ let current = path.dirname(parentLocation);
1092
+ while (true) {
1093
+ // A newly created nearer node_modules directory can shadow the package
1094
+ // selected by this evaluation, so missing search levels are dependencies.
1095
+ recordDirectoryDependency(current, owners);
1096
+ const modules = path.join(current, "node_modules");
1097
+ try {
1098
+ if (fs.statSync(modules).isDirectory()) {
1099
+ recordDirectoryDependency(modules, owners);
1100
+ if (scope !== undefined) {
1101
+ const scoped = path.join(modules, scope);
1102
+ try {
1103
+ if (fs.statSync(scoped).isDirectory()) {
1104
+ recordDirectoryDependency(scoped, owners);
1105
+ }
1106
+ } catch {
1107
+ // The directory digest of node_modules records a missing scope.
1108
+ }
1109
+ }
1110
+ }
1111
+ } catch {
1112
+ // Missing search levels do not participate in the current resolution.
1113
+ }
1114
+ if (packageName !== undefined) {
1115
+ const selected = recordPackageCandidateTopology(
1116
+ modules,
1117
+ packageName,
1118
+ specifier,
1119
+ childLocation,
1120
+ owners,
1121
+ conditions,
1122
+ );
1123
+ if (
1124
+ selected ||
1125
+ resolvedPackageContains(modules, packageName, childLocation)
1126
+ ) {
1127
+ return;
1128
+ }
1129
+ }
1130
+ if (
1131
+ packageName === undefined &&
1132
+ samePhysicalPath(current, resolutionRoot)
1133
+ ) {
1134
+ return;
1135
+ }
1136
+ const parent = path.dirname(current);
1137
+ if (parent === current) return;
1138
+ current = parent;
1139
+ }
1140
+ }
1141
+
1142
+ function recordPackageCandidateTopology(
1143
+ modules: string,
1144
+ packageName: string,
1145
+ specifier: string,
1146
+ childLocation: string,
1147
+ owners: readonly string[],
1148
+ conditions: readonly string[],
1149
+ ): boolean {
1150
+ const packageRoot = path.join(modules, packageName);
1151
+ const subpath = specifier
1152
+ .slice(packageName.length)
1153
+ .replace(/^[/\\\\]+/, "");
1154
+ try {
1155
+ if (!fs.statSync(packageRoot).isDirectory()) {
1156
+ recordOptionalFileDependency(
1157
+ path.join(packageRoot, "package.json"),
1158
+ owners,
1159
+ );
1160
+ recordLegacyPackagePathCandidates(
1161
+ subpath === "" ? packageRoot : path.join(packageRoot, subpath),
1162
+ owners,
1163
+ );
1164
+ return false;
1165
+ }
1166
+ } catch {
1167
+ recordOptionalFileDependency(
1168
+ path.join(packageRoot, "package.json"),
1169
+ owners,
1170
+ );
1171
+ recordLegacyPackagePathCandidates(
1172
+ subpath === "" ? packageRoot : path.join(packageRoot, subpath),
1173
+ owners,
1174
+ );
1175
+ return false;
1176
+ }
1177
+ const rootTopology = recordPackageRootTopology(
1178
+ packageRoot,
1179
+ owners,
1180
+ subpath === "",
1181
+ subpath === "" ? "." : "./" + subpath.replaceAll("\\\\", "/"),
1182
+ childLocation,
1183
+ conditions,
1184
+ );
1185
+ if (subpath !== "" && !rootTopology.hasExports) {
1186
+ return (
1187
+ recordPackageSubpathTopology(
1188
+ packageRoot,
1189
+ subpath,
1190
+ childLocation,
1191
+ owners,
1192
+ ) || rootTopology.selected
1193
+ );
1194
+ }
1195
+ return rootTopology.selected;
1196
+ }
1197
+
1198
+ function recordPackageRootTopology(
1199
+ packageRoot: string,
1200
+ owners: readonly string[],
1201
+ useMain: boolean,
1202
+ packageSubpath: string,
1203
+ childLocation: string,
1204
+ conditions: readonly string[],
1205
+ ): { hasExports: boolean; selected: boolean } {
1206
+ const normalizedRoot = path.resolve(packageRoot);
1207
+ const manifest = path.join(normalizedRoot, "package.json");
1208
+ const legacySelected = (): boolean =>
1209
+ useMain &&
1210
+ packagePathCandidateMatchesChild(normalizedRoot, childLocation, true);
1211
+ if (useMain) recordLegacyPackagePathCandidates(normalizedRoot, owners);
1212
+ if (!recordOptionalFileDependency(manifest, owners)) {
1213
+ const selected = legacySelected();
1214
+ if (!selected) {
1215
+ recordPackageIndexCandidates(normalizedRoot, useMain, owners);
1216
+ }
1217
+ return { hasExports: false, selected };
1218
+ }
1219
+ try {
1220
+ const value = JSON.parse(fs.readFileSync(manifest, "utf8"));
1221
+ if (value !== null && typeof value === "object") {
1222
+ const metadata = value as Record<string, unknown>;
1223
+ const hasExports =
1224
+ metadata.exports !== undefined && metadata.exports !== null;
1225
+ if (hasExports) {
1226
+ const target = selectPackageExportsTarget(
1227
+ metadata.exports,
1228
+ packageSubpath,
1229
+ new Set(conditions),
1230
+ );
1231
+ const candidate =
1232
+ typeof target === "string"
1233
+ ? packageExportsTarget(normalizedRoot, target)
1234
+ : undefined;
1235
+ const selected =
1236
+ candidate !== undefined &&
1237
+ packagePathCandidateMatchesChild(
1238
+ candidate,
1239
+ childLocation,
1240
+ false,
1241
+ );
1242
+ if (selected) {
1243
+ recordPackagePathCandidate(candidate, owners);
1244
+ } else if (candidate !== undefined) {
1245
+ // A nearer package the search skipped starts winning the moment its
1246
+ // own active target appears, and neither the parent node_modules
1247
+ // listing nor the manifest changes when only that file is created.
1248
+ recordOptionalFileDependency(candidate, owners);
1249
+ }
1250
+ return { hasExports: true, selected };
1251
+ }
1252
+ let selected = legacySelected();
1253
+ if (useMain && typeof metadata.main === "string") {
1254
+ // CommonJS main is a legacy path, not an exports target. Node resolves
1255
+ // it literally and permits absolute paths and paths outside the package.
1256
+ const main = path.resolve(normalizedRoot, metadata.main);
1257
+ recordPackagePathCandidate(main, owners);
1258
+ recordLegacyPackagePathCandidates(main, owners);
1259
+ selected =
1260
+ packagePathCandidateMatchesChild(main, childLocation, true) ||
1261
+ selected;
1262
+ }
1263
+ if (!selected) {
1264
+ recordPackageIndexCandidates(normalizedRoot, useMain, owners);
1265
+ }
1266
+ return {
1267
+ hasExports: false,
1268
+ selected,
1269
+ };
1270
+ }
1271
+ } catch {
1272
+ // Node owns malformed-manifest diagnostics; the manifest digest is enough
1273
+ // to invalidate this evaluation when its contents change.
1274
+ }
1275
+ const selected = legacySelected();
1276
+ if (!selected) {
1277
+ recordPackageIndexCandidates(normalizedRoot, useMain, owners);
1278
+ }
1279
+ return { hasExports: false, selected };
1280
+ }
1281
+
1282
+ // recordPackageIndexCandidates pins the LOAD_INDEX fallbacks of a package root
1283
+ // this resolution walked past without selecting. An empty package directory, or
1284
+ // one whose manifest declares no usable entry, becomes resolvable as soon as one
1285
+ // of these files exists, and that creation changes neither the parent directory
1286
+ // listing nor the manifest digest already recorded for the candidate.
1287
+ function recordPackageIndexCandidates(
1288
+ packageRoot: string,
1289
+ useMain: boolean,
1290
+ owners: readonly string[],
1291
+ ): void {
1292
+ if (!useMain) return;
1293
+ for (const name of ["index.js", "index.json", "index.node"]) {
1294
+ recordOptionalFileDependency(path.join(packageRoot, name), owners);
1295
+ }
1296
+ }
1297
+
1298
+ function selectPackageExportsTarget(
1299
+ exportsValue: unknown,
1300
+ packageSubpath: string,
1301
+ conditions: ReadonlySet<string>,
1302
+ ): string | null | undefined {
1303
+ let mappings: unknown = exportsValue;
1304
+ if (
1305
+ typeof mappings === "string" ||
1306
+ Array.isArray(mappings) ||
1307
+ (isObject(mappings) &&
1308
+ Object.keys(mappings).every((key) => !key.startsWith(".")))
1309
+ ) {
1310
+ if (packageSubpath !== ".") return undefined;
1311
+ return selectPackageTarget(mappings, "", false, conditions);
1312
+ }
1313
+ if (!isObject(mappings)) return undefined;
1314
+ if (
1315
+ Object.prototype.hasOwnProperty.call(mappings, packageSubpath) &&
1316
+ !packageSubpath.includes("*") &&
1317
+ !packageSubpath.endsWith("/")
1318
+ ) {
1319
+ return selectPackageTarget(
1320
+ mappings[packageSubpath],
1321
+ "",
1322
+ false,
1323
+ conditions,
1324
+ );
1325
+ }
1326
+ let bestMatch = "";
1327
+ let bestSubpath = "";
1328
+ for (const key of Object.keys(mappings)) {
1329
+ const wildcard = key.indexOf("*");
1330
+ if (
1331
+ wildcard === -1 ||
1332
+ key.lastIndexOf("*") !== wildcard ||
1333
+ !packageSubpath.startsWith(key.slice(0, wildcard))
1334
+ ) {
1335
+ continue;
1336
+ }
1337
+ const trailer = key.slice(wildcard + 1);
1338
+ if (
1339
+ packageSubpath.length < key.length ||
1340
+ !packageSubpath.endsWith(trailer) ||
1341
+ packagePatternKeyCompare(bestMatch, key) !== 1
1342
+ ) {
1343
+ continue;
1344
+ }
1345
+ bestMatch = key;
1346
+ bestSubpath = packageSubpath.slice(
1347
+ wildcard,
1348
+ packageSubpath.length - trailer.length,
1349
+ );
1350
+ }
1351
+ return bestMatch === ""
1352
+ ? undefined
1353
+ : selectPackageTarget(
1354
+ mappings[bestMatch],
1355
+ bestSubpath,
1356
+ true,
1357
+ conditions,
1358
+ );
1359
+ }
1360
+
1361
+ function selectPackageTarget(
1362
+ target: unknown,
1363
+ subpath: string,
1364
+ pattern: boolean,
1365
+ conditions: ReadonlySet<string>,
1366
+ ): string | null | undefined {
1367
+ if (typeof target === "string") {
1368
+ const selected = pattern ? target.replaceAll("*", subpath) : target;
1369
+ return validPackageExportsTarget(selected) ? selected : undefined;
1370
+ }
1371
+ if (Array.isArray(target)) {
1372
+ for (const item of target) {
1373
+ const selected = selectPackageTarget(
1374
+ item,
1375
+ subpath,
1376
+ pattern,
1377
+ conditions,
1378
+ );
1379
+ if (selected !== undefined && selected !== null) return selected;
1380
+ }
1381
+ return null;
1382
+ }
1383
+ if (isObject(target)) {
1384
+ for (const [condition, value] of Object.entries(target)) {
1385
+ if (condition !== "default" && !conditions.has(condition)) continue;
1386
+ const selected = selectPackageTarget(
1387
+ value,
1388
+ subpath,
1389
+ pattern,
1390
+ conditions,
1391
+ );
1392
+ if (selected !== undefined) return selected;
1393
+ }
1394
+ return undefined;
1395
+ }
1396
+ return target === null ? null : undefined;
1397
+ }
1398
+
1399
+ function packagePatternKeyCompare(left: string, right: string): number {
1400
+ const leftWildcard = left.indexOf("*");
1401
+ const rightWildcard = right.indexOf("*");
1402
+ const leftBase =
1403
+ leftWildcard === -1 ? left.length : leftWildcard + 1;
1404
+ const rightBase =
1405
+ rightWildcard === -1 ? right.length : rightWildcard + 1;
1406
+ if (leftBase > rightBase) return -1;
1407
+ if (rightBase > leftBase) return 1;
1408
+ if (leftWildcard === -1) return 1;
1409
+ if (rightWildcard === -1) return -1;
1410
+ if (left.length > right.length) return -1;
1411
+ if (right.length > left.length) return 1;
1412
+ return 0;
1413
+ }
1414
+
1415
+ function packageExportsTarget(
1416
+ packageRoot: string,
1417
+ target: string,
1418
+ ): string | undefined {
1419
+ if (!validPackageExportsTarget(target)) return undefined;
1420
+ try {
1421
+ // Node resolves an exports target as a URL against the package manifest,
1422
+ // so percent escapes, query strings, and fragments all take part in the
1423
+ // path it finally loads. Joining the raw target by hand diverges from that
1424
+ // whenever the target is anything but a plain relative path, and a target
1425
+ // Node resolves while this model rejects loses the selected file's
1426
+ // fingerprint, leaving a retargeted symlink cached as fresh.
1427
+ const packageUrl = pathToFileURL(path.join(packageRoot, "package.json"));
1428
+ const resolved = new URL(target, packageUrl);
1429
+ const packagePath = new URL(".", packageUrl).pathname;
1430
+ if (!resolved.pathname.startsWith(packagePath)) return undefined;
1431
+ return fileURLToPath(resolved);
1432
+ } catch {
1433
+ return undefined;
1434
+ }
1435
+ }
1436
+
1437
+ function validPackageExportsTarget(target: string): boolean {
1438
+ if (!target.startsWith("./") || /%2f|%5c/i.test(target)) return false;
1439
+ const components = target
1440
+ .slice(2)
1441
+ .replaceAll("\\\\", "/")
1442
+ .split("/");
1443
+ if (
1444
+ components.some(
1445
+ (component) => {
1446
+ try {
1447
+ const decoded = decodeURIComponent(component);
1448
+ return (
1449
+ decoded === "." ||
1450
+ decoded === ".." ||
1451
+ decoded.includes("/") ||
1452
+ decoded.includes("\\\\") ||
1453
+ decoded.toLowerCase() === "node_modules"
1454
+ );
1455
+ } catch {
1456
+ return true;
1457
+ }
1458
+ },
1459
+ )
1460
+ ) {
1461
+ return false;
1462
+ }
1463
+ return true;
1464
+ }
1465
+
1466
+ function packagePathCandidateMatchesChild(
1467
+ candidate: string,
1468
+ childLocation: string,
1469
+ legacy: boolean,
1470
+ ): boolean {
1471
+ let child: string;
1472
+ try {
1473
+ child = fs.realpathSync.native(childLocation);
1474
+ } catch {
1475
+ child = path.resolve(childLocation);
1476
+ }
1477
+ const candidates = legacy
1478
+ ? [
1479
+ candidate,
1480
+ candidate + ".js",
1481
+ candidate + ".json",
1482
+ candidate + ".node",
1483
+ path.join(candidate, "index.js"),
1484
+ path.join(candidate, "index.json"),
1485
+ path.join(candidate, "index.node"),
1486
+ ]
1487
+ : [candidate];
1488
+ return candidates.some((location) => {
1489
+ try {
1490
+ return sameResolutionPath(fs.realpathSync.native(location), child);
1491
+ } catch {
1492
+ return false;
1493
+ }
1494
+ });
1495
+ }
1496
+
1497
+ function recordPackageSubpathTopology(
1498
+ packageRoot: string,
1499
+ subpath: string,
1500
+ childLocation: string,
1501
+ owners: readonly string[],
1502
+ ): boolean {
1503
+ const candidate = boundedPackageTarget(packageRoot, subpath);
1504
+ if (candidate === undefined) return false;
1505
+ recordPackagePathCandidate(candidate, owners);
1506
+ recordLegacyPackagePathCandidates(candidate, owners);
1507
+ let selected = packagePathCandidateMatchesChild(
1508
+ candidate,
1509
+ childLocation,
1510
+ true,
1511
+ );
1512
+ try {
1513
+ if (!fs.statSync(candidate).isDirectory()) return selected;
1514
+ } catch {
1515
+ return selected;
1516
+ }
1517
+ const manifest = path.join(candidate, "package.json");
1518
+ if (!recordOptionalFileDependency(manifest, owners)) return selected;
1519
+ try {
1520
+ const value = JSON.parse(fs.readFileSync(manifest, "utf8"));
1521
+ if (value !== null && typeof value === "object") {
1522
+ const metadata = value as Record<string, unknown>;
1523
+ if (typeof metadata.main === "string") {
1524
+ const main = path.resolve(candidate, metadata.main);
1525
+ recordPackagePathCandidate(main, owners);
1526
+ recordLegacyPackagePathCandidates(main, owners);
1527
+ selected =
1528
+ packagePathCandidateMatchesChild(main, childLocation, true) ||
1529
+ selected;
1530
+ }
1531
+ }
1532
+ } catch {
1533
+ // Node owns malformed nested-package diagnostics.
1534
+ }
1535
+ return selected;
1536
+ }
1537
+
1538
+ function boundedPackageTarget(
1539
+ packageRoot: string,
1540
+ target: string,
1541
+ ): string | undefined {
1542
+ const candidate = path.resolve(packageRoot, target);
1543
+ const relative = path.relative(packageRoot, candidate);
1544
+ if (
1545
+ relative === ".." ||
1546
+ relative.startsWith(".." + path.sep) ||
1547
+ path.isAbsolute(relative)
1548
+ ) {
1549
+ return undefined;
1550
+ }
1551
+ return candidate;
1552
+ }
1553
+
1554
+ function recordPackagePathCandidate(
1555
+ candidate: string,
1556
+ owners: readonly string[],
1557
+ visited: Set<string> = new Set(),
1558
+ depth = 0,
1559
+ ): void {
1560
+ const normalized = path.resolve(candidate);
1561
+ // The depth bound owns termination. A platform-wide case fold would merge
1562
+ // paths that differ only by case, which a per-directory case-sensitive
1563
+ // Windows tree keeps distinct, and would truncate a valid symlink chain.
1564
+ if (depth >= 64 || visited.has(normalized)) return;
1565
+ visited.add(normalized);
1566
+ const parsed = path.parse(normalized);
1567
+ const components = normalized
1568
+ .slice(parsed.root.length)
1569
+ .split(path.sep)
1570
+ .filter(Boolean);
1571
+ let current = parsed.root;
1572
+ for (let index = 0; index < components.length; index++) {
1573
+ const component = components[index];
1574
+ const next = path.join(current, component);
1575
+ let entry: ReturnType<typeof fs.lstatSync>;
1576
+ try {
1577
+ entry = fs.lstatSync(next);
1578
+ } catch {
1579
+ recordDirectoryDependency(current, owners);
1580
+ return;
1581
+ }
1582
+ if (entry.isSymbolicLink()) {
1583
+ // The containing directory digest carries the raw link target.
1584
+ recordDirectoryDependency(current, owners);
1585
+ try {
1586
+ const target = fs.readlinkSync(next);
1587
+ const remainder = components.slice(index + 1);
1588
+ recordPackagePathCandidate(
1589
+ path.join(
1590
+ path.resolve(current, target),
1591
+ ...remainder,
1592
+ ),
1593
+ owners,
1594
+ visited,
1595
+ depth + 1,
1596
+ );
1597
+ } catch {
1598
+ // The lexical link record already carries the unreadable state.
1599
+ }
1600
+ }
1601
+ let isDirectory = entry.isDirectory();
1602
+ if (entry.isSymbolicLink()) {
1603
+ try {
1604
+ isDirectory = fs.statSync(next).isDirectory();
1605
+ } catch {
1606
+ return;
1607
+ }
1608
+ }
1609
+ if (index === components.length - 1) {
1610
+ recordDirectoryDependency(isDirectory ? next : current, owners);
1611
+ return;
1612
+ }
1613
+ if (!isDirectory) {
1614
+ recordDirectoryDependency(current, owners);
1615
+ return;
1616
+ }
1617
+ current = next;
1618
+ }
1619
+ recordDirectoryDependency(current, owners);
1620
+ }
1621
+
1622
+ function modulePackageName(specifier: string): string | undefined {
1623
+ if (specifier.startsWith("@")) {
1624
+ const components = specifier.split("/");
1625
+ return components.length >= 2
1626
+ ? components[0] + "/" + components[1]
1627
+ : undefined;
1628
+ }
1629
+ const [name] = specifier.split("/");
1630
+ return name && !name.startsWith("#") ? name : undefined;
1631
+ }
1632
+
1633
+ function resolvedPackageContains(
1634
+ modules: string,
1635
+ packageName: string,
1636
+ childLocation: string,
1637
+ ): boolean {
1638
+ try {
1639
+ const packageRoot = fs.realpathSync(path.join(modules, packageName));
1640
+ const child = fs.realpathSync(childLocation);
1641
+ const relative = path.relative(packageRoot, child);
1642
+ if (relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) {
1643
+ return false;
1644
+ }
1645
+ let ancestor = child;
1646
+ const depth = relative === "" ? 0 : relative.split(path.sep).length;
1647
+ for (let i = 0; i < depth; i++) ancestor = path.dirname(ancestor);
1648
+ return sameResolutionPath(packageRoot, ancestor);
1649
+ } catch {
1650
+ return false;
1651
+ }
1652
+ }
1653
+
1654
+ function sameResolutionPath(left: string, right: string): boolean {
1655
+ const leftPath = path.resolve(left);
1656
+ const rightPath = path.resolve(right);
1657
+ if (leftPath === rightPath) return true;
1658
+ if (path.relative(leftPath, rightPath) !== "") return false;
1659
+ // A native lexical case fold does not establish filesystem identity.
1660
+ // Verify case aliases without merging differently located hard links.
1661
+ try {
1662
+ const leftInfo = fs.statSync(leftPath, { bigint: true });
1663
+ const rightInfo = fs.statSync(rightPath, { bigint: true });
1664
+ return leftInfo.ino !== 0n && leftInfo.dev === rightInfo.dev && leftInfo.ino === rightInfo.ino;
1665
+ } catch {
1666
+ return false;
1667
+ }
1668
+ }
1669
+
1670
+ function samePhysicalPath(left: string, right: string): boolean {
1671
+ try {
1672
+ return sameResolutionPath(realPath(left), realPath(right));
1673
+ } catch {
1674
+ // Exact lexical spelling is still usable when a file disappears. A case
1675
+ // alias remains unproven until the filesystem identifies both paths.
1676
+ return sameResolutionPath(left, right);
1677
+ }
1678
+ }
1679
+
1680
+ /**
1681
+ * The config's real path, or its declared one when the volume will not say.
1682
+ *
1683
+ * A config can disappear between the host reading it and this loader starting,
1684
+ * and a throw here would replace a precise report from the import below with a
1685
+ * crash in bookkeeping. Seeding lexically instead only risks the demotion this
1686
+ * value exists to prevent, on a file that is already gone.
1687
+ */
1688
+ function realConfigLocation(): string {
1689
+ try {
1690
+ return realPath(configLocation);
1691
+ } catch {
1692
+ return configLocation;
1693
+ }
1694
+ }
1695
+
1696
+ function realPath(location: string): string {
1697
+ return fs.realpathSync.native
1698
+ ? fs.realpathSync.native(location)
1699
+ : fs.realpathSync(location);
1700
+ }
1701
+
1702
+ function finalizeDependencies(): Array<{
1703
+ digest: string;
1704
+ identityStable: boolean;
1705
+ kind: "directory" | "file" | "optional-file";
1706
+ path: string;
1707
+ realpath: string | null;
1708
+ scope: "cache" | "watch";
1709
+ }> {
1710
+ // The evaluator may have observed a dependency, run arbitrary config code,
1711
+ // and then serialize after that path changed again. Re-read every recorded
1712
+ // dependency under its original ownership set. Differences between recorded
1713
+ // observations invalidate reuse; identical digest and realpath observations
1714
+ // do not establish that no transient replacement occurred between them.
1715
+ for (const dependency of [...dependencies.values()]) {
1716
+ recordDependency(
1717
+ dependency.kind,
1718
+ dependency.path,
1719
+ currentDependencyDigest(dependency.kind, dependency.path),
1720
+ [...dependency.owners],
1721
+ );
1722
+ }
1723
+ const watched = graphWatchReachability();
1724
+ return [...dependencies.values()].map(({ owners, ...dependency }) => ({
1725
+ ...dependency,
1726
+ scope: [...owners].some((owner) => watched.has(owner))
1727
+ ? "watch"
1728
+ : "cache",
1729
+ }));
1730
+ }
1731
+
1732
+ function currentDependencyDigest(
1733
+ kind: "directory" | "file" | "optional-file",
1734
+ location: string,
1735
+ ): string {
1736
+ try {
1737
+ if (kind === "directory") return directoryDigest(location);
1738
+ if (kind === "optional-file") return optionalFileDigest(location);
1739
+ return createHash("sha256")
1740
+ .update(fs.readFileSync(location))
1741
+ .digest("hex");
1742
+ } catch {
1743
+ return "";
1744
+ }
1745
+ }
1746
+
1747
+ function graphWatchReachability(): Set<string> {
1748
+ const adjacency = new Map<string, typeof graphEdges>();
1749
+ for (const edge of graphEdges) {
1750
+ const outgoing = adjacency.get(edge.parent) ?? [];
1751
+ outgoing.push(edge);
1752
+ adjacency.set(edge.parent, outgoing);
1753
+ }
1754
+ const queue: Array<{ url: string; watched: boolean }> =
1755
+ configUrlSpellings.map((url) => ({ url, watched: true }));
1756
+ const visited = new Set<string>();
1757
+ const watched = new Set<string>();
1758
+ for (let head = 0; head < queue.length; head++) {
1759
+ const state = queue[head]!;
1760
+ const key = state.url + "\\0" + (state.watched ? "1" : "0");
1761
+ if (visited.has(key)) continue;
1762
+ visited.add(key);
1763
+ if (state.watched) watched.add(state.url);
1764
+ for (const edge of adjacency.get(state.url) ?? []) {
1765
+ const childLocation = graphNodes.get(edge.child);
1766
+ const childWatched = edge.packageBoundary
1767
+ ? false
1768
+ : childLocation !== undefined && !pathHasNodeModules(childLocation)
1769
+ ? true
1770
+ : state.watched;
1771
+ queue.push({ url: edge.child, watched: childWatched });
1772
+ }
1773
+ }
1774
+ return watched;
1775
+ }
1776
+
1777
+ function hasOwn(value: Record<string, unknown>, key: string): boolean {
1778
+ return Object.prototype.hasOwnProperty.call(value, key);
1779
+ }
1780
+
1781
+ async function resolveConfig(value: unknown, allowNamedConfig: boolean): Promise<unknown> {
1782
+ let current = value;
1783
+ for (let i = 0; i < 8; i++) {
1784
+ if (typeof current === "function") {
1785
+ current = await (current as () => unknown | Promise<unknown>)();
1786
+ allowNamedConfig = false;
1787
+ continue;
1788
+ }
1789
+ if (isObject(current) && !Array.isArray(current)) {
1790
+ if (hasOwn(current, "default")) {
1791
+ const defaultValue = current.default;
1792
+ if (isModuleNamespace(current) || !hasConfigKey(current)) {
1793
+ current = defaultValue;
1794
+ allowNamedConfig = false;
1795
+ continue;
1796
+ }
1797
+ const normalizedDefault = await resolveConfig(defaultValue, false);
1798
+ if (isObject(normalizedDefault) && !Array.isArray(normalizedDefault)) {
1799
+ current = mergeConfigObjects(normalizedDefault, current);
1800
+ allowNamedConfig = false;
1801
+ continue;
1802
+ }
1803
+ }
1804
+ if (allowNamedConfig && hasOwn(current, "config")) {
1805
+ current = current.config;
1806
+ allowNamedConfig = false;
1807
+ continue;
1808
+ }
1809
+ }
1810
+ break;
1811
+ }
1812
+ return current;
1813
+ }
1814
+
1815
+ function isModuleNamespace(value: Record<string, unknown>): boolean {
1816
+ return Object.prototype.toString.call(value) === "[object Module]";
1817
+ }
1818
+
1819
+ function hasConfigKey(value: Record<string, unknown>): boolean {
1820
+ for (const key of CONFIG_KEYS) {
1821
+ if (hasOwn(value, key)) {
1822
+ return true;
1823
+ }
1824
+ }
1825
+ return false;
1826
+ }
1827
+
1828
+ function mergeConfigObjects(
1829
+ base: Record<string, unknown>,
1830
+ override: Record<string, unknown>,
1831
+ ): Record<string, unknown> {
1832
+ const out: Record<string, unknown> = {};
1833
+ for (const key of CONFIG_KEYS) {
1834
+ if (hasOwn(base, key)) {
1835
+ out[key] = base[key];
1836
+ }
1837
+ }
1838
+ for (const key of CONFIG_KEYS) {
1839
+ if (hasOwn(override, key)) {
1840
+ out[key] = override[key];
1841
+ }
1842
+ }
1843
+ return out;
1844
+ }
1845
+
1846
+ // Follow the same containing-file-relative, base-first extends chain as the
1847
+ // native config reader. Each explicit base is a watch input even when it lives
1848
+ // in node_modules; imports made by that base retain ordinary package boundaries.
1849
+ async function collectPluginEntries(
1850
+ value: unknown,
1851
+ location: string,
1852
+ chain: readonly string[],
1853
+ ): Promise<Array<{ namespace: string; source: string } | { configFile: string; chain: readonly string[] }>> {
1854
+ const out: Array<{ namespace: string; source: string } | { configFile: string; chain: readonly string[] }> = [];
1855
+ if (Array.isArray(value)) {
1856
+ for (const item of value) out.push(...await collectPluginEntries(item, location, chain));
1857
+ return out;
1858
+ }
1859
+ if (!isObject(value)) return out;
1860
+ if (value.extends !== undefined && value.extends !== null) {
1861
+ if (typeof value.extends !== "string" || value.extends.trim() === "") {
1862
+ throw new Error("extends must be a non-empty string path to another config file");
1863
+ }
1864
+ const next = path.resolve(path.dirname(location), value.extends);
1865
+ if (chain.includes(next)) {
1866
+ throw new Error("extends cycle detected: " + [...chain, next].join(" -> "));
1867
+ }
1868
+ if (chain.length >= 32) {
1869
+ throw new Error("extends chain exceeds the depth limit of 32: " + chain.join(" -> "));
1870
+ }
1871
+ const nextUrl = pathToFileURL(next).href;
1872
+ const parentUrl = pathToFileURL(location).href;
1873
+ configEntryUrls.add(nextUrl);
1874
+ graphNodes.set(nextUrl, next);
1875
+ graphEdges.push({ child: nextUrl, packageBoundary: false, parent: parentUrl });
1876
+ recordDependency("file", next, createHash("sha256").update(fs.readFileSync(next)).digest("hex"), [nextUrl]);
1877
+ recordPackageManifests(next, [nextUrl]);
1878
+ // The owning parent evaluates typed bases under their own synthetic project.
1879
+ // A dynamic import here would give a typed base the consumer's tsconfig
1880
+ // when it falls outside this evaluator's entry manifest.
1881
+ if ([".ts", ".cts", ".mts"].includes(path.extname(next).toLowerCase())) {
1882
+ out.push({ configFile: next, chain: [...chain, next] });
1883
+ } else {
1884
+ const imported = next.toLowerCase().endsWith(".json")
1885
+ ? JSON.parse(fs.readFileSync(next, "utf8").replace(/^\uFEFF/, ""))
1886
+ : await import(nextUrl);
1887
+ const base = await resolveConfig(imported, true);
1888
+ out.push(...await collectPluginEntries(base, next, [...chain, next]));
1889
+ }
1890
+ }
1891
+ if (hasOwn(value, "plugins") && isObject(value.plugins)) {
1892
+ for (const [namespace, plugin] of Object.entries(value.plugins)) {
1893
+ const source = extractPluginSource(plugin, location);
1894
+ if (source === undefined || source.length === 0) {
1895
+ throw new Error("contributor " + JSON.stringify(namespace) + " must resolve to an object with a non-empty source string");
1896
+ }
1897
+ out.push({ namespace, source });
1898
+ }
1899
+ }
1900
+ return out;
1901
+ }
1902
+
1903
+ function extractPluginSource(value: unknown, location: string): string | undefined {
1904
+ if (typeof value === "string") {
1905
+ value = createRequire(pathToFileURL(location))(value);
1906
+ }
1907
+ if (!isObject(value)) return undefined;
1908
+ // ESM-from-CJS interop wraps CJS modules' \`exports.default\` so the
1909
+ // plugin object can land under a \`.default\` indirection. Walk a few
1910
+ // hops so contributors authored as \`export default plugin\` and
1911
+ // contributors authored as plain \`module.exports = plugin\` both
1912
+ // resolve identically.
1913
+ let current: Record<string, unknown> = value;
1914
+ // Bound default-wrapper traversal so a cyclic descriptor cannot loop.
1915
+ for (let i = 0; i < 8; i++) {
1916
+ if (typeof current.source === "string") break;
1917
+ const next = current.default;
1918
+ if (!isObject(next)) break;
1919
+ current = next;
1920
+ }
1921
+ const source = current.source;
1922
+ return typeof source === "string" ? source : undefined;
1923
+ }
1924
+ `;
1925
+
1926
+ /**
1927
+ * Resolves contributor plugin entries declared in any executable lint config,
1928
+ * memoized through the shared on-disk config cache.
1929
+ *
1930
+ * Evaluating such a config spawns a full `ttsx` subprocess. Typed extends bases
1931
+ * additionally use their own synthetic project and launcher, so their package
1932
+ * format is not replaced by the consuming project's compiler options.
1933
+ * JavaScript and JSON bases share their containing evaluator. A monorepo build
1934
+ * runs one `ttsc` process per package. A completed cache entry avoids another
1935
+ * evaluation of the same unchanged config; simultaneous cold processes may
1936
+ * still evaluate it independently. The cache key covers the entry's path and
1937
+ * exact contents; the payload also fingerprints every local module reached from
1938
+ * that entry. An entry or helper edit therefore re-evaluates cleanly without
1939
+ * treating installed packages as project watch inputs.
1940
+ */
1941
+ function readTtsxConfigPlugins(
1942
+ configPath: string,
1943
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
1944
+ ): ConfigPluginEvaluation {
1945
+ const resolutionRoot = path.resolve(pluginConfigBaseDir(context));
1946
+ const cacheKey = configCacheKey(`plugins\0${resolutionRoot}`, configPath);
1947
+ if (cacheKey) {
1948
+ const cached = readConfigPluginCache(cacheKey);
1949
+ // Re-validate cached entries before trusting them: a contributor's
1950
+ // resolved `source` directory may have moved since the entry was
1951
+ // written. A stale entry falls through to a fresh evaluation rather
1952
+ // than being forwarded to ttsc's plugin builder as a dead path.
1953
+ if (
1954
+ cached &&
1955
+ cached.entries.every(isValidConfigPluginEntry) &&
1956
+ configDependenciesAreCurrent(cached.dependencies)
1957
+ ) {
1958
+ return cached;
1959
+ }
1960
+ }
1961
+ // A config can be saved while it is being evaluated. Retry a bounded number
1962
+ // of times until every dependency still has the bytes the module hook saw.
1963
+ // A continuously changing config remains usable but is deliberately not
1964
+ // cached; watch will schedule another cycle.
1965
+ let evaluation: ConfigPluginEvaluation;
1966
+ for (let attempt = 0; attempt < 3; attempt++) {
1967
+ evaluation = evaluateTtsxConfigPlugins(configPath, context);
1968
+ if (configDependenciesAreCurrent(evaluation.dependencies)) {
1969
+ if (cacheKey) writeConfigPluginCache(cacheKey, evaluation);
1970
+ return evaluation;
1971
+ }
1972
+ }
1973
+ return evaluation!;
1974
+ }
1975
+
1976
+ /**
1977
+ * Reports whether a cached plugin entry is still usable: a well-formed
1978
+ * namespace and an absolute `source` that still points at a directory. Pure
1979
+ * predicate — never throws — so a malformed cache entry simply triggers
1980
+ * re-evaluation instead of aborting plugin discovery.
1981
+ */
1982
+ function isValidConfigPluginEntry(entry: unknown): entry is ConfigPluginEntry {
1983
+ if (
1984
+ entry == null ||
1985
+ typeof entry !== "object" ||
1986
+ typeof (entry as ConfigPluginEntry).namespace !== "string" ||
1987
+ typeof (entry as ConfigPluginEntry).source !== "string"
1988
+ ) {
1989
+ return false;
1990
+ }
1991
+ const { namespace, source } = entry as ConfigPluginEntry;
1992
+ if (!NAMESPACE_PATTERN.test(namespace) || !path.isAbsolute(source)) {
1993
+ return false;
1994
+ }
1995
+ try {
1996
+ return fs.statSync(source).isDirectory();
1997
+ } catch {
1998
+ return false;
1999
+ }
2000
+ }
2001
+
2002
+ /**
2003
+ * Evaluate typed bases with their own project and merge base-first entries and
2004
+ * observed inputs. JavaScript and JSON bases remain in their containing
2005
+ * evaluator. A call-owned memo avoids evaluating the same typed base twice; no
2006
+ * result escapes the validated aggregate config cache.
2007
+ */
2008
+ function evaluateTtsxConfigPlugins(
2009
+ configPath: string,
2010
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
2011
+ chain: readonly string[] = [configPath],
2012
+ evaluated: Map<string, ConfigPluginEvaluation> = new Map(),
2013
+ ): ConfigPluginEvaluation {
2014
+ const existing = evaluated.get(configPath);
2015
+ if (existing !== undefined) return existing;
2016
+ const tempDir = createCanonicalTempDirectory(
2017
+ "ttsc-lint-cfg-",
2018
+ loaderTempBase(configPath),
2019
+ );
2020
+ try {
2021
+ linkNearestNodeModules(tempDir, path.dirname(configPath));
2022
+ const loaderPath = path.join(tempDir, "loader.mts");
2023
+ const outputPath = path.join(tempDir, "result.json");
2024
+ const tsconfigPath = path.join(tempDir, "tsconfig.json");
2025
+ const loaderSource = TTSX_EXTRACTOR_SCRIPT.replace(
2026
+ "%CONFIG_IMPORT%",
2027
+ JSON.stringify(pathToFileURL(configPath).href),
2028
+ )
2029
+ .replace("%CONFIG_CHAIN%", JSON.stringify(chain))
2030
+ .replace("%CONFIG_OUTPUT%", JSON.stringify(outputPath))
2031
+ .replace(
2032
+ "%CONFIG_ROOT%",
2033
+ JSON.stringify(path.resolve(pluginConfigBaseDir(context))),
2034
+ );
2035
+ fs.writeFileSync(loaderPath, loaderSource, "utf8");
2036
+ fs.writeFileSync(
2037
+ tsconfigPath,
2038
+ JSON.stringify(
2039
+ {
2040
+ compilerOptions: {
2041
+ // `.mjs` and `.js` configs reach this loader because Node
2042
+ // cannot `require()` ESM synchronously; ttsx's TypeScript
2043
+ // project compiler refuses to admit them without `allowJs`,
2044
+ // so set it alongside the strict bypass to make the loader
2045
+ // tolerant of any of `lint.config.{ts,cts,mts,js,mjs,cjs}`.
2046
+ allowImportingTsExtensions: true,
2047
+ allowJs: true,
2048
+ checkJs: false,
2049
+ // The config is a Node module, so Node's rule decides its format:
2050
+ // the nearest `package.json` `type` above it. Hardcoding one answer
2051
+ // ran every ambiguous `.ts` config as ESM and broke `__dirname` in
2052
+ // an ordinary CommonJS package (#1068). `moduleResolution` stays
2053
+ // `bundler`, which tsgo accepts for both kinds, so extensionless
2054
+ // relative imports keep resolving either way.
2055
+ module: configModuleOption(configPath),
2056
+ moduleResolution: "bundler",
2057
+ noImplicitAny: false,
2058
+ outDir: path.join(tempDir, "out").replace(/\\/g, "/"),
2059
+ rewriteRelativeImportExtensions: true,
2060
+ rootDir: path.parse(tempDir).root.replace(/\\/g, "/"),
2061
+ skipLibCheck: true,
2062
+ strict: false,
2063
+ target: "ES2022",
2064
+ // TypeScript 7 includes no ambient type package unless `types` asks
2065
+ // for it, and this Program extends nothing, so without the wildcard
2066
+ // a config could not name a single Node global (#1068). The loader
2067
+ // directory links the config's nearest `node_modules`, so the
2068
+ // default `typeRoots` walk finds exactly what the project installed.
2069
+ types: ["*"],
2070
+ },
2071
+ files: [
2072
+ loaderPath.replace(/\\/g, "/"),
2073
+ ...(path.extname(configPath).toLowerCase() === ".json"
2074
+ ? []
2075
+ : [configPath.replace(/\\/g, "/")]),
2076
+ ],
2077
+ },
2078
+ null,
2079
+ 2,
2080
+ ),
2081
+ "utf8",
2082
+ );
2083
+
2084
+ // The config comes first, so a project that pins its own ttsc gets it. This
2085
+ // descriptor's own location comes second, because a fixture or a workspace
2086
+ // that installs only the lint package cannot resolve ttsc from the config
2087
+ // at all, and the descriptor always sits beside the host that loaded it.
2088
+ const ttsxBinary = resolveTtsxLauncher([configPath, context.dirname]);
2089
+ // `--no-plugins` keeps this build hermetic: the loader only needs to
2090
+ // type-check and run the user's lint config to extract its plugin
2091
+ // entries. Loading the host project's transform/check plugins
2092
+ // (`@nestia/core`, `typia`, …) would run their project checks
2093
+ // against this deliberately lenient loader tsconfig and fail the
2094
+ // build — e.g. `@nestia/core` rejects the loader's `strict: false`.
2095
+ const args = [
2096
+ "--project",
2097
+ tsconfigPath,
2098
+ "--cwd",
2099
+ tempDir,
2100
+ "--no-plugins",
2101
+ loaderPath,
2102
+ ];
2103
+ const tsgoBinary = resolveConfigTsgo(configPath, context);
2104
+ if (tsgoBinary) {
2105
+ args.unshift("--binary", tsgoBinary);
2106
+ }
2107
+ const env = {
2108
+ ...nodeConfigLoaderEnv(configPath),
2109
+ };
2110
+ const command = ttsxThroughNodeIfNeeded(ttsxBinary, env, tempDir);
2111
+ const observation = beginLintTrace();
2112
+ const lower = observation ? new Date().toISOString() : undefined;
2113
+ observation?.record("process-attempt", {
2114
+ pid: 0,
2115
+ argv: [command.binary, ...command.prefix, ...args],
2116
+ cwd: tempDir,
2117
+ cwdInherited: false,
2118
+ startLowerBound: lower,
2119
+ owner: "lint-typescript-config-plugin-extractor",
2120
+ });
2121
+ const result = (() => {
2122
+ try {
2123
+ const actual = spawnSync(command.binary, [...command.prefix, ...args], {
2124
+ cwd: tempDir,
2125
+ env,
2126
+ // Both child streams are human output, and they go straight to this
2127
+ // process's stderr as they are written. Nothing is collected here: the
2128
+ // parent's stdout is reserved for compiler JSON and LSP frames, and
2129
+ // buffering the child only to replay it afterwards is what forced an
2130
+ // invented output ceiling and made a long evaluation print nothing at all.
2131
+ stdio: ["ignore", 2, 2],
2132
+ windowsHide: true,
2133
+ });
2134
+ observation?.record("process-result", {
2135
+ pid: actual.pid > 0 ? actual.pid : 0,
2136
+ started: actual.pid > 0,
2137
+ exitObserved: actual.status !== null || actual.signal !== null,
2138
+ status: actual.status,
2139
+ signal: actual.signal,
2140
+ error: actual.error?.message,
2141
+ argv: [command.binary, ...command.prefix, ...args],
2142
+ cwd: tempDir,
2143
+ cwdInherited: false,
2144
+ startLowerBound: lower,
2145
+ startUpperBound: new Date().toISOString(),
2146
+ owner: "lint-typescript-config-plugin-extractor",
2147
+ method: "spawnSync",
2148
+ });
2149
+ return actual;
2150
+ } catch (error) {
2151
+ observation?.record("process-result", {
2152
+ pid: 0,
2153
+ started: false,
2154
+ exitObserved: false,
2155
+ error: error instanceof Error ? error.message : String(error),
2156
+ argv: [command.binary, ...command.prefix, ...args],
2157
+ cwd: tempDir,
2158
+ cwdInherited: false,
2159
+ startLowerBound: lower,
2160
+ startUpperBound: new Date().toISOString(),
2161
+ owner: "lint-typescript-config-plugin-extractor",
2162
+ method: "spawnSync",
2163
+ });
2164
+ throw error;
2165
+ }
2166
+ })();
2167
+ const processFailure = configEvaluatorProcessFailure(result, configPath);
2168
+ if (processFailure) {
2169
+ // The evaluator's stack already reached the user's stderr as it ran. What
2170
+ // it could not put there is a reason a caller can act on, so that arrives
2171
+ // through the result file instead.
2172
+ const reason = configEvaluatorFailureReason(outputPath);
2173
+ throw reason === ""
2174
+ ? processFailure
2175
+ : new Error(`${processFailure.message}\n${reason}`);
2176
+ }
2177
+ let payload: {
2178
+ dependencies?: ConfigDependencyFingerprint[];
2179
+ entries?: (ConfigPluginEntry | { configFile: string; chain: string[] })[];
2180
+ };
2181
+ try {
2182
+ payload = JSON.parse(fs.readFileSync(outputPath, "utf8")) as {
2183
+ dependencies?: ConfigDependencyFingerprint[];
2184
+ entries?: (
2185
+ | ConfigPluginEntry
2186
+ | { configFile: string; chain: string[] }
2187
+ )[];
2188
+ };
2189
+ } catch (error) {
2190
+ throw new Error(
2191
+ `@ttsc/lint: lint config ${configPath} evaluator returned invalid JSON: ${
2192
+ error instanceof Error ? error.message : String(error)
2193
+ }`,
2194
+ );
2195
+ }
2196
+ if (!Array.isArray(payload.entries)) {
2197
+ throw new Error(
2198
+ `@ttsc/lint: lint config ${configPath} evaluator omitted its plugin-entry array`,
2199
+ );
2200
+ }
2201
+ const nestedDependencies: ConfigDependencyFingerprint[] = [];
2202
+ const entries = payload.entries.flatMap((entry): ConfigPluginEntry[] => {
2203
+ if (
2204
+ entry !== null &&
2205
+ typeof entry === "object" &&
2206
+ "configFile" in entry
2207
+ ) {
2208
+ if (
2209
+ typeof entry.configFile !== "string" ||
2210
+ !path.isAbsolute(entry.configFile) ||
2211
+ !Array.isArray(entry.chain) ||
2212
+ entry.chain.length <= chain.length ||
2213
+ entry.chain.length > 32 ||
2214
+ entry.chain.some(
2215
+ (location, index) =>
2216
+ typeof location !== "string" ||
2217
+ (index < chain.length && location !== chain[index]),
2218
+ ) ||
2219
+ entry.chain.at(-1) !== entry.configFile ||
2220
+ new Set(entry.chain).size !== entry.chain.length
2221
+ )
2222
+ throw new Error(
2223
+ `@ttsc/lint: lint config ${configPath} evaluator returned a malformed base-config request`,
2224
+ );
2225
+ const base = evaluateTtsxConfigPlugins(
2226
+ entry.configFile,
2227
+ context,
2228
+ entry.chain,
2229
+ evaluated,
2230
+ );
2231
+ nestedDependencies.push(...base.dependencies);
2232
+ return base.entries;
2233
+ }
2234
+ // Contributor objects supply absolute source directories. Validate that
2235
+ // boundary without re-routing directories through module resolution.
2236
+ if (
2237
+ entry === null ||
2238
+ typeof entry !== "object" ||
2239
+ typeof entry.namespace !== "string"
2240
+ ) {
2241
+ throw new Error(
2242
+ `@ttsc/lint: lint config ${configPath} evaluator returned a malformed plugin entry`,
2243
+ );
2244
+ }
2245
+ if (!NAMESPACE_PATTERN.test(entry.namespace)) {
2246
+ throw new Error(
2247
+ `@ttsc/lint: lint config ${configPath} namespace ${JSON.stringify(entry.namespace)} must match /^[a-z][a-z0-9_-]*$/`,
2248
+ );
2249
+ }
2250
+ if (typeof entry.source !== "string" || entry.source.length === 0) {
2251
+ throw new Error(
2252
+ `@ttsc/lint: lint config ${configPath} plugin ${JSON.stringify(entry.namespace)} did not expose a "source" string`,
2253
+ );
2254
+ }
2255
+ if (!path.isAbsolute(entry.source)) {
2256
+ throw new Error(
2257
+ `@ttsc/lint: lint config ${configPath} plugin ${JSON.stringify(entry.namespace)} "source" must be absolute; got ${JSON.stringify(entry.source)}`,
2258
+ );
2259
+ }
2260
+ if (
2261
+ !fs.existsSync(entry.source) ||
2262
+ !fs.statSync(entry.source).isDirectory()
2263
+ ) {
2264
+ throw new Error(
2265
+ `@ttsc/lint: lint config ${configPath} plugin ${JSON.stringify(entry.namespace)} "source" must be an existing directory: ${entry.source}`,
2266
+ );
2267
+ }
2268
+ return [{ namespace: entry.namespace, source: entry.source }];
2269
+ });
2270
+ const dependencies = normalizeConfigDependencyFingerprints(
2271
+ payload.dependencies,
2272
+ );
2273
+ if (dependencies === undefined) {
2274
+ throw new Error(
2275
+ `@ttsc/lint: lint config ${configPath} evaluator returned malformed dependency fingerprints`,
2276
+ );
2277
+ }
2278
+ const merged = new Map<string, ConfigDependencyFingerprint>();
2279
+ for (const dependency of [...dependencies, ...nestedDependencies]) {
2280
+ const key = dependency.kind + "\0" + dependency.path;
2281
+ const previous = merged.get(key);
2282
+ if (
2283
+ previous !== undefined &&
2284
+ (previous.digest !== dependency.digest ||
2285
+ previous.realpath !== dependency.realpath)
2286
+ ) {
2287
+ throw new Error(
2288
+ `@ttsc/lint: config dependency changed between base evaluations: ${dependency.path}`,
2289
+ );
2290
+ }
2291
+ merged.set(key, {
2292
+ ...dependency,
2293
+ identityStable:
2294
+ dependency.identityStable && (previous?.identityStable ?? true),
2295
+ scope:
2296
+ dependency.scope === "watch" || previous?.scope === "watch"
2297
+ ? "watch"
2298
+ : "cache",
2299
+ });
2300
+ }
2301
+ const evaluation = { dependencies: [...merged.values()], entries };
2302
+ evaluated.set(configPath, evaluation);
2303
+ return evaluation;
2304
+ } finally {
2305
+ removeEvaluationTempDir(tempDir);
2306
+ }
2307
+ }
2308
+
2309
+ // ────────────────────────────────────────────────────────────────────────────
2310
+ // Config cache (shared with the Go sidecar — packages/lint/linthost/config.go)
2311
+ // ────────────────────────────────────────────────────────────────────────────
2312
+
2313
+ /** Create evaluator storage beneath a frozen physical parent. */
2314
+ function createCanonicalTempDirectory(prefix: string, parent: string): string {
2315
+ const physicalParent = fs.realpathSync.native(parent);
2316
+ if (!fs.lstatSync(physicalParent).isDirectory()) {
2317
+ throw new Error(
2318
+ `@ttsc/lint: temporary directory parent is not a directory: ${physicalParent}`,
2319
+ );
2320
+ }
2321
+ const directory = fs.mkdtempSync(path.join(physicalParent, prefix));
2322
+ if (!fs.lstatSync(directory).isDirectory()) {
2323
+ throw new Error(
2324
+ `@ttsc/lint: temporary directory postflight is not a directory: ${directory}`,
2325
+ );
2326
+ }
2327
+ const physicalDirectory = fs.realpathSync.native(directory);
2328
+ if (path.dirname(physicalDirectory) !== physicalParent) {
2329
+ throw new Error(
2330
+ `@ttsc/lint: temporary directory escaped its physical parent: ${physicalDirectory}`,
2331
+ );
2332
+ }
2333
+ return physicalDirectory;
2334
+ }
2335
+
2336
+ /**
2337
+ * Namespaces the on-disk config cache. Kept in lockstep with the Go sidecar's
2338
+ * `configCacheVersion`; bump both when the shape or evaluator semantics
2339
+ * change.
2340
+ */
2341
+ const CONFIG_CACHE_VERSION = "v12";
2342
+
2343
+ /**
2344
+ * Directory shared by this factory and the Go sidecar for cached lint configs.
2345
+ * The two write different files (the `kind` segment of the cache key keeps
2346
+ * their namespaces apart), so they coexist without collision.
2347
+ */
2348
+ function configCacheDir(): string {
2349
+ return path.join(os.tmpdir(), "ttsc-lint-config-cache");
2350
+ }
2351
+
2352
+ /** Env opt-out, mirroring the Go sidecar's `TTSC_LINT_DISABLE_CONFIG_CACHE`. */
2353
+ function configCacheDisabled(): boolean {
2354
+ return Boolean(process.env.TTSC_LINT_DISABLE_CONFIG_CACHE);
2355
+ }
2356
+
2357
+ /**
2358
+ * Content-addressed cache key for a lint config file. Mirrors the Go sidecar's
2359
+ * `configCacheKey`: a version tag, a namespace `kind`, the config's absolute
2360
+ * path, and its exact bytes. Returns "" — a "do not cache" signal — when the
2361
+ * file cannot be read or the env opt-out is set.
2362
+ */
2363
+ function configCacheKey(kind: string, configPath: string): string {
2364
+ if (configCacheDisabled()) return "";
2365
+ let content: Buffer;
2366
+ try {
2367
+ content = fs.readFileSync(configPath);
2368
+ } catch {
2369
+ return "";
2370
+ }
2371
+ return createHash("sha256")
2372
+ .update(CONFIG_CACHE_VERSION)
2373
+ .update("\0")
2374
+ .update(kind)
2375
+ .update("\0")
2376
+ .update(path.resolve(configPath))
2377
+ .update("\0")
2378
+ .update(content)
2379
+ .digest("hex");
2380
+ }
2381
+
2382
+ /**
2383
+ * Returns the cached plugin-entry list for `cacheKey`, or undefined on any miss
2384
+ * — a missing file, an unreadable file, or a malformed evaluation envelope.
2385
+ * Every failure is a soft miss: the caller re-evaluates.
2386
+ */
2387
+ function readConfigPluginCache(
2388
+ cacheKey: string,
2389
+ ): ConfigPluginEvaluation | undefined {
2390
+ let body: string;
2391
+ try {
2392
+ body = fs.readFileSync(
2393
+ path.join(configCacheDir(), `${cacheKey}.json`),
2394
+ "utf8",
2395
+ );
2396
+ } catch {
2397
+ return undefined;
2398
+ }
2399
+ try {
2400
+ const parsed: unknown = JSON.parse(body);
2401
+ if (
2402
+ parsed === null ||
2403
+ typeof parsed !== "object" ||
2404
+ !Array.isArray((parsed as ConfigPluginEvaluation).entries) ||
2405
+ !Array.isArray((parsed as ConfigPluginEvaluation).dependencies)
2406
+ ) {
2407
+ return undefined;
2408
+ }
2409
+ const dependencies = normalizeConfigDependencyFingerprints(
2410
+ (parsed as ConfigPluginEvaluation).dependencies,
2411
+ );
2412
+ if (dependencies === undefined) return undefined;
2413
+ return {
2414
+ dependencies,
2415
+ entries: (parsed as ConfigPluginEvaluation).entries,
2416
+ };
2417
+ } catch {
2418
+ return undefined;
2419
+ }
2420
+ }
2421
+
2422
+ /**
2423
+ * Writes `entries` to the config cache under `cacheKey`. Best-effort: any
2424
+ * failure leaves the cache cold rather than aborting plugin discovery. The
2425
+ * temp-file + rename keeps a concurrent reader in a sibling `ttsc` process from
2426
+ * observing a half-written file.
2427
+ */
2428
+ function writeConfigPluginCache(
2429
+ cacheKey: string,
2430
+ evaluation: ConfigPluginEvaluation,
2431
+ ): void {
2432
+ try {
2433
+ const dir = configCacheDir();
2434
+ fs.mkdirSync(dir, { recursive: true });
2435
+ const tmp = path.join(
2436
+ dir,
2437
+ `${cacheKey}.${process.pid}.${randomUUID()}.tmp`,
2438
+ );
2439
+ try {
2440
+ fs.writeFileSync(tmp, JSON.stringify(evaluation), "utf8");
2441
+ fs.renameSync(tmp, path.join(dir, `${cacheKey}.json`));
2442
+ } finally {
2443
+ try {
2444
+ fs.unlinkSync(tmp);
2445
+ } catch {
2446
+ // A successful rename already consumed the temporary path.
2447
+ }
2448
+ }
2449
+ } catch {
2450
+ // Cold cache on failure — the next invocation re-evaluates.
2451
+ }
2452
+ }
2453
+
2454
+ function normalizeConfigDependencyFingerprints(
2455
+ value: unknown,
2456
+ ): ConfigDependencyFingerprint[] | undefined {
2457
+ if (!Array.isArray(value) || value.length === 0) return undefined;
2458
+ const dependencies = new Map<string, ConfigDependencyFingerprint>();
2459
+ for (const candidate of value) {
2460
+ if (
2461
+ candidate === null ||
2462
+ typeof candidate !== "object" ||
2463
+ typeof (candidate as ConfigDependencyFingerprint).path !== "string" ||
2464
+ typeof (candidate as ConfigDependencyFingerprint).digest !== "string" ||
2465
+ typeof (candidate as ConfigDependencyFingerprint).identityStable !==
2466
+ "boolean" ||
2467
+ ((candidate as ConfigDependencyFingerprint).realpath !== null &&
2468
+ (typeof (candidate as ConfigDependencyFingerprint).realpath !==
2469
+ "string" ||
2470
+ !path.isAbsolute(
2471
+ (candidate as ConfigDependencyFingerprint).realpath as string,
2472
+ ))) ||
2473
+ !["directory", "file", "optional-file"].includes(
2474
+ (candidate as ConfigDependencyFingerprint).kind,
2475
+ ) ||
2476
+ !["cache", "watch"].includes(
2477
+ (candidate as ConfigDependencyFingerprint).scope,
2478
+ )
2479
+ ) {
2480
+ return undefined;
2481
+ }
2482
+ const candidatePath = (candidate as ConfigDependencyFingerprint).path;
2483
+ const digest = (candidate as ConfigDependencyFingerprint).digest;
2484
+ const kind = (candidate as ConfigDependencyFingerprint).kind;
2485
+ const identityStable = (candidate as ConfigDependencyFingerprint)
2486
+ .identityStable;
2487
+ const realpath = (candidate as ConfigDependencyFingerprint).realpath;
2488
+ const scope = (candidate as ConfigDependencyFingerprint).scope;
2489
+ if (
2490
+ !path.isAbsolute(candidatePath) ||
2491
+ (digest !== "" && !/^[0-9a-f]{64}$/.test(digest))
2492
+ ) {
2493
+ return undefined;
2494
+ }
2495
+ const location = path.resolve(candidatePath);
2496
+ // The same lexical path can be both a traversed directory and an exact
2497
+ // file candidate. Those observations have different freshness contracts:
2498
+ // one fingerprints the listing, while the other fingerprints its entry
2499
+ // type. Preserve both, but still reject contradictory duplicates of one
2500
+ // kind.
2501
+ const key = kind + "\0" + location;
2502
+ const previous = dependencies.get(key);
2503
+ if (
2504
+ previous !== undefined &&
2505
+ (previous.digest !== digest ||
2506
+ previous.identityStable !== identityStable ||
2507
+ previous.kind !== kind ||
2508
+ previous.realpath !== realpath ||
2509
+ previous.scope !== scope)
2510
+ ) {
2511
+ return undefined;
2512
+ }
2513
+ dependencies.set(key, {
2514
+ digest,
2515
+ identityStable,
2516
+ kind,
2517
+ path: location,
2518
+ realpath,
2519
+ scope,
2520
+ });
2521
+ }
2522
+ return [...dependencies.values()].sort((left, right) =>
2523
+ left.path.localeCompare(right.path),
2524
+ );
2525
+ }
2526
+
2527
+ function configDependenciesAreCurrent(
2528
+ dependencies: readonly ConfigDependencyFingerprint[],
2529
+ ): boolean {
2530
+ if (dependencies.length === 0) return false;
2531
+ return dependencies.every((dependency) => {
2532
+ if (
2533
+ !dependency.identityStable ||
2534
+ dependency.realpath !== hostInputRealpath(dependency.path)
2535
+ ) {
2536
+ return false;
2537
+ }
2538
+ if (!/^[0-9a-f]{64}$/.test(dependency.digest)) return false;
2539
+ try {
2540
+ const digest =
2541
+ dependency.kind === "directory"
2542
+ ? configDirectoryDigest(dependency.path)
2543
+ : dependency.kind === "optional-file"
2544
+ ? configOptionalFileDigest(dependency.path)
2545
+ : createHash("sha256")
2546
+ .update(fs.readFileSync(dependency.path))
2547
+ .digest("hex");
2548
+ return digest === dependency.digest;
2549
+ } catch {
2550
+ return false;
2551
+ }
2552
+ });
2553
+ }
2554
+
2555
+ function configDirectoryDigest(location: string): string {
2556
+ const entries: Buffer[] = [];
2557
+ if (process.platform === "win32") {
2558
+ for (const entry of fs.readdirSync(location, { withFileTypes: true })) {
2559
+ let target = Buffer.alloc(0);
2560
+ if (entry.isSymbolicLink()) {
2561
+ try {
2562
+ target = Buffer.from(
2563
+ fs.readlinkSync(path.join(location, entry.name)),
2564
+ "utf8",
2565
+ );
2566
+ } catch {
2567
+ target = Buffer.from("<unreadable>");
2568
+ }
2569
+ }
2570
+ entries.push(
2571
+ configDirectoryDigestRecord(Buffer.from(entry.name), entry, target),
2572
+ );
2573
+ }
2574
+ } else {
2575
+ for (const entry of fs.readdirSync(location, {
2576
+ encoding: "buffer",
2577
+ withFileTypes: true,
2578
+ })) {
2579
+ let target = Buffer.alloc(0);
2580
+ if (entry.isSymbolicLink()) {
2581
+ try {
2582
+ target = fs.readlinkSync(
2583
+ Buffer.concat([
2584
+ Buffer.from(location),
2585
+ Buffer.from(path.sep),
2586
+ entry.name,
2587
+ ]),
2588
+ { encoding: "buffer" },
2589
+ );
2590
+ } catch {
2591
+ target = Buffer.from("<unreadable>");
2592
+ }
2593
+ }
2594
+ entries.push(configDirectoryDigestRecord(entry.name, entry, target));
2595
+ }
2596
+ }
2597
+ entries.sort(Buffer.compare);
2598
+ const serialized = Buffer.concat(
2599
+ entries.flatMap((entry, index) =>
2600
+ index === 0 ? [entry] : [Buffer.from([0]), entry],
2601
+ ),
2602
+ );
2603
+ return createHash("sha256").update(serialized).digest("hex");
2604
+ }
2605
+
2606
+ function configDirectoryDigestRecord(
2607
+ name: Buffer,
2608
+ entry: {
2609
+ isDirectory(): boolean;
2610
+ isFile(): boolean;
2611
+ isSymbolicLink(): boolean;
2612
+ },
2613
+ target: Buffer,
2614
+ ): Buffer {
2615
+ const kind = entry.isDirectory()
2616
+ ? "directory"
2617
+ : entry.isFile()
2618
+ ? "file"
2619
+ : entry.isSymbolicLink()
2620
+ ? "symlink"
2621
+ : "other";
2622
+ return Buffer.concat([name, Buffer.from("\0" + kind + "\0"), target]);
2623
+ }
2624
+
2625
+ function configOptionalFileDigest(location: string): string {
2626
+ try {
2627
+ const entry = fs.statSync(location);
2628
+ if (entry.isFile()) {
2629
+ return createHash("sha256")
2630
+ .update(
2631
+ Buffer.concat([Buffer.from("file\0"), fs.readFileSync(location)]),
2632
+ )
2633
+ .digest("hex");
2634
+ }
2635
+ if (entry.isDirectory()) {
2636
+ return createHash("sha256")
2637
+ .update("ttsc:host-input:directory\0")
2638
+ .digest("hex");
2639
+ }
2640
+ } catch {
2641
+ // Missing and unreadable candidates share the absent state.
2642
+ }
2643
+ return createHash("sha256").update("missing\0").digest("hex");
2644
+ }
2645
+
2646
+ // ────────────────────────────────────────────────────────────────────────────
2647
+ // Shared helpers
2648
+ // ────────────────────────────────────────────────────────────────────────────
2649
+
2650
+ function findNearestNodeModules(start: string): string | undefined {
2651
+ let dir = path.resolve(start);
2652
+ while (true) {
2653
+ const candidate = path.join(dir, "node_modules");
2654
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
2655
+ return candidate;
2656
+ }
2657
+ const parent = path.dirname(dir);
2658
+ if (parent === dir) return undefined;
2659
+ dir = parent;
2660
+ }
2661
+ }
2662
+
2663
+ /**
2664
+ * The loader tsconfig's `module` for a given config file: the module kind Node
2665
+ * would give the file itself.
2666
+ *
2667
+ * An explicit `.cts`/`.cjs` or `.mts`/`.mjs` extension already decides the emit
2668
+ * format on its own, so those keep the ES-module setting and let the extension
2669
+ * win — the same precedence tsgo applies. Everything ambiguous walks up for the
2670
+ * nearest `package.json` `type`, exactly as Node does when it loads the file.
2671
+ */
2672
+ function configModuleOption(configPath: string): string {
2673
+ const extension = path.extname(configPath).toLowerCase();
2674
+ if (extension !== ".ts" && extension !== ".tsx" && extension !== ".js") {
2675
+ return "ESNext";
2676
+ }
2677
+ return nearestPackageType(configPath) === "commonjs" ? "CommonJS" : "ESNext";
2678
+ }
2679
+
2680
+ /**
2681
+ * Nearest `package.json` `"type"` at or above `configPath`, mirroring Node's
2682
+ * package-scope lookup: the walk stops at the **first** manifest it finds, and
2683
+ * a manifest that declares no `"type"` means CommonJS rather than a reason to
2684
+ * keep climbing. Reaching the filesystem root without any manifest also means
2685
+ * CommonJS.
2686
+ */
2687
+ function nearestPackageType(configPath: string): "commonjs" | "module" {
2688
+ let dir = path.dirname(path.resolve(configPath));
2689
+ for (;;) {
2690
+ // One read rather than a stat-then-read: an unreadable entry and a missing
2691
+ // one are the same answer here — keep walking — and the Go loaders resolve
2692
+ // it the same way, so the four implementations of this rule cannot drift.
2693
+ let raw: string | undefined;
2694
+ try {
2695
+ raw = fs.readFileSync(path.join(dir, "package.json"), "utf8");
2696
+ } catch {
2697
+ raw = undefined;
2698
+ }
2699
+ if (raw !== undefined) {
2700
+ try {
2701
+ const manifest: unknown = JSON.parse(raw);
2702
+ const type =
2703
+ typeof manifest === "object" && manifest !== null
2704
+ ? (manifest as { type?: unknown }).type
2705
+ : undefined;
2706
+ return type === "module" ? "module" : "commonjs";
2707
+ } catch {
2708
+ // A manifest that does not parse still bounds the package scope; Node
2709
+ // refuses to look past it, and CommonJS is the format it defaults to.
2710
+ return "commonjs";
2711
+ }
2712
+ }
2713
+ const parent = path.dirname(dir);
2714
+ if (parent === dir) {
2715
+ return "commonjs";
2716
+ }
2717
+ dir = parent;
2718
+ }
2719
+ }
2720
+
2721
+ function linkNearestNodeModules(tempDir: string, sourceDir: string): void {
2722
+ const nodeModules = findNearestNodeModules(sourceDir);
2723
+ if (!nodeModules) return;
2724
+ const link = path.join(tempDir, "node_modules");
2725
+ try {
2726
+ fs.symlinkSync(nodeModules, link, "junction");
2727
+ } catch (error) {
2728
+ const code = (error as NodeJS.ErrnoException).code;
2729
+ if (code !== "EEXIST") {
2730
+ throw new Error(
2731
+ `@ttsc/lint: failed to link node_modules from ${nodeModules}: ${
2732
+ error instanceof Error ? error.message : String(error)
2733
+ }`,
2734
+ );
2735
+ }
2736
+ }
2737
+ }
2738
+
2739
+ /**
2740
+ * Picks the parent directory for the ephemeral config-loader tree. The system
2741
+ * temp dir is the default, but when it sits on a different volume than the
2742
+ * config file (Windows: TEMP on `C:`, project on `D:`) the loader cannot work
2743
+ * from there — no single tsconfig `rootDir` spans two volumes and
2744
+ * `path.relative` cannot produce a relative import across drives (#305) — so
2745
+ * the tree is created under the config's nearest `node_modules/.cache` instead,
2746
+ * falling back to the config's own directory when no `node_modules` exists (or
2747
+ * its `.cache` cannot be created): any location on the config's volume beats
2748
+ * the system temp dir, which is guaranteed to fail. Keeps the system temp dir
2749
+ * when the volumes already match.
2750
+ */
2751
+ function loaderTempBase(configPath: string): string {
2752
+ const systemTemp = os.tmpdir();
2753
+ const systemRoot = path.parse(systemTemp).root;
2754
+ const configRoot = path.parse(configPath).root;
2755
+ // A relative config path has no root; "" must not be read as "a volume
2756
+ // other than the system temp's" — it keeps the historical default.
2757
+ if (
2758
+ configRoot === "" ||
2759
+ systemRoot.toLowerCase() === configRoot.toLowerCase()
2760
+ ) {
2761
+ return systemTemp;
2762
+ }
2763
+ const nodeModules = findNearestNodeModules(path.dirname(configPath));
2764
+ if (!nodeModules) return path.dirname(configPath);
2765
+ const base = path.join(nodeModules, ".cache");
2766
+ try {
2767
+ fs.mkdirSync(base, { recursive: true });
2768
+ // Resolve symlinks/junctions now (a linked node_modules is common):
2769
+ // Node's ESM loader realpaths the loader module at import time, and a
2770
+ // relative config specifier computed from the link-form path would
2771
+ // resolve against the wrong directory. Realpathing may also land on
2772
+ // another volume, which defeats the whole point — fall through then.
2773
+ const real = fs.realpathSync(base);
2774
+ if (path.parse(real).root.toLowerCase() === configRoot.toLowerCase()) {
2775
+ return real;
2776
+ }
2777
+ } catch {
2778
+ // fall through to the config's own directory
2779
+ }
2780
+ return path.dirname(configPath);
2781
+ }
2782
+
2783
+ function nodeConfigLoaderEnv(configPath: string): NodeJS.ProcessEnv {
2784
+ const env: NodeJS.ProcessEnv = { ...process.env };
2785
+ // This child reports the config's actual dependency graph through its own
2786
+ // result envelope. An inherited descriptor channel would also record this
2787
+ // evaluator's disposable bootstrap and its ambient package-scope probes.
2788
+ env.TTSC_PLUGIN_DESCRIPTOR_INPUTS_ACTIVE = "0";
2789
+ const parts: string[] = [];
2790
+ const nodeModules = findNearestNodeModules(path.dirname(configPath));
2791
+ if (nodeModules) parts.push(nodeModules);
2792
+ if (env.NODE_PATH) parts.push(env.NODE_PATH);
2793
+ if (parts.length > 0) {
2794
+ env.NODE_PATH = parts.join(path.delimiter);
2795
+ }
2796
+ return env;
2797
+ }
2798
+
2799
+ /**
2800
+ * The native TypeScript compiler the config evaluator must run.
2801
+ *
2802
+ * The evaluator builds the loader in an ephemeral directory, so the child it
2803
+ * spawns cannot discover `typescript` the way an ordinary invocation does: the
2804
+ * directory is not in the project, and `linkNearestNodeModules` is the only
2805
+ * thing that puts the project's modules within reach of it. Leaving the child
2806
+ * to re-derive the compiler from there made this work by inheritance —
2807
+ * `TTSC_TSGO_BINARY` is exported by `ttsx` to its own descendants, so a build
2808
+ * launched under `ttsx` passed a binary down and a build launched any other way
2809
+ * did not. A published consumer exports no such variable, and neither does a
2810
+ * process that deliberately sheds the launcher's runtime state, and for those
2811
+ * the evaluator failed with `ttsc: typescript is required` before it read a
2812
+ * line of the config.
2813
+ *
2814
+ * The host has already resolved a compiler for the project it is linting, so
2815
+ * the answer is asked of the project rather than of the environment. The config
2816
+ * comes first and the descriptor's own location second, the same order and for
2817
+ * the same reason as {@link resolveTtsxLauncher}. An explicit `TTSC_TSGO_BINARY`
2818
+ * still wins, so an embedder that pins a compiler keeps pinning it.
2819
+ *
2820
+ * Returning `undefined` leaves the child to resolve for itself, which is what
2821
+ * it did before: a project that cannot answer here could not answer there
2822
+ * either, and the child's own diagnostic is the one that names the missing
2823
+ * package.
2824
+ */
2825
+ function resolveConfigTsgo(
2826
+ configPath: string,
2827
+ context: TtscPluginFactoryContext<ITtscLintPluginConfig>,
2828
+ ): string | undefined {
2829
+ const explicit = process.env.TTSC_TSGO_BINARY?.trim();
2830
+ if (explicit) return explicit;
2831
+ const anchors = [
2832
+ configPath,
2833
+ path.join(context.projectRoot, "package.json"),
2834
+ context.dirname,
2835
+ ];
2836
+ for (const anchor of anchors) {
2837
+ const binary = tsgoBinaryFrom(anchor);
2838
+ if (binary !== undefined) return binary;
2839
+ }
2840
+ return undefined;
2841
+ }
2842
+
2843
+ /**
2844
+ * The platform compiler binary of the `typescript` install `anchor` can see, or
2845
+ * `undefined` when this anchor reaches neither the package nor its platform
2846
+ * dependency. Mirrors ttsc's own resolution order so both name one file.
2847
+ */
2848
+ function tsgoBinaryFrom(anchor: string): string | undefined {
2849
+ try {
2850
+ const manifest = createRequire(anchor).resolve("typescript/package.json");
2851
+ const platform = createRequire(manifest).resolve(
2852
+ `@typescript/typescript-${process.platform}-${process.arch}/package.json`,
2853
+ );
2854
+ const binary = path.join(
2855
+ path.dirname(platform),
2856
+ "lib",
2857
+ process.platform === "win32" ? "tsc.exe" : "tsc",
2858
+ );
2859
+ return fs.existsSync(binary) ? binary : undefined;
2860
+ } catch {
2861
+ // This anchor cannot see the compiler; the caller tries the next one.
2862
+ return undefined;
2863
+ }
2864
+ }
2865
+
2866
+ /**
2867
+ * Resolves the isolated config evaluator launcher from the supplied anchors.
2868
+ *
2869
+ * An explicit override wins. Otherwise package-manifest resolution locates a
2870
+ * ttsc installation the anchors can see. The bare `ttsx` command is the final
2871
+ * fallback and requires a launcher available on PATH.
2872
+ */
2873
+ function resolveTtsxLauncher(anchors: readonly string[]): string {
2874
+ const explicit = process.env.TTSC_TTSX_BINARY?.trim();
2875
+ if (explicit) return explicit;
2876
+ for (const anchor of anchors) {
2877
+ const launcher = ttsxLauncherFrom(anchor);
2878
+ if (launcher !== undefined) return launcher;
2879
+ }
2880
+ return "ttsx";
2881
+ }
2882
+
2883
+ function ttsxLauncherFrom(anchor: string): string | undefined {
2884
+ try {
2885
+ // Only the manifest is exported, so the launcher is derived from where the
2886
+ // manifest resolved rather than requested as a subpath. Resolution is
2887
+ // anchored on the config being evaluated, which is how every other
2888
+ // resolution in this descriptor is anchored and picks the ttsc the project
2889
+ // actually installed.
2890
+ const manifest = createRequire(anchor).resolve("ttsc/package.json");
2891
+ const launcher = path.join(
2892
+ path.dirname(manifest),
2893
+ "lib",
2894
+ "launcher",
2895
+ "ttsx.js",
2896
+ );
2897
+ if (fs.existsSync(launcher)) return launcher;
2898
+ } catch {
2899
+ // This anchor cannot see ttsc; the caller tries the next one.
2900
+ }
2901
+ return undefined;
2902
+ }
2903
+
2904
+ /**
2905
+ * Select the Node interpreter required by the isolated checked evaluator.
2906
+ *
2907
+ * A descriptor can run under Bun, while a JavaScript ttsx launcher requires
2908
+ * Node's synchronous module hooks. Probe candidates in the evaluator's actual
2909
+ * environment and directory; a host executable or a command name alone does not
2910
+ * prove that capability. Native launcher overrides retain their own entry.
2911
+ * Candidate observations are invocation-local, without stale runtime caching.
2912
+ */
2913
+ function ttsxThroughNodeIfNeeded(
2914
+ binary: string,
2915
+ env: NodeJS.ProcessEnv,
2916
+ cwd: string,
2917
+ ): {
2918
+ binary: string;
2919
+ prefix: string[];
2920
+ } {
2921
+ const ext = path.extname(binary).toLowerCase();
2922
+ if (![".js", ".cjs", ".mjs", ".ts", ".cts", ".mts"].includes(ext)) {
2923
+ return { binary, prefix: [] };
2924
+ }
2925
+ const explicit =
2926
+ process.platform === "win32"
2927
+ ? Object.entries(env).find(
2928
+ ([key]) => key.toUpperCase() === "TTSC_NODE_BINARY",
2929
+ )?.[1]
2930
+ : env.TTSC_NODE_BINARY;
2931
+ const seen = new Set<string>();
2932
+ const args = [
2933
+ "-e",
2934
+ 'process.stdout.write(JSON.stringify({bun:typeof globalThis.Bun === "object",registerHooks:typeof require("node:module").registerHooks === "function",executable:process.execPath}))',
2935
+ ];
2936
+ for (const candidate of [explicit, process.execPath, "node"]) {
2937
+ if (!candidate?.trim() || seen.has(candidate)) continue;
2938
+ seen.add(candidate);
2939
+ const observation = beginLintTrace();
2940
+ const lower = observation ? new Date().toISOString() : undefined;
2941
+ observation?.record("process-attempt", {
2942
+ pid: 0,
2943
+ argv: [candidate, ...args],
2944
+ cwd,
2945
+ cwdInherited: false,
2946
+ startLowerBound: lower,
2947
+ owner: "lint-config-node-runtime-probe",
2948
+ });
2949
+ const result = spawnSync(candidate, args, {
2950
+ cwd,
2951
+ env,
2952
+ encoding: "utf8",
2953
+ timeout: 30_000,
2954
+ maxBuffer: 64 * 1024,
2955
+ windowsHide: true,
2956
+ });
2957
+ observation?.record("process-result", {
2958
+ pid: result.pid > 0 ? result.pid : 0,
2959
+ started: result.pid > 0,
2960
+ exitObserved: result.status !== null || result.signal !== null,
2961
+ status: result.status,
2962
+ signal: result.signal,
2963
+ error: result.error?.message,
2964
+ argv: [candidate, ...args],
2965
+ cwd,
2966
+ cwdInherited: false,
2967
+ startLowerBound: lower,
2968
+ startUpperBound: new Date().toISOString(),
2969
+ owner: "lint-config-node-runtime-probe",
2970
+ method: "spawnSync",
2971
+ });
2972
+ if (result.status !== 0) continue;
2973
+ try {
2974
+ const actual = JSON.parse(result.stdout) as {
2975
+ bun?: unknown;
2976
+ registerHooks?: unknown;
2977
+ executable?: unknown;
2978
+ };
2979
+ if (
2980
+ actual.bun === false &&
2981
+ actual.registerHooks === true &&
2982
+ typeof actual.executable === "string" &&
2983
+ path.isAbsolute(actual.executable)
2984
+ ) {
2985
+ return { binary: actual.executable, prefix: [binary] };
2986
+ }
2987
+ } catch {
2988
+ // An incompatible candidate did not report the required Node capability.
2989
+ }
2990
+ }
2991
+ throw new Error(
2992
+ "@ttsc/lint: isolated config evaluation requires Node.js with module.registerHooks; no compatible interpreter was found",
2993
+ );
2994
+ }
2995
+
2996
+ /**
2997
+ * Remove an evaluation temp directory without letting cleanup replace a result.
2998
+ *
2999
+ * This runs from a `finally`, so a throw here would surface instead of the
3000
+ * evaluation's own outcome — and on Windows a grandchild that inherited a
3001
+ * handle, or a scanner holding the file, can make removal fail. Leaving bytes
3002
+ * in the system temp directory is by far the lesser outcome.
3003
+ */
3004
+ function removeEvaluationTempDir(directory: string): void {
3005
+ try {
3006
+ fs.rmSync(directory, { force: true, recursive: true });
3007
+ } catch {
3008
+ // Best effort.
3009
+ }
3010
+ }