@alexgorbatchev/typescript-ai-policy 1.0.1 → 1.0.3

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 (26) hide show
  1. package/README.md +39 -37
  2. package/package.json +1 -1
  3. package/src/oxlint/createOxlintConfig.ts +2 -1
  4. package/src/oxlint/plugin.ts +2 -0
  5. package/src/oxlint/rules/component-file-naming-convention.ts +6 -2
  6. package/src/oxlint/rules/component-story-file-convention.ts +5 -3
  7. package/src/oxlint/rules/helpers.ts +10 -0
  8. package/src/oxlint/rules/hook-test-file-convention.ts +11 -4
  9. package/src/oxlint/rules/no-i-prefixed-type-aliases.ts +45 -0
  10. package/src/oxlint/rules/require-template-indent.ts +46 -9
  11. package/src/oxlint/rules/story-file-location-convention.ts +19 -8
  12. package/src/oxlint/rules/testid-naming-convention.ts +1 -1
  13. package/src/semantic-fixes/applyFileChanges.ts +6 -6
  14. package/src/semantic-fixes/applySemanticFixes.ts +29 -26
  15. package/src/semantic-fixes/applyTextEdits.ts +20 -20
  16. package/src/semantic-fixes/backends/tsgo-lsp/TsgoLspClient.ts +49 -49
  17. package/src/semantic-fixes/backends/tsgo-lsp/createTsgoLspSemanticFixBackend.ts +41 -41
  18. package/src/semantic-fixes/providers/createInterfaceNamingConventionSemanticFixProvider.ts +15 -89
  19. package/src/semantic-fixes/providers/createNoIPrefixedTypeAliasesSemanticFixProvider.ts +49 -0
  20. package/src/semantic-fixes/providers/createTestFileLocationConventionSemanticFixProvider.ts +9 -19
  21. package/src/semantic-fixes/providers/helpers.ts +117 -0
  22. package/src/semantic-fixes/readMovedFileTextEdits.ts +7 -7
  23. package/src/semantic-fixes/readSemanticFixRuntimePaths.ts +2 -2
  24. package/src/semantic-fixes/runApplySemanticFixes.ts +5 -5
  25. package/src/semantic-fixes/runOxlintJson.ts +9 -9
  26. package/src/semantic-fixes/types.ts +35 -41
@@ -1,50 +1,50 @@
1
- export type IOxlintSpan = {
1
+ export type OxlintSpan = {
2
2
  column: number;
3
3
  length: number;
4
4
  line: number;
5
5
  offset: number;
6
6
  };
7
7
 
8
- export type IOxlintLabel = {
8
+ export type OxlintLabel = {
9
9
  label?: string;
10
- span: IOxlintSpan;
10
+ span: OxlintSpan;
11
11
  };
12
12
 
13
- export type IOxlintDiagnostic = {
13
+ export type OxlintDiagnostic = {
14
14
  code: string;
15
15
  filename: string;
16
- labels: readonly IOxlintLabel[];
16
+ labels: readonly OxlintLabel[];
17
17
  message: string;
18
18
  severity: string;
19
19
  };
20
20
 
21
- export type IOxlintJsonReport = {
22
- diagnostics: readonly IOxlintDiagnostic[];
21
+ export type OxlintJsonReport = {
22
+ diagnostics: readonly OxlintDiagnostic[];
23
23
  };
24
24
 
25
- export type ILineAndCharacter = {
25
+ export type LineAndCharacter = {
26
26
  character: number;
27
27
  line: number;
28
28
  };
29
29
 
30
- export type ITextEdit = {
31
- end: ILineAndCharacter;
30
+ export type TextEdit = {
31
+ end: LineAndCharacter;
32
32
  filePath: string;
33
33
  newText: string;
34
- start: ILineAndCharacter;
34
+ start: LineAndCharacter;
35
35
  };
36
36
 
37
- export type ISymbolRenameOperation = {
37
+ export type SymbolRenameOperation = {
38
38
  filePath: string;
39
39
  id: string;
40
40
  kind: "rename-symbol";
41
41
  newName: string;
42
- position: ILineAndCharacter;
42
+ position: LineAndCharacter;
43
43
  ruleCode: string;
44
44
  symbolName: string;
45
45
  };
46
46
 
47
- export type IMoveFileOperation = {
47
+ export type MoveFileOperation = {
48
48
  filePath: string;
49
49
  id: string;
50
50
  kind: "move-file";
@@ -52,59 +52,53 @@ export type IMoveFileOperation = {
52
52
  ruleCode: string;
53
53
  };
54
54
 
55
- export type ISemanticFixOperation = ISymbolRenameOperation | IMoveFileOperation;
55
+ export type SemanticFixOperation = SymbolRenameOperation | MoveFileOperation;
56
56
 
57
- export type IFileMove = {
57
+ export type FileMove = {
58
58
  destinationFilePath: string;
59
59
  sourceFilePath: string;
60
60
  };
61
61
 
62
- export type ISemanticFixPlan = {
62
+ export type SemanticFixPlan = {
63
63
  description: string;
64
- fileMoves: readonly IFileMove[];
64
+ fileMoves: readonly FileMove[];
65
65
  operationId: string;
66
66
  ruleCode: string;
67
- textEdits: readonly ITextEdit[];
67
+ textEdits: readonly TextEdit[];
68
68
  };
69
69
 
70
- export type ISemanticFixPlanSuccess = {
70
+ export type SemanticFixPlanSuccess = {
71
71
  kind: "plan";
72
- plan: ISemanticFixPlan;
72
+ plan: SemanticFixPlan;
73
73
  };
74
74
 
75
- export type ISemanticFixPlanSkip = {
75
+ export type SemanticFixPlanSkip = {
76
76
  kind: "skip";
77
77
  reason: string;
78
78
  };
79
79
 
80
- export type ISemanticFixPlanResult = ISemanticFixPlanSkip | ISemanticFixPlanSuccess;
80
+ export type SemanticFixPlanResult = SemanticFixPlanSkip | SemanticFixPlanSuccess;
81
81
 
82
- export type ISemanticFixProviderContext = {
82
+ export type SemanticFixProviderContext = {
83
83
  targetDirectoryPath: string;
84
84
  };
85
85
 
86
- export type ISemanticFixProvider = {
87
- createOperation: (
88
- diagnostic: IOxlintDiagnostic,
89
- context: ISemanticFixProviderContext,
90
- ) => ISemanticFixOperation | null;
86
+ export type SemanticFixProvider = {
87
+ createOperation: (diagnostic: OxlintDiagnostic, context: SemanticFixProviderContext) => SemanticFixOperation | null;
91
88
  ruleCode: string;
92
89
  };
93
90
 
94
- export type ISemanticFixBackendContext = {
91
+ export type SemanticFixBackendContext = {
95
92
  targetDirectoryPath: string;
96
93
  };
97
94
 
98
- export type ISemanticFixBackend = {
99
- createPlan: (
100
- operation: ISemanticFixOperation,
101
- context: ISemanticFixBackendContext,
102
- ) => Promise<ISemanticFixPlanResult>;
95
+ export type SemanticFixBackend = {
96
+ createPlan: (operation: SemanticFixOperation, context: SemanticFixBackendContext) => Promise<SemanticFixPlanResult>;
103
97
  dispose: () => Promise<void>;
104
98
  name: string;
105
99
  };
106
100
 
107
- export type IApplySemanticFixesProgressEvent =
101
+ export type ApplySemanticFixesProgressEvent =
108
102
  | {
109
103
  kind: "running-oxlint";
110
104
  targetDirectoryPath: string;
@@ -139,25 +133,25 @@ export type IApplySemanticFixesProgressEvent =
139
133
  skippedDiagnosticCount: number;
140
134
  };
141
135
 
142
- export type IApplySemanticFixesOptions = {
136
+ export type ApplySemanticFixesOptions = {
143
137
  dryRun?: boolean;
144
- onProgress?: (event: IApplySemanticFixesProgressEvent) => void;
138
+ onProgress?: (event: ApplySemanticFixesProgressEvent) => void;
145
139
  oxlintConfigPath: string;
146
140
  oxlintExecutablePath: string;
147
141
  targetDirectoryPath: string;
148
142
  tsgoExecutablePath: string;
149
143
  };
150
144
 
151
- export type ISkippedDiagnostic = {
145
+ export type SkippedDiagnostic = {
152
146
  filePath: string;
153
147
  reason: string;
154
148
  ruleCode: string;
155
149
  };
156
150
 
157
- export type IApplySemanticFixesResult = {
151
+ export type ApplySemanticFixesResult = {
158
152
  appliedFileCount: number;
159
153
  backendName: string;
160
154
  changedFilePaths: readonly string[];
161
155
  plannedFixCount: number;
162
- skippedDiagnostics: readonly ISkippedDiagnostic[];
156
+ skippedDiagnostics: readonly SkippedDiagnostic[];
163
157
  };