{"id":25531,"library":"eslint-plugin-t","title":"eslint-plugin-t","description":"An ESLint plugin providing lint rules for internationalization, especially for strings wrapped in `t()` calls. The current stable version is 1.7.1. It helps enforce consistent use of translation function `t()` and can detect missing translations or incorrect usage. Compared to other i18n lint plugins, it focuses specifically on the `t()` pattern used in many JavaScript projects. Release cadence is irregular as it's a smaller community project.","status":"active","version":"1.7.1","language":"javascript","source_language":"en","source_url":"https://github.com/eslint-tools/eslint-plugin-t","tags":["javascript"],"install":[{"cmd":"npm install eslint-plugin-t","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-t","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-t","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run the plugin","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v1; use import for ES modules","wrong":"const plugin = require('eslint-plugin-t')","symbol":"plugin","correct":"import plugin from 'eslint-plugin-t'"},{"note":"Named export 'rules' is available with ESM","wrong":"const { rules } = require('eslint-plugin-t')","symbol":"rules","correct":"import { rules } from 'eslint-plugin-t'"},{"note":"Rule names are not top-level exports; access via rules object","wrong":"const { t-no-literal-string } = require('eslint-plugin-t')","symbol":"t-no-literal-string","correct":"import { rules: { 't-no-literal-string': rule } } from 'eslint-plugin-t'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['t'],\n  rules: {\n    't/no-literal-string': 'error',\n    't/no-unused-t': 'warn',\n  },\n};\n\n// Source code with t()\nconst msg = t('Hello World'); // allowed\nconst bad = 'Hello World';    // error with no-literal-string\n","lang":"javascript","description":"Shows basic setup of eslint-plugin-t with two rules and demonstrates linting behavior on t() usage."},"warnings":[{"fix":"Update import to use 'eslint-plugin-t' and configure rules under plugins and rules","message":"Version 1.0.0 changed default export from object with rules to a plugin object requiring different import","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Replace 't/no-literal-string' with 't/valid-t-usage'","message":"Rule 't/no-literal-string' was deprecated in v1.5.0 in favor of 't/valid-t-usage'","severity":"deprecated","affected_versions":">=1.5.0"},{"fix":"Add declare function t(key: string): string; in your project's types","message":"If using TypeScript, the plugin may not recognize t() calls without type information; need to define t() signature in global types","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update rule configs to use 'error' or 'warn' strings","message":"Version 1.7.0 changed rule configs to use severity strings 'error'/'warn' instead of numbers 2/1","severity":"breaking","affected_versions":"<1.7.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev eslint-plugin-t","cause":"Missing dependency or not installed as a dev dependency","error":"Error: Failed to load plugin 't': Cannot find module 'eslint-plugin-t'"},{"fix":"Add 't' to the plugins array in your ESLint config","cause":"Plugin not added to plugins array in ESLint config","error":"ESLint: Rule 't/no-literal-string' is not defined"},{"fix":"Access rules via imported plugin object: plugin.rules['t-no-literal-string']","cause":"Incorrect import or destructuring of rules from plugin","error":"TypeError: Cannot read properties of undefined (reading 't-no-literal-string')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}