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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # i18n-checker
2
+
3
+ Premium i18n quality tooling for modern projects. Detect missing keys, unused translations,
4
+ placeholder mismatches, and generate a premium HTML report your team will actually want to open.
5
+
6
+ ## Why i18n-checker
7
+
8
+ Most translation checks are brittle or noisy. This tool focuses on **real issues**, **clean output**,
9
+ and **useful reports** that can be used in CI and shared with teams.
10
+
11
+ What you get:
12
+ - Missing, extra, unused keys
13
+ - Empty/null values, same-as-key values
14
+ - Placeholder mismatches and structural inconsistencies
15
+ - Dynamic key warnings
16
+ - Quality score with breakdowns
17
+ - Premium standalone HTML audit report
18
+ - Auto-fix and sync modes for safe remediation
19
+
20
+ ## Quickstart
21
+
22
+ ### Run with npx
23
+
24
+ ```bash
25
+ npx -y i18n-checker check
26
+ ```
27
+
28
+ ### Install
29
+
30
+ ```bash
31
+ npm install -D i18n-checker
32
+ ```
33
+
34
+ ### Setup wizard (recommended)
35
+
36
+ ```bash
37
+ npx -y i18n-checker init
38
+ ```
39
+
40
+ The wizard auto-detects your project structure, asks the right questions, and generates
41
+ `i18n-checker.config.js`.
42
+
43
+ ## CLI Commands
44
+
45
+ ### `check`
46
+
47
+ Analyze and print issues.
48
+
49
+ ```bash
50
+ i18n-checker check --format json --fail-on-error
51
+ ```
52
+
53
+ ### `report`
54
+
55
+ Generate a premium HTML report.
56
+
57
+ ```bash
58
+ i18n-checker report --output i18n-report.html --open
59
+ ```
60
+
61
+ ### `score`
62
+
63
+ Compute and print the quality score.
64
+
65
+ ```bash
66
+ i18n-checker score
67
+ ```
68
+
69
+ ### `fix`
70
+
71
+ Apply safe fixes (add missing keys, optionally remove unused).
72
+
73
+ ```bash
74
+ i18n-checker fix --source-lang en --strategy todo --sort
75
+ ```
76
+
77
+ ### `sync`
78
+
79
+ Synchronize all locales from the source language.
80
+
81
+ ```bash
82
+ i18n-checker sync --source-lang en --strategy source
83
+ ```
84
+
85
+ ## Common Options (all commands)
86
+
87
+ - `--config <path>`: Path to config file
88
+ - `--src <path>`: Source directory or glob (repeatable)
89
+ - `--locales <path>`: Locales root directory
90
+ - `--source-lang <code>`: Reference language
91
+ - `--ignore <pattern>`: Ignore glob (repeatable)
92
+ - `--verbose`: Verbose output
93
+
94
+ ### Check-specific options
95
+
96
+ - `--format <pretty|json>`
97
+ - `--fail-on-error`
98
+ - `--framework <auto|i18next|next-intl|react-intl|angular>`
99
+ - `--include-dynamic-warnings`
100
+
101
+ ### Report-specific options
102
+
103
+ - `--output <path>`
104
+ - `--open`
105
+
106
+ ### Fix/Sync options
107
+
108
+ - `--strategy <empty|source|todo>`
109
+ - `--dry-run`
110
+ - `--sort`
111
+ - `--remove-unused` (fix only)
112
+
113
+ ## Configuration
114
+
115
+ Config file: `i18n-checker.config.js` (or `.json`, `.ts`)
116
+
117
+ ```js
118
+ module.exports = {
119
+ projectRoot: process.cwd(),
120
+ source: ['src'],
121
+ locales: {
122
+ dir: 'src/i18n',
123
+ extension: '.json',
124
+ fileName: 'trad',
125
+ sourceLang: 'en',
126
+ },
127
+ patterns: {
128
+ prefix: 'trad.',
129
+ functions: ['t', 'i18n.t', 'translate.instant', 'this.translate.instant'],
130
+ },
131
+ ignore: ['**/node_modules/**', '**/dist/**', '**/.git/**', '**/coverage/**'],
132
+ rules: {
133
+ detectEmpty: true,
134
+ detectNull: true,
135
+ detectSameAsKey: true,
136
+ detectUnused: true,
137
+ detectDuplicateTranslations: true,
138
+ detectPlaceholderMismatch: true,
139
+ detectStructureMismatch: true,
140
+ },
141
+ report: {
142
+ title: 'i18n Quality Report',
143
+ darkMode: true,
144
+ },
145
+ fix: {
146
+ strategy: 'todo',
147
+ placeholder: 'TODO_TRANSLATE',
148
+ sort: true,
149
+ },
150
+ };
151
+ ```
152
+
153
+ If you decide not to auto-load config during `init`, run:
154
+
155
+ ```bash
156
+ i18n-checker check --config path/to/i18n-checker.config.js
157
+ ```
158
+
159
+ ## AST Coverage
160
+
161
+ Currently supported call patterns:
162
+ - `t('key')`
163
+ - `i18n.t('key')`
164
+ - `translate.instant('key')`
165
+ - `this.translate.instant('key')`
166
+
167
+ Literal `trad.*` strings are also detected.
168
+
169
+ ## Report Output
170
+
171
+ The HTML report is a single, portable file with:
172
+ - KPI cards
173
+ - Score ring
174
+ - Severity badges
175
+ - Detailed issues table
176
+ - Recommendations
177
+
178
+ ## CI Example
179
+
180
+ ```bash
181
+ i18n-checker check --format json --fail-on-error
182
+ ```
183
+
184
+ ## Roadmap
185
+
186
+ - Framework adapters (Next.js, react-intl, angular templates)
187
+ - Pluralization consistency
188
+ - Richer dynamic key inference
189
+ - Report theming and branding
190
+
191
+ ## License
192
+
193
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/cli.js');