{"id":19817,"library":"eslint-plugin-lingui","title":"eslint-plugin-lingui","description":"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.","status":"active","version":"0.13.1","language":"javascript","source_language":"en","source_url":"https://github.com/lingui/eslint-plugin","tags":["javascript","eslint","eslintplugin","eslint-plugin","lingui","linguijs","lingui-js","typescript"],"install":[{"cmd":"npm install eslint-plugin-lingui","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-lingui","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-lingui","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; required to be installed in the project","package":"eslint","optional":false},{"reason":"optional peer dependency; needed for TypeScript-aware rules (since v0.12.0)","package":"typescript","optional":true}],"imports":[{"note":"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.","wrong":"const pluginLingui = require('eslint-plugin-lingui')","symbol":"pluginLingui (default import)","correct":"import pluginLingui from 'eslint-plugin-lingui'"},{"note":"The flat config is under the 'flat/recommended' key. For legacy config, use 'plugin:lingui/recommended' in extends.","wrong":"pluginLingui.configs.recommended","symbol":"configs (flat/recommended)","correct":"pluginLingui.configs['flat/recommended']"},{"note":"As of v0.13, rules that accept options use array syntax; simple rules use string severity. This is standard ESLint.","wrong":"rules: { 'lingui/t-call-in-function': ['error'] }","symbol":"rules (e.g., t-call-in-function)","correct":"rules: { 'lingui/t-call-in-function': 'error' }"}],"quickstart":{"code":"// eslint.config.js\nimport pluginLingui from 'eslint-plugin-lingui';\n\nexport default [\n  pluginLingui.configs['flat/recommended'],\n  {\n    plugins: {\n      lingui: pluginLingui,\n    },\n    rules: {\n      'lingui/no-unlocalized-strings': ['error', { ignoreNames: ['^_$'] }],\n      'lingui/text-restrictions': ['warn', { patterns: ['TODO'] }],\n    },\n  },\n];","lang":"typescript","description":"Flat ESLint config enabling recommended Lingui rules plus custom no-unlocalized-strings and text-restrictions rules."},"warnings":[{"fix":"Run 'npm install --save-dev typescript' if you use TypeScript.","message":"From v0.12.0, TypeScript must be installed as a peer dependency for TypeScript-project support.","severity":"breaking","affected_versions":">=0.12.0"},{"fix":"Migrate to flat config: import pluginLingui from 'eslint-plugin-lingui' and use pluginLingui.configs['flat/recommended'].","message":"The legacy .eslintrc config format (extends: ['plugin:lingui/recommended']) is deprecated in favor of flat config (eslint.config.js).","severity":"deprecated","affected_versions":">=0.13.0"},{"fix":"Add 'lingui/no-unlocalized-strings': 'error' to your rules.","message":"The 'no-unlocalized-strings' rule is not included in the recommended set by default; it must be explicitly configured.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade ESLint to ^8.37.0 || ^9 || ^10.","message":"Using the plugin with ESLint < 8.37 is not supported and may cause errors.","severity":"gotcha","affected_versions":">=0.13.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the plugin locally: npm install --save-dev eslint-plugin-lingui","cause":"eslint-plugin-lingui not installed or ESLint is global and plugin is local.","error":"Error: Failed to load plugin 'lingui' declared in 'extends' ...: Cannot find module 'eslint-plugin-lingui'"},{"fix":"Remove .eslintrc.* and use only eslint.config.js.","cause":"Both legacy and flat config are present, causing conflict.","error":"ESLint couldn't determine the plugin 'lingui' uniquely. This may be due to plugin loading outside the eslintrc."},{"fix":"Use 'error' string or ['error', options].","cause":"Flat config rule severity is a string but passed as array without first element.","error":"TypeError: Cannot read properties of undefined (reading 'error')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}