i18n-smell-detector 0.9.1 → 0.9.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 (2) hide show
  1. package/README.md +48 -13
  2. package/package.json +7 -6
package/README.md CHANGED
@@ -5,9 +5,51 @@
5
5
  [![Socket Badge](https://badge.socket.dev/npm/package/i18n-smell-detector)](https://badge.socket.dev/npm/package/i18n-smell-detector)
6
6
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
7
7
 
8
- Find localization issues that key coverage checks miss.
8
+ ## Catch localization bugs your i18n coverage reports can't see.
9
+
10
+ `i18n-smell-detector` is an i18n linter that catches localization mistakes ordinary key-coverage checks miss:
11
+
12
+ - copied base-locale values that were never translated;
13
+ - missing, extra, or repeated placeholders;
14
+ - hardcoded user-visible text in Vue, JavaScript, TypeScript, JSX, and TSX.
15
+
16
+ <p align="center">
17
+ <img src="./assets/i18n-smell-demo.gif"
18
+ alt="i18n-smell-detector finding copied translations, placeholder mismatches, and hardcoded UI text"
19
+ width="900">
20
+ </p>
21
+
22
+ ```json
23
+ // locales/en.json
24
+ {
25
+ "checkout.pay": "Pay now",
26
+ "cart.items": "{{count}} items"
27
+ }
28
+ ```
29
+
30
+ ```json
31
+ // locales/ja.json
32
+ {
33
+ "checkout.pay": "Pay now",
34
+ "cart.items": "商品"
35
+ }
36
+ ```
37
+
38
+ ```Vue
39
+ <button>Delete account</button>
40
+ ```
9
41
 
10
- `i18n-smell-detector` checks locale files for copied base-locale values and placeholder mismatches. It can also scan Vue, JavaScript, TypeScript, JSX, and TSX source for hardcoded user-visible strings.
42
+ The project has every translation key, but it still ships three localization problems.
43
+
44
+ `i18n-smell-detector` reports them before your users do.
45
+
46
+ ## Try it
47
+
48
+ ```bash
49
+ npm install -D i18n-smell-detector
50
+ npx i18n-smell-detector init
51
+ npx i18n-smell-detector check --fail-on none
52
+ ```
11
53
 
12
54
  The classifier is deterministic and conservative. Start with `--fail-on none`, review the report, then tune allowlists before enforcing CI.
13
55
 
@@ -20,17 +62,10 @@ The classifier is deterministic and conservative. Start with `--fail-on none`, r
20
62
  - Support baselines for gradual adoption.
21
63
  - Publish TypeScript types and a small public API for integrations.
22
64
 
23
- ## Install
24
-
25
- ```bash
26
- npm install -D i18n-smell-detector
27
- ```
28
-
29
- ## Quick Start
65
+ ## Configuration
30
66
 
31
- ```bash
67
+ ``` bash
32
68
  npx i18n-smell-detector init
33
- npx i18n-smell-detector check --config i18n-smell.config.mjs --fail-on none
34
69
  ```
35
70
 
36
71
  `init` creates `i18n-smell.config.mjs`. When it finds locale JSON files in `src/locales`, `src/i18n`, `locales`, or `i18n`, it writes them into the config automatically.
@@ -54,6 +89,7 @@ Locale keys that contain `-`, such as `'zh-Hans'`, must be quoted.
54
89
 
55
90
  With `ignoreSameLanguageFamily` enabled, locale tags are compared by language, inferred script, and explicitly declared region. Different scripts are checked normally, two different explicit regions are reported at low severity, and otherwise matching language and script are ignored. The last case includes comparisons where one or both locale tags do not explicitly declare a region.
56
91
 
92
+
57
93
  ## Commands
58
94
 
59
95
  ```bash
@@ -156,9 +192,8 @@ import type { DetectorConfigInput, DetectorIssue, CheckResult } from 'i18n-smell
156
192
 
157
193
  ## Documentation
158
194
 
159
- Full documentation lives in the GitHub Wiki:
195
+ See the GitHub [Wiki](https://github.com/xue-moe/i18n-smell-detector/wiki) for:
160
196
 
161
- - [Home](https://github.com/xue-moe/i18n-smell-detector/wiki)
162
197
  - [Getting started](https://github.com/xue-moe/i18n-smell-detector/wiki/Getting-Started)
163
198
  - [Commands](https://github.com/xue-moe/i18n-smell-detector/wiki/Commands)
164
199
  - [Configuration](https://github.com/xue-moe/i18n-smell-detector/wiki/Configuration)
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "i18n-smell-detector",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Find copied locale values, placeholder mismatches, and hardcoded user-visible strings.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "i18n-smell-detector": "./bin/i18n-smell-detector.js"
7
+ "i18n-smell-detector": "bin/i18n-smell-detector.js"
8
8
  },
9
9
  "types": "./dist/index.d.ts",
10
10
  "exports": {
@@ -33,7 +33,8 @@
33
33
  "check:identical": "npm run build --silent && node ./bin/i18n-smell-detector.js check-identical --config ./examples/vue-vite/i18n-smell.config.mjs --fail-on none",
34
34
  "check:hardcoded": "npm run build --silent && node ./bin/i18n-smell-detector.js check-hardcoded --config ./examples/vue-vite/i18n-smell.config.mjs --fail-on none",
35
35
  "example:basic": "npm run build --silent && node ./bin/i18n-smell-detector.js check --config ./examples/basic/i18n-smell.config.mjs --fail-on none",
36
- "audit": "npm audit --audit-level=moderate",
36
+ "audit": "npm audit --omit=dev --audit-level=moderate",
37
+ "audit:all": "npm audit --audit-level=moderate",
37
38
  "benchmark": "npm run build --silent && tsx ./scripts/benchmark.ts",
38
39
  "check:package": "tsx ./scripts/check-package.ts",
39
40
  "format:check": "prettier --check \"**/*.{ts,js,json,md,yml}\"",
@@ -57,8 +58,8 @@
57
58
  },
58
59
  "dependencies": {
59
60
  "@babel/parser": "^7.29.7",
60
- "@vue/compiler-dom": "^3.5.39",
61
- "@vue/compiler-sfc": "^3.5.39",
61
+ "@vue/compiler-dom": "^3.5.44",
62
+ "@vue/compiler-sfc": "^3.5.44",
62
63
  "commander": "^12.1.0",
63
64
  "fast-glob": "^3.3.3"
64
65
  },
@@ -69,7 +70,7 @@
69
70
  "@types/node": "^18.19.130",
70
71
  "@types/vscode": "^1.125.0",
71
72
  "prettier": "^3.9.5",
72
- "semantic-release": "^25.0.5",
73
+ "semantic-release": "^25.0.9",
73
74
  "tsx": "^4.23.0",
74
75
  "typescript": "^7.0.2"
75
76
  }