{"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,"search_vec":"'1.7.1':25 'cadenc':62 'call':19 'communiti':70 'compar':43 'consist':29 'current':21 'detect':37 'enforc':28 'eslint':2,6 'eslint-plugin-t':1 'especi':13 'focus':50 'function':33 'help':27 'i18n':46 'incorrect':41 'internation':12 'irregular':64 'javascript':59,72 'lint':9,47 'mani':58 'miss':38 'pattern':55 'plugin':3,7,48 'project':60,71 'provid':8 'releas':61 'rule':10 'smaller':69 'specif':51 'stabl':22 'string':15 'translat':32,39 'usag':42 'use':30,56 'version':23 'wrap':16","created_at":"2026-05-01T13:45:14.993076+00:00","updated_at":"2026-05-01T13:45:14.993076+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/eslint-tools/eslint-plugin-t","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-t","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}