{"id":19896,"library":"eslint-plugin-react-i18n","title":"ESLint Plugin React i18n","description":"ESLint plugin providing rules to enforce internationalization (i18n) in React applications, with primary support for i18next. Current stable version is 1.0.3 (released December 2019). The plugin includes rules such as 'no-dynamic-translation-keys' and 'no-missing-interpolation-keys' to catch common i18n mistakes. It is designed to be framework-agnostic but focuses on i18next, with openness to PRs for other frameworks. The package is maintained by lolatravel and has a low release cadence (no updates since 2019). Differentiator: focused solely on React i18n enforcement, unlike more general i18n linting tools.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/lolatravel/eslint-plugin-react-i18n","tags":["javascript","eslint","eslintplugin","eslint-plugin","react","i18n","react-i18n","i18next","react-i18next"],"install":[{"cmd":"npm install eslint-plugin-react-i18n","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-i18n","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-i18n","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run the plugin","package":"eslint","optional":false}],"imports":[{"note":"ESLint automatically strips 'eslint-plugin-' prefix from plugin names.","wrong":"{\"plugins\": [\"eslint-plugin-react-i18n\"]}","symbol":"eslint-plugin-react-i18n","correct":"// In .eslintrc JSON:\n{\"plugins\": [\"react-i18n\"]}"},{"note":"Rule names must include the plugin prefix without 'eslint-plugin-'.","wrong":"{\"no-dynamic-translation-keys\": \"error\"}","symbol":"react-i18n/no-dynamic-translation-keys","correct":"// In .eslintrc rules:\n{\"react-i18n/no-dynamic-translation-keys\": \"error\"}"},{"note":"This rule currently expects no options; configuration options may not be supported.","wrong":"{\"react-i18n/no-missing-interpolation-keys\": [\"error\", {...}]}","symbol":"react-i18n/no-missing-interpolation-keys","correct":"// In .eslintrc rules:\n{\"react-i18n/no-missing-interpolation-keys\": \"error\"}"}],"quickstart":{"code":"// Install ESLint and plugin:\n// npm i -D eslint eslint-plugin-react-i18n\n\n// .eslintrc.js\nmodule.exports = {\n  plugins: ['react-i18n'],\n  extends: ['plugin:react-i18n/recommended'],\n  rules: {\n    'react-i18n/no-dynamic-translation-keys': 'error',\n    'react-i18n/no-missing-interpolation-keys': 'error',\n  },\n};\n\n// Example React component with i18next:\nimport { useTranslation } from 'react-i18next';\n\nfunction MyComponent() {\n  const { t } = useTranslation();\n  // Bad: dynamic key\n  const key = 'greeting';\n  return <div>{t(key)}</div>; // no-dynamic-translation-keys warns\n  // Good: static string key\n  return <div>{t('greeting')}</div>;\n}","lang":"javascript","description":"Setup ESLint with react-i18n plugin and recommended config, plus example of rule enforcement."},"warnings":[{"fix":"Consider alternative plugins like eslint-plugin-i18next or custom rules for newer ESLint versions.","message":"Plugin has not been updated since December 2019; may not support modern ESLint (>=7).","severity":"deprecated","affected_versions":">=1.0.3"},{"fix":"If using ESLint 7+, test thoroughly; may need to update plugin or use older ESLint (6.x).","message":"ESLint 7+ changed context.getScope() to context.sourceCode.getScope(); plugin may break.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use plugin with i18next or contribute PR for other libraries.","message":"Rules only support i18next by default; other i18n libraries may not be recognized.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually verify interpolation keys if using complex translation files.","message":"The 'no-missing-interpolation-keys' rule may not detect all interpolation variants (e.g., nested objects).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ESLint 6.x or lower, or find a maintained fork.","message":"Plugin requires ESLint as a peer dependency with versions ^3 || ^4 || ^5 || ^6; incompatibility with ESLint 8+.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install eslint-plugin-react-i18n --save-dev","cause":"Plugin not installed or not in node_modules.","error":"Error: Failed to load plugin 'react-i18n': Cannot find module 'eslint-plugin-react-i18n'"},{"fix":"Add 'plugins: [\"react-i18n\"]' to .eslintrc config.","cause":"Rule name misspelled or plugin not configured in plugins section.","error":"Definition for rule 'react-i18n/no-dynamic-translation-keys' was not found"},{"fix":"Run npm install eslint --save-dev","cause":"ESLint not installed as dev dependency.","error":"ESLint configuration error: missing 'eslint' peer dependency"},{"fix":"Create an .eslintrc file (JSON, YAML, JS) and configure the plugin.","cause":"No .eslintrc file present.","error":"No ESLint configuration found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}