@ttsc/lint 0.19.3 → 0.20.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 (63) hide show
  1. package/README.md +1 -1
  2. package/lib/index.js +26 -4
  3. package/lib/index.js.map +1 -1
  4. package/lib/structures/format/ITtscLintFormat.d.ts +14 -10
  5. package/lib/structures/rules/ITtscLintRegexpRules.d.ts +24 -9
  6. package/lib/structures/rules/ITtscLintSecurityRules.d.ts +18 -0
  7. package/lib/structures/rules/ITtscLintSolidRules.d.ts +22 -2
  8. package/lib/structures/rules/ITtscLintStorybookRules.d.ts +21 -0
  9. package/lib/structures/rules/ITtscLintTypeScriptRuleOptions.d.ts +10 -1
  10. package/lib/structures/rules/ITtscLintTypeScriptRules.d.ts +13 -2
  11. package/linthost/compile.go +9 -4
  12. package/linthost/config.go +18 -14
  13. package/linthost/contrib_adapter.go +57 -0
  14. package/linthost/dispatch.go +5 -1
  15. package/linthost/display_width.go +179 -41
  16. package/linthost/engine.go +120 -4
  17. package/linthost/flags_gen.go +4 -4
  18. package/linthost/hints.go +207 -0
  19. package/linthost/host.go +68 -0
  20. package/linthost/lsp.go +148 -29
  21. package/linthost/print_dispatch.go +24 -0
  22. package/linthost/print_nodes_array.go +88 -15
  23. package/linthost/print_nodes_call.go +38 -31
  24. package/linthost/print_nodes_control_flow.go +319 -0
  25. package/linthost/print_nodes_function.go +140 -13
  26. package/linthost/print_nodes_list.go +22 -10
  27. package/linthost/project_engine.go +18 -1
  28. package/linthost/project_rules.go +47 -0
  29. package/linthost/rule_docs.go +114 -0
  30. package/linthost/rules_boundaries.go +80 -2
  31. package/linthost/rules_format_bracket_spacing.go +18 -6
  32. package/linthost/rules_format_clause_join.go +11 -8
  33. package/linthost/rules_format_indent.go +155 -4
  34. package/linthost/rules_format_print_width.go +12 -35
  35. package/linthost/rules_format_quote_props.go +88 -27
  36. package/linthost/rules_format_statement_split.go +81 -0
  37. package/linthost/rules_format_trailing_comma.go +62 -94
  38. package/linthost/rules_gap.go +26 -17
  39. package/linthost/rules_jsdoc.go +54 -0
  40. package/linthost/rules_logic.go +30 -15
  41. package/linthost/rules_no_redeclare.go +12 -3
  42. package/linthost/rules_promise.go +37 -15
  43. package/linthost/rules_regexp.go +443 -49
  44. package/linthost/rules_security.go +243 -4
  45. package/linthost/rules_solid.go +430 -10
  46. package/linthost/rules_storybook.go +255 -10
  47. package/linthost/rules_suggestions.go +60 -39
  48. package/linthost/rules_ts.go +7 -0
  49. package/linthost/rules_ts_async.go +80 -2
  50. package/linthost/rules_ts_extra.go +21 -7
  51. package/linthost/serve.go +318 -0
  52. package/linthost/width_tables_gen.go +219 -0
  53. package/package.json +2 -2
  54. package/rule/hint.go +142 -0
  55. package/rule/rule.go +197 -1
  56. package/src/index.ts +35 -4
  57. package/src/structures/format/ITtscLintFormat.ts +14 -10
  58. package/src/structures/rules/ITtscLintRegexpRules.ts +24 -9
  59. package/src/structures/rules/ITtscLintSecurityRules.ts +18 -0
  60. package/src/structures/rules/ITtscLintSolidRules.ts +22 -2
  61. package/src/structures/rules/ITtscLintStorybookRules.ts +21 -0
  62. package/src/structures/rules/ITtscLintTypeScriptRuleOptions.ts +10 -1
  63. package/src/structures/rules/ITtscLintTypeScriptRules.ts +13 -2
@@ -66,6 +66,9 @@ export interface ITtscLintStorybookRules {
66
66
  * character, so the title collapses into a single sidebar entry instead of
67
67
  * nested folders.
68
68
  *
69
+ * Tagged `Deprecated`: the separator is superseded rather than broken, and
70
+ * the story still renders, so an editor strikes that separator through.
71
+ *
69
72
  * @reference https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/hierarchy-separator.md
70
73
  */
71
74
  "storybook/hierarchy-separator"?: TtscLintRuleSetting;
@@ -99,6 +102,11 @@ export interface ITtscLintStorybookRules {
99
102
  * The explicit value adds boilerplate and drifts from the export when one
100
103
  * side is renamed without the other.
101
104
  *
105
+ * Tagged `Unnecessary`: both reported shapes — the `name` / `storyName`
106
+ * property and a standalone `Story.storyName = ...` assignment — span the
107
+ * complete removable annotation, including its trailing comma or semicolon,
108
+ * so an editor greys out a range whose deletion leaves valid syntax.
109
+ *
102
110
  * @reference https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-redundant-story-name.md
103
111
  */
104
112
  "storybook/no-redundant-story-name"?: TtscLintRuleSetting;
@@ -107,6 +115,11 @@ export interface ITtscLintStorybookRules {
107
115
  * Reject direct imports from Storybook renderer packages (`@storybook/react`,
108
116
  * etc.); use the user-facing package surface.
109
117
  *
118
+ * The diagnostic names the framework packages that replace the renderer, and
119
+ * offers each as an editor suggestion that rewrites the module specifier.
120
+ * None is applied automatically: which one is right depends on the project's
121
+ * bundler, which the import does not state.
122
+ *
110
123
  * @reference https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-renderer-packages.md
111
124
  */
112
125
  "storybook/no-renderer-packages"?: TtscLintRuleSetting;
@@ -117,6 +130,10 @@ export interface ITtscLintStorybookRules {
117
130
  * Storybook 7 removed it in favour of CSF default-export metadata; remaining
118
131
  * uses block the migration to CSF3 and the modern indexer.
119
132
  *
133
+ * Tagged `Deprecated`: an editor strikes the import specifier through, since
134
+ * the instruction is to migrate off the builder rather than to delete the
135
+ * import and leave the calls below it unresolved.
136
+ *
120
137
  * @reference https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-stories-of.md
121
138
  */
122
139
  "storybook/no-stories-of"?: TtscLintRuleSetting;
@@ -128,6 +145,10 @@ export interface ITtscLintStorybookRules {
128
145
  * CSF3 derives the title from the file path, so an explicit `title` is
129
146
  * redundant and drifts from the on-disk layout when files are moved.
130
147
  *
148
+ * Tagged `Unnecessary`: the reported range is the complete removable
149
+ * property, including a trailing comma when present, so deleting the faded
150
+ * range is the resolution and leaves valid object syntax.
151
+ *
131
152
  * @reference https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/no-title-property-in-meta.md
132
153
  */
133
154
  "storybook/no-title-property-in-meta"?: TtscLintRuleSetting;
@@ -73,7 +73,16 @@ export interface ITtscLintTypeScriptNoFloatingPromisesRuleOptions {
73
73
  allowForKnownSafeCalls?: readonly TtscLintTypeOrValueSpecifier[];
74
74
  /** Promise types whose values may be discarded safely. */
75
75
  allowForKnownSafePromises?: readonly TtscLintTypeOrValueSpecifier[];
76
- /** Also inspect catchable structural thenables. Defaults to `false`. */
76
+ /**
77
+ * Check all thenables, not just the built-in `Promise` type. Defaults to
78
+ * `false`, matching `@typescript-eslint/no-floating-promises`.
79
+ *
80
+ * The option selects what the rule examines, so turning it on reports more.
81
+ * Left off, a structural thenable is outside the rule entirely: neither a
82
+ * floating one nor a handled chain on one is reported. A configuration
83
+ * carried over from typescript-eslint therefore produces the same findings
84
+ * here.
85
+ */
77
86
  checkThenables?: boolean;
78
87
  /**
79
88
  * Ignore immediately invoked function-expression results. Defaults to
@@ -189,6 +189,11 @@ export interface ITtscLintTypeScriptRules {
189
189
  *
190
190
  * `delete` leaves a hole; use `arr.splice` to shrink the array.
191
191
  *
192
+ * Type-aware via the Checker. `delete target[key]` is spelled identically
193
+ * whether the target is an array or a `Record` / index-signature object, and
194
+ * on the latter it is the correct way to remove an entry, so only the
195
+ * target's type separates the two.
196
+ *
192
197
  * @reference https://typescript-eslint.io/rules/no-array-delete
193
198
  */
194
199
  "typescript/no-array-delete"?: TtscLintRuleSetting;
@@ -1055,12 +1060,18 @@ export interface ITtscLintTypeScriptRules {
1055
1060
  "typescript/require-array-sort-compare"?: TtscLintRuleSetting;
1056
1061
 
1057
1062
  /**
1058
- * Reject `async` functions whose body contains no `await` expression.
1063
+ * Reject `async` functions that have no `await` expression and return no
1064
+ * promise.
1059
1065
  *
1060
1066
  * An async function with no `await` only inflates the return type to
1061
1067
  * `Promise<T>` without doing any asynchronous work; collapse it to a sync
1062
1068
  * function. Async generators are accepted as long as they have at least one
1063
- * `yield`.
1069
+ * `yield`, and a `for await` loop counts as an await.
1070
+ *
1071
+ * Type-aware via the Checker, which upstream uses for the same purpose: a
1072
+ * function that returns a promise is accepted without an `await`, because
1073
+ * marking it `async` states the contract for callers and forwards the inner
1074
+ * promise rather than leaving a refactor artifact behind.
1064
1075
  *
1065
1076
  * @reference https://typescript-eslint.io/rules/require-await
1066
1077
  */