Skip to content

Commit be4654b

Browse files
committed
docs: document type-based Lingui macro verification
1 parent f9a7793 commit be4654b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,26 @@ const message = "Welcome to our app"
2929

3030
**No configuration needed** for DOM APIs, Intl methods, or your own string literal union types. TypeScript already knows!
3131

32+
### Smart Lingui Detection
33+
34+
The plugin uses TypeScript's symbol resolution to verify that `t`, `Trans`, `msg`, etc. actually come from Lingui packages — not just any function with the same name:
35+
36+
```ts
37+
import { t } from "@lingui/macro"
38+
const label = t`Save` // ✅ Recognized as Lingui
39+
40+
// Your own function with the same name
41+
const t = (key: string) => translations[key]
42+
const label = t("save") // ❌ Not confused with Lingui
43+
```
44+
3245
## Features
3346

3447
- 🔍 Detects incorrect usage of Lingui translation macros
3548
- 📝 Enforces simple, safe expressions inside translated messages
3649
- 🎯 Detects missing localization of user-visible text
3750
- 🧠 Zero-config recognition of technical strings via TypeScript types
51+
- 🔒 Verifies Lingui macros actually come from `@lingui/*` packages (no false positives from similarly-named functions)
3852

3953
## Requirements
4054

@@ -112,6 +126,7 @@ This plugin is a TypeScript-focused alternative to the official [eslint-plugin-l
112126
| **String literal unions** | Manual whitelist | ✅ Auto-detected |
113127
| **DOM API strings** | Manual whitelist | ✅ Auto-detected |
114128
| **Intl method arguments** | Manual whitelist | ✅ Auto-detected |
129+
| **Lingui macro verification** | Name-based only | ✅ Verifies package origin |
115130
| **ESLint version** | 8.x | 9.x (flat config) |
116131
| **Config format** | Legacy `.eslintrc` | Flat config only |
117132

0 commit comments

Comments
 (0)