Registry / testing / eslint-plugin-lingui

eslint-plugin-lingui

JSON →
library0.13.1jsnpmunverified

ESLint plugin for Lingui, the internationalization (i18n) framework for JavaScript/TypeScript. Current stable version 0.13.1, released July 2024, with a steady monthly release cadence. It enforces best practices and catches common mistakes in Lingui usage: ensuring translations are called inside functions, no expressions inside message templates, no nested <Trans> components, consistent plural format, and more. Provides both recommended and custom configurations for flat and legacy ESLint configs. Key differentiator: purpose-built for Lingui, with deep integration into its macro system and JSX patterns, unlike generic i18n linters.

npm install eslint-plugin-lingui
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-LING
E
eslint-plugin-lingui
testingjavascriptv0.13.1
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.

pluginLingui (default import)
import pluginLingui from 'eslint-plugin-lingui'
const pluginLingui = require('eslint-plugin-lingui')
ESM-only since v0.13.0? Actually the package ships both CJS and ESM. CommonJS require is valid but default import is preferred for flat config.
configs (flat/recommended)
pluginLingui.configs['flat/recommended']
pluginLingui.configs.recommended
The flat config is under the 'flat/recommended' key. For legacy config, use 'plugin:lingui/recommended' in extends.
rules (e.g., t-call-in-function)
rules: { 'lingui/t-call-in-function': 'error' }
rules: { 'lingui/t-call-in-function': ['error'] }
As of v0.13, rules that accept options use array syntax; simple rules use string severity. This is standard ESLint.

Flat ESLint config enabling recommended Lingui rules plus custom no-unlocalized-strings and text-restrictions rules.

// eslint.config.js import pluginLingui from 'eslint-plugin-lingui'; export default [ pluginLingui.configs['flat/recommended'], { plugins: { lingui: pluginLingui, }, rules: { 'lingui/no-unlocalized-strings': ['error', { ignoreNames: ['^_$'] }], 'lingui/text-restrictions': ['warn', { patterns: ['TODO'] }], }, }, ];
Debug
Known issues
breakingFrom v0.12.0, TypeScript must be installed as a peer dependency for TypeScript-project support.
fix
Run 'npm install --save-dev typescript' if you use TypeScript.
affects: >=0.12.0
deprecatedThe legacy .eslintrc config format (extends: ['plugin:lingui/recommended']) is deprecated in favor of flat config (eslint.config.js).
fix
Migrate to flat config: import pluginLingui from 'eslint-plugin-lingui' and use pluginLingui.configs['flat/recommended'].
affects: >=0.13.0
gotchaThe 'no-unlocalized-strings' rule is not included in the recommended set by default; it must be explicitly configured.
fix
Add 'lingui/no-unlocalized-strings': 'error' to your rules.
affects: >=0.1.0
gotchaUsing the plugin with ESLint < 8.37 is not supported and may cause errors.
fix
Upgrade ESLint to ^8.37.0 || ^9 || ^10.
affects: >=0.13.0
Errors
Common errors & fixes
Error: Failed to load plugin 'lingui' declared in 'extends' ...: Cannot find module 'eslint-plugin-lingui'
eslint-plugin-lingui not installed or ESLint is global and plugin is local.
fix
Install the plugin locally: npm install --save-dev eslint-plugin-lingui
ESLint couldn't determine the plugin 'lingui' uniquely. This may be due to plugin loading outside the eslintrc.
Both legacy and flat config are present, causing conflict.
fix
Remove .eslintrc.* and use only eslint.config.js.
TypeError: Cannot read properties of undefined (reading 'error')
Flat config rule severity is a string but passed as array without first element.
fix
Use 'error' string or ['error', options].
Upgrade
Version history
0.13.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; required to be installed in the project
typescriptoptionaloptional peer dependency; needed for TypeScript-aware rules (since v0.12.0)
Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
eslint-plugin-lingui — npm install eslint-plugin-lingui · libregistry