translint 0.2.0 → 0.2.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.
- package/README.md +19 -14
- package/dist/cli.js +12 -12
- package/dist/index.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Translint
|
|
2
|
+
|
|
3
|
+
**The ESLint of translations.**
|
|
2
4
|
|
|
3
5
|
Premium i18n quality tooling for modern projects. Detect missing keys, unused translations,
|
|
4
6
|
placeholder mismatches, and generate a premium HTML report your team will actually want to open.
|
|
5
7
|
|
|
6
|
-
## Why
|
|
8
|
+
## Why Translint
|
|
9
|
+
|
|
10
|
+
Translation quality should be as enforceable as code quality. This tool brings a lint-like
|
|
11
|
+
workflow to i18n, with clear feedback, CI-friendly output, and a premium report you can share.
|
|
7
12
|
|
|
8
13
|
Most translation checks are brittle or noisy. This tool focuses on **real issues**, **clean output**,
|
|
9
14
|
and **useful reports** that can be used in CI and shared with teams.
|
|
@@ -22,23 +27,23 @@ What you get:
|
|
|
22
27
|
### Run with npx
|
|
23
28
|
|
|
24
29
|
```bash
|
|
25
|
-
npx -y
|
|
30
|
+
npx -y translint check
|
|
26
31
|
```
|
|
27
32
|
|
|
28
33
|
### Install
|
|
29
34
|
|
|
30
35
|
```bash
|
|
31
|
-
npm install -D
|
|
36
|
+
npm install -D translint
|
|
32
37
|
```
|
|
33
38
|
|
|
34
39
|
### Setup wizard (recommended)
|
|
35
40
|
|
|
36
41
|
```bash
|
|
37
|
-
npx -y
|
|
42
|
+
npx -y translint init
|
|
38
43
|
```
|
|
39
44
|
|
|
40
45
|
The wizard auto-detects your project structure, asks the right questions, and generates
|
|
41
|
-
`
|
|
46
|
+
`translint.config.js`.
|
|
42
47
|
|
|
43
48
|
## CLI Commands
|
|
44
49
|
|
|
@@ -47,7 +52,7 @@ The wizard auto-detects your project structure, asks the right questions, and ge
|
|
|
47
52
|
Analyze and print issues.
|
|
48
53
|
|
|
49
54
|
```bash
|
|
50
|
-
|
|
55
|
+
translint check --format json --fail-on-error
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
### `report`
|
|
@@ -55,7 +60,7 @@ i18n-checker check --format json --fail-on-error
|
|
|
55
60
|
Generate a premium HTML report.
|
|
56
61
|
|
|
57
62
|
```bash
|
|
58
|
-
|
|
63
|
+
translint report --output i18n-report.html --open
|
|
59
64
|
```
|
|
60
65
|
|
|
61
66
|
### `score`
|
|
@@ -63,7 +68,7 @@ i18n-checker report --output i18n-report.html --open
|
|
|
63
68
|
Compute and print the quality score.
|
|
64
69
|
|
|
65
70
|
```bash
|
|
66
|
-
|
|
71
|
+
translint score
|
|
67
72
|
```
|
|
68
73
|
|
|
69
74
|
### `fix`
|
|
@@ -71,7 +76,7 @@ i18n-checker score
|
|
|
71
76
|
Apply safe fixes (add missing keys, optionally remove unused).
|
|
72
77
|
|
|
73
78
|
```bash
|
|
74
|
-
|
|
79
|
+
translint fix --source-lang en --strategy todo --sort
|
|
75
80
|
```
|
|
76
81
|
|
|
77
82
|
### `sync`
|
|
@@ -79,7 +84,7 @@ i18n-checker fix --source-lang en --strategy todo --sort
|
|
|
79
84
|
Synchronize all locales from the source language.
|
|
80
85
|
|
|
81
86
|
```bash
|
|
82
|
-
|
|
87
|
+
translint sync --source-lang en --strategy source
|
|
83
88
|
```
|
|
84
89
|
|
|
85
90
|
## Common Options (all commands)
|
|
@@ -112,7 +117,7 @@ i18n-checker sync --source-lang en --strategy source
|
|
|
112
117
|
|
|
113
118
|
## Configuration
|
|
114
119
|
|
|
115
|
-
Config file: `
|
|
120
|
+
Config file: `translint.config.js` (or `.json`, `.ts`)
|
|
116
121
|
|
|
117
122
|
```js
|
|
118
123
|
module.exports = {
|
|
@@ -153,7 +158,7 @@ module.exports = {
|
|
|
153
158
|
If you decide not to auto-load config during `init`, run:
|
|
154
159
|
|
|
155
160
|
```bash
|
|
156
|
-
|
|
161
|
+
translint check --config path/to/translint.config.js
|
|
157
162
|
```
|
|
158
163
|
|
|
159
164
|
## AST Coverage
|
|
@@ -178,7 +183,7 @@ The HTML report is a single, portable file with:
|
|
|
178
183
|
## CI Example
|
|
179
184
|
|
|
180
185
|
```bash
|
|
181
|
-
|
|
186
|
+
translint check --format json --fail-on-error
|
|
182
187
|
```
|
|
183
188
|
|
|
184
189
|
## Roadmap
|
package/dist/cli.js
CHANGED
|
@@ -124,11 +124,11 @@ function isObject(value) {
|
|
|
124
124
|
|
|
125
125
|
// src/config/loadConfig.ts
|
|
126
126
|
var CONFIG_FILES = [
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
127
|
+
"translint.config.js",
|
|
128
|
+
"translint.config.cjs",
|
|
129
|
+
"translint.config.mjs",
|
|
130
|
+
"translint.config.json",
|
|
131
|
+
"translint.config.ts"
|
|
132
132
|
];
|
|
133
133
|
async function loadConfig(configPath) {
|
|
134
134
|
if (configPath) {
|
|
@@ -687,7 +687,7 @@ function formatConsoleReport(analysis, options = {}) {
|
|
|
687
687
|
const { summary } = analysis;
|
|
688
688
|
lines.push(
|
|
689
689
|
import_chalk.default.bold(
|
|
690
|
-
summary.totalIssues > 0 ? import_chalk.default.redBright("
|
|
690
|
+
summary.totalIssues > 0 ? import_chalk.default.redBright("translint found issues") : import_chalk.default.greenBright("translint clean")
|
|
691
691
|
)
|
|
692
692
|
);
|
|
693
693
|
lines.push(
|
|
@@ -1581,7 +1581,7 @@ function generateHtmlReport(analysis) {
|
|
|
1581
1581
|
</main>
|
|
1582
1582
|
|
|
1583
1583
|
<footer class="footer">
|
|
1584
|
-
Generated by <a href="#">
|
|
1584
|
+
Generated by <a href="#">Translint</a> \u2022 ${analysis.summary.totalIssues} issue(s) detected across ${summary.locales.length} locale(s)
|
|
1585
1585
|
</footer>
|
|
1586
1586
|
|
|
1587
1587
|
<script>
|
|
@@ -1838,12 +1838,12 @@ async function promptConfirm(rl, question, defaultValue = true) {
|
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
1840
|
// src/cli.ts
|
|
1841
|
-
var cli = (0, import_cac.cac)("
|
|
1841
|
+
var cli = (0, import_cac.cac)("translint");
|
|
1842
1842
|
function withCommonOptions(command) {
|
|
1843
1843
|
return command.option("--config <path>", "Path to config file").option("--src <path>", "Source directory or glob (repeatable)", { default: [] }).option("--locales <path>", "Locales root directory", { default: "" }).option("--source-lang <code>", "Reference language").option("--ignore <pattern>", "Ignore glob (repeatable)", { default: [] }).option("--verbose", "Verbose output");
|
|
1844
1844
|
}
|
|
1845
1845
|
function handleError(error) {
|
|
1846
|
-
console.error(import_chalk2.default.redBright("
|
|
1846
|
+
console.error(import_chalk2.default.redBright("translint failed"));
|
|
1847
1847
|
console.error(error instanceof Error ? error.message : String(error));
|
|
1848
1848
|
process.exitCode = 1;
|
|
1849
1849
|
}
|
|
@@ -1943,14 +1943,14 @@ withCommonOptions(
|
|
|
1943
1943
|
});
|
|
1944
1944
|
cli.help();
|
|
1945
1945
|
cli.version("0.2.0");
|
|
1946
|
-
cli.command("init", "Interactive setup to generate config").option("--output <path>", "Config output file", { default: "
|
|
1946
|
+
cli.command("init", "Interactive setup to generate config").option("--output <path>", "Config output file", { default: "translint.config.js" }).action(async (options) => {
|
|
1947
1947
|
try {
|
|
1948
1948
|
const readline = await import("readline/promises");
|
|
1949
1949
|
const rl = readline.createInterface({
|
|
1950
1950
|
input: process.stdin,
|
|
1951
1951
|
output: process.stdout
|
|
1952
1952
|
});
|
|
1953
|
-
console.log(import_chalk2.default.cyan("Let\u2019s set up
|
|
1953
|
+
console.log(import_chalk2.default.cyan("Let\u2019s set up translint."));
|
|
1954
1954
|
console.log(import_chalk2.default.gray("Press Enter to accept defaults.\n"));
|
|
1955
1955
|
const detected = autoDetect(process.cwd());
|
|
1956
1956
|
const projectRoot = await promptText(rl, {
|
|
@@ -2040,7 +2040,7 @@ cli.command("init", "Interactive setup to generate config").option("--output <pa
|
|
|
2040
2040
|
if (!useDefault) {
|
|
2041
2041
|
console.log(import_chalk2.default.yellow("Config will not be auto-loaded by default."));
|
|
2042
2042
|
console.log(
|
|
2043
|
-
`Use it like this: ${import_chalk2.default.cyan(`
|
|
2043
|
+
`Use it like this: ${import_chalk2.default.cyan(`translint check --config ${outputPath}`)}`
|
|
2044
2044
|
);
|
|
2045
2045
|
} else {
|
|
2046
2046
|
console.log(import_chalk2.default.green("Config will be auto-loaded by default."));
|
package/dist/index.js
CHANGED
|
@@ -589,11 +589,11 @@ function isObject(value) {
|
|
|
589
589
|
|
|
590
590
|
// src/config/loadConfig.ts
|
|
591
591
|
var CONFIG_FILES = [
|
|
592
|
-
"
|
|
593
|
-
"
|
|
594
|
-
"
|
|
595
|
-
"
|
|
596
|
-
"
|
|
592
|
+
"translint.config.js",
|
|
593
|
+
"translint.config.cjs",
|
|
594
|
+
"translint.config.mjs",
|
|
595
|
+
"translint.config.json",
|
|
596
|
+
"translint.config.ts"
|
|
597
597
|
];
|
|
598
598
|
async function loadConfig(configPath) {
|
|
599
599
|
if (configPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "translint",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Premium i18n quality checker with CLI, scoring, and HTML report.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"@types/node": "^20.12.7",
|
|
45
45
|
"tsup": "^8.0.2"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|