# General Translation React SDKs (gt-react, gt-next): Linting your code URL: https://generaltranslation.com/en-GB/docs/react/guides/linting-your-code.mdx --- title: Linting your code description: How to catch common internationalisation mistakes with the General Translation ESLint plugin across React, Next.js, TanStack Start, and React Native. related: links: - /docs/react/guides/translating-jsx - /docs/react/guides/translating-strings - /docs/react/guides/formatting-variables - /docs/react/guides/handling-plurals-and-branches --- The General Translation ESLint plugin, `@generaltranslation/react-core-linter`, catches common integration mistakes — dynamic content inside [``](/docs/react/reference/components/t), non-static strings in translation functions, and unsupported attributes — and can auto-fix many of them. It works across `gt-react`, `gt-next`, and `gt-react-native`. *Note: The plugin is pre-1.0 (`0.1.x`) and its rules may change.* ## Install the plugin [#install] Add the plugin as a development dependency. ```bash npm install --save-dev @generaltranslation/react-core-linter ``` ```bash yarn add --dev @generaltranslation/react-core-linter ``` ```bash bun add --dev @generaltranslation/react-core-linter ``` ```bash pnpm add --save-dev @generaltranslation/react-core-linter ``` ## Configure ESLint [#configure] Add the plugin's `recommended` config to your flat ESLint config. It enables every rule as an error. ```js title="eslint.config.js" import gtLint from '@generaltranslation/react-core-linter'; export default [ gtLint.configs.recommended, ]; ``` Compose the recommended config alongside `eslint-config-next`. ```js title="eslint.config.mjs" import { defineConfig, globalIgnores } from 'eslint/config'; import nextVitals from 'eslint-config-next/core-web-vitals'; import nextTs from 'eslint-config-next/typescript'; import gtLint from '@generaltranslation/react-core-linter'; export default defineConfig([ ...nextVitals, ...nextTs, gtLint.configs.recommended, globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts', 'eslint.config.*']), ]); ``` The rules detect translation components and functions by their import source. `gt-tanstack-start` is not in the default list, so add it using the `libs` option on each rule. ```js title="eslint.config.js" import gtLint from '@generaltranslation/react-core-linter'; const libs = ['gt-tanstack-start']; export default [ { plugins: { '@generaltranslation/react-core-linter': gtLint }, rules: { '@generaltranslation/react-core-linter/static-jsx': ['error', { libs }], '@generaltranslation/react-core-linter/static-string': ['error', { libs }], '@generaltranslation/react-core-linter/no-data-attrs-on-branch': ['error', { libs }], }, }, ]; ``` ```js title="eslint.config.js" import gtLint from '@generaltranslation/react-core-linter'; export default [ gtLint.configs.recommended, ]; ``` Run ESLint as usual; add `--fix` to apply the auto-fixes. ```bash npx eslint . --fix ``` ## What the rules catch [#rules] The `recommended` config enables three rules, all as errors: * **`static-jsx`** — flags dynamic content inside `` and requires it to be wrapped in a variable component ([``](/docs/react/reference/components/var), [``](/docs/react/reference/components/num), [``](/docs/react/reference/components/currency), or [``](/docs/react/reference/components/datetime)). Auto-fixable. * **`static-string`** — requires translation functions ([`useGT`](/docs/react/reference/hooks/use-gt), [`getGT`](/docs/node/reference/functions/get-gt), [`msg`](/docs/react/reference/functions/msg)) to receive static string literals, and steers dynamic values into ICU interpolation such as `gt('Hello, {name}!', { name })`. Auto-fixable. * **`no-data-attrs-on-branch`** — flags `data-*` attributes on [``](/docs/react/reference/components/branch), which the component ignores. See the [lint rules reference](/docs/react/reference/lint-rules) for each rule's options and examples. ## Next steps - /docs/react/guides/translating-jsx - /docs/react/guides/translating-strings - /docs/react/guides/formatting-variables - /docs/react/guides/handling-plurals-and-branches