@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.
- package/README.md +39 -37
- package/package.json +1 -1
- package/src/oxlint/createOxlintConfig.ts +2 -1
- package/src/oxlint/plugin.ts +2 -0
- package/src/oxlint/rules/component-file-naming-convention.ts +6 -2
- package/src/oxlint/rules/component-story-file-convention.ts +5 -3
- package/src/oxlint/rules/helpers.ts +10 -0
- package/src/oxlint/rules/hook-test-file-convention.ts +11 -4
- package/src/oxlint/rules/no-i-prefixed-type-aliases.ts +45 -0
- package/src/oxlint/rules/require-template-indent.ts +46 -9
- package/src/oxlint/rules/story-file-location-convention.ts +19 -8
- package/src/oxlint/rules/testid-naming-convention.ts +1 -1
- package/src/semantic-fixes/applyFileChanges.ts +6 -6
- package/src/semantic-fixes/applySemanticFixes.ts +29 -26
- package/src/semantic-fixes/applyTextEdits.ts +20 -20
- package/src/semantic-fixes/backends/tsgo-lsp/TsgoLspClient.ts +49 -49
- package/src/semantic-fixes/backends/tsgo-lsp/createTsgoLspSemanticFixBackend.ts +41 -41
- package/src/semantic-fixes/providers/createInterfaceNamingConventionSemanticFixProvider.ts +15 -89
- package/src/semantic-fixes/providers/createNoIPrefixedTypeAliasesSemanticFixProvider.ts +49 -0
- package/src/semantic-fixes/providers/createTestFileLocationConventionSemanticFixProvider.ts +9 -19
- package/src/semantic-fixes/providers/helpers.ts +117 -0
- package/src/semantic-fixes/readMovedFileTextEdits.ts +7 -7
- package/src/semantic-fixes/readSemanticFixRuntimePaths.ts +2 -2
- package/src/semantic-fixes/runApplySemanticFixes.ts +5 -5
- package/src/semantic-fixes/runOxlintJson.ts +9 -9
- package/src/semantic-fixes/types.ts +35 -41
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
export type
|
|
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
|
|
8
|
+
export type OxlintLabel = {
|
|
9
9
|
label?: string;
|
|
10
|
-
span:
|
|
10
|
+
span: OxlintSpan;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export type OxlintDiagnostic = {
|
|
14
14
|
code: string;
|
|
15
15
|
filename: string;
|
|
16
|
-
labels: readonly
|
|
16
|
+
labels: readonly OxlintLabel[];
|
|
17
17
|
message: string;
|
|
18
18
|
severity: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type
|
|
22
|
-
diagnostics: readonly
|
|
21
|
+
export type OxlintJsonReport = {
|
|
22
|
+
diagnostics: readonly OxlintDiagnostic[];
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export type
|
|
25
|
+
export type LineAndCharacter = {
|
|
26
26
|
character: number;
|
|
27
27
|
line: number;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export type
|
|
31
|
-
end:
|
|
30
|
+
export type TextEdit = {
|
|
31
|
+
end: LineAndCharacter;
|
|
32
32
|
filePath: string;
|
|
33
33
|
newText: string;
|
|
34
|
-
start:
|
|
34
|
+
start: LineAndCharacter;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export type
|
|
37
|
+
export type SymbolRenameOperation = {
|
|
38
38
|
filePath: string;
|
|
39
39
|
id: string;
|
|
40
40
|
kind: "rename-symbol";
|
|
41
41
|
newName: string;
|
|
42
|
-
position:
|
|
42
|
+
position: LineAndCharacter;
|
|
43
43
|
ruleCode: string;
|
|
44
44
|
symbolName: string;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export type
|
|
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
|
|
55
|
+
export type SemanticFixOperation = SymbolRenameOperation | MoveFileOperation;
|
|
56
56
|
|
|
57
|
-
export type
|
|
57
|
+
export type FileMove = {
|
|
58
58
|
destinationFilePath: string;
|
|
59
59
|
sourceFilePath: string;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export type
|
|
62
|
+
export type SemanticFixPlan = {
|
|
63
63
|
description: string;
|
|
64
|
-
fileMoves: readonly
|
|
64
|
+
fileMoves: readonly FileMove[];
|
|
65
65
|
operationId: string;
|
|
66
66
|
ruleCode: string;
|
|
67
|
-
textEdits: readonly
|
|
67
|
+
textEdits: readonly TextEdit[];
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export type
|
|
70
|
+
export type SemanticFixPlanSuccess = {
|
|
71
71
|
kind: "plan";
|
|
72
|
-
plan:
|
|
72
|
+
plan: SemanticFixPlan;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export type
|
|
75
|
+
export type SemanticFixPlanSkip = {
|
|
76
76
|
kind: "skip";
|
|
77
77
|
reason: string;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
export type
|
|
80
|
+
export type SemanticFixPlanResult = SemanticFixPlanSkip | SemanticFixPlanSuccess;
|
|
81
81
|
|
|
82
|
-
export type
|
|
82
|
+
export type SemanticFixProviderContext = {
|
|
83
83
|
targetDirectoryPath: string;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export type
|
|
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
|
|
91
|
+
export type SemanticFixBackendContext = {
|
|
95
92
|
targetDirectoryPath: string;
|
|
96
93
|
};
|
|
97
94
|
|
|
98
|
-
export type
|
|
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
|
|
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
|
|
136
|
+
export type ApplySemanticFixesOptions = {
|
|
143
137
|
dryRun?: boolean;
|
|
144
|
-
onProgress?: (event:
|
|
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
|
|
145
|
+
export type SkippedDiagnostic = {
|
|
152
146
|
filePath: string;
|
|
153
147
|
reason: string;
|
|
154
148
|
ruleCode: string;
|
|
155
149
|
};
|
|
156
150
|
|
|
157
|
-
export type
|
|
151
|
+
export type ApplySemanticFixesResult = {
|
|
158
152
|
appliedFileCount: number;
|
|
159
153
|
backendName: string;
|
|
160
154
|
changedFilePaths: readonly string[];
|
|
161
155
|
plannedFixCount: number;
|
|
162
|
-
skippedDiagnostics: readonly
|
|
156
|
+
skippedDiagnostics: readonly SkippedDiagnostic[];
|
|
163
157
|
};
|