Registry / testing / eslint-plugin-string-to-lingui

eslint-plugin-string-to-lingui

JSON →
library0.25.0jsnpmunverified

An ESLint plugin (v0.25.0, actively maintained) that enforces proper usage of the Lingui internationalization library. It includes rules to detect untranslated strings, enforce `t` calls inside functions for dynamic language switching, prevent incorrect i18n macro usage, and validate message consistency against a reference JSON file. Key differentiators include support for JSX text, template literals, and customizable ignore patterns, making it suitable for large codebases migrating to Lingui v3+.

npm install eslint-plugin-string-to-lingui
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-STRI
E
eslint-plugin-string-to-lingui
testingjavascriptv0.25.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
plugins: ['string-to-lingui']
plugins: ['eslint-plugin-string-to-lingui']
ESLint automatically strips the 'eslint-plugin-' prefix when referencing in .eslintrc

Configure all 8 ESLint rules to enforce Lingui best practices: detect untranslated strings, ensure t calls in functions, validate macros, and check messages against a reference file.

// .eslintrc.json { "plugins": ["string-to-lingui"], "rules": { "string-to-lingui/missing-lingui-transformation": "error", "string-to-lingui/t-call-in-function": "warn", "string-to-lingui/macro-inside-t-and-i18": "error", "string-to-lingui/t-should-be-before-macro": "warn", "string-to-lingui/no-single-variables-to-translate": "warn", "string-to-lingui/check-en-messages": ["warn", { "sourcePath": "path/to/en/messages.json", "similarityThreshold": 0.9, "maxSuggestions": 3 }], "string-to-lingui/text-restrictions": ["error", { "rules": [{ "patterns": ["''", "’", "“"], "message": "Use straight quotes and apostrophes." }] }], "string-to-lingui/forbid-i18n-calls": ["error", { "rules": [ { "handlerName": "_", "message": "Use t`` from '@lingui/macro' instead" }, { "handlerName": "number", "message": "Use formatCurrency or formatNumber instead" } ] }] } }
Debug
Known issues
gotchaThe rule 'no-single-varibles-to-translate' has a typo in its name ('varibles' instead of 'variables'). This is intentional for backward compatibility, but may cause confusion.
fix
Use the exact rule name 'string-to-lingui/no-single-varibles-to-translate' in your configuration.
affects: >=0.0.0
deprecatedThe rule 'i18n-number-call-in-function' is deprecated and likely replaced by 't-call-in-function' or a more general rule.
fix
Use 'string-to-lingui/t-call-in-function' instead.
affects: >=0.0.0
gotchaThe 'forbid-i18n-calls' rule may not cover all i18n methods (e.g., 'i18n.date'). Custom rules may be needed.
fix
Add additional rules for any i18n methods you want to forbid.
affects: >=0.0.0
Errors
Common errors & fixes
Configuration for rule "string-to-lingui/check-en-messages" is invalid: value.forEach is not a function
The 'check-en-messages' rule expects an object, not an array.
fix
Replace the array with an object: ["warn", { "sourcePath": "..." }]
Cannot read property 'some' of undefined
The 'missing-lingui-transformation' rule is missing its options object when using sub-options like 'ignore'.
fix
Ensure the rule configuration includes an object: ["error", { "ignore": ["rgba"] }]
Upgrade
Version history
0.25.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin functionality
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-string-to-lingui — npm install eslint-plugin-string-to-lingui · libregistry