translint 0.2.0

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.
@@ -0,0 +1,129 @@
1
+ type PlaceholderStyle = 'auto' | 'mustache' | 'percent' | 'brace';
2
+ type FixStrategy = 'empty' | 'source' | 'todo';
3
+ interface CheckerConfig {
4
+ projectRoot: string;
5
+ source: string[];
6
+ locales: {
7
+ dir: string;
8
+ extension: string;
9
+ fileName: string;
10
+ sourceLang: string;
11
+ };
12
+ patterns: {
13
+ prefix?: string;
14
+ functions: string[];
15
+ };
16
+ ignore: string[];
17
+ rules: {
18
+ detectEmpty: boolean;
19
+ detectNull: boolean;
20
+ detectSameAsKey: boolean;
21
+ detectUnused: boolean;
22
+ detectDuplicateTranslations: boolean;
23
+ detectPlaceholderMismatch: boolean;
24
+ detectStructureMismatch: boolean;
25
+ };
26
+ report: {
27
+ title: string;
28
+ darkMode: boolean;
29
+ };
30
+ fix: {
31
+ strategy: FixStrategy;
32
+ placeholder: string;
33
+ sort: boolean;
34
+ };
35
+ }
36
+ interface CliOptions {
37
+ configPath?: string;
38
+ source?: string[];
39
+ localesDir?: string;
40
+ sourceLang?: string;
41
+ format?: string;
42
+ failOnError?: boolean;
43
+ verbose?: boolean;
44
+ ignore?: string[];
45
+ framework?: string;
46
+ includeDynamicWarnings?: boolean;
47
+ showOnlyScore?: boolean;
48
+ score?: ScoreResult;
49
+ }
50
+ interface TranslationFile {
51
+ locale: string;
52
+ path: string;
53
+ content: Record<string, unknown>;
54
+ flat: Map<string, unknown>;
55
+ }
56
+ interface CodeUsage {
57
+ key: string;
58
+ file: string;
59
+ line: number;
60
+ column: number;
61
+ dynamic: boolean;
62
+ pattern?: string;
63
+ }
64
+ interface PlaceholderMismatch {
65
+ key: string;
66
+ locale: string;
67
+ placeholders: string[];
68
+ expected: string[];
69
+ }
70
+ interface Issue {
71
+ type: 'missing' | 'extra' | 'unused' | 'empty' | 'null' | 'same-as-key' | 'placeholder' | 'duplicate-value' | 'structure' | 'dynamic';
72
+ severity: 'low' | 'medium' | 'high';
73
+ key?: string;
74
+ locale?: string;
75
+ message: string;
76
+ file?: string;
77
+ }
78
+ interface Summary {
79
+ locales: string[];
80
+ totalKeys: number;
81
+ totalUsages: number;
82
+ totalIssues: number;
83
+ missingKeys: number;
84
+ extraKeys: number;
85
+ unusedKeys: number;
86
+ emptyValues: number;
87
+ nullValues: number;
88
+ sameAsKey: number;
89
+ placeholderIssues: number;
90
+ duplicateValueIssues: number;
91
+ structureIssues: number;
92
+ dynamicWarnings: number;
93
+ }
94
+ interface AnalysisResult {
95
+ config: CheckerConfig;
96
+ translationFiles: TranslationFile[];
97
+ codeUsages: CodeUsage[];
98
+ issues: Issue[];
99
+ summary: Summary;
100
+ namespaces: Record<string, number>;
101
+ score?: ScoreResult;
102
+ }
103
+ interface ScoreResult {
104
+ total: number;
105
+ level: 'excellent' | 'good' | 'average' | 'critical';
106
+ breakdown: {
107
+ completeness: number;
108
+ consistency: number;
109
+ usage: number;
110
+ quality: number;
111
+ };
112
+ notes: string[];
113
+ }
114
+ interface FixResult {
115
+ summary: string;
116
+ changedFiles: string[];
117
+ }
118
+
119
+ interface AnalyzeParams {
120
+ config: CheckerConfig;
121
+ cliOptions?: CliOptions;
122
+ }
123
+ declare function analyzeProject(params: AnalyzeParams): Promise<AnalysisResult>;
124
+
125
+ declare function loadConfig(configPath?: string): Promise<CheckerConfig>;
126
+
127
+ declare function computeScore(analysis: AnalysisResult): ScoreResult;
128
+
129
+ export { type AnalysisResult, type CheckerConfig, type CliOptions, type CodeUsage, type FixResult, type FixStrategy, type Issue, type PlaceholderMismatch, type PlaceholderStyle, type ScoreResult, type Summary, type TranslationFile, analyzeProject, computeScore, loadConfig };