# Linting Rules for gt-next: Lint gt-next URL: https://generaltranslation.com/fr/docs/next-lint.mdx --- title: Lint gt-next description: Plugin ESLint pour les composants gt-next. --- Cette fonctionnalité est en version alpha. Elle est susceptible d’évoluer. Plugin ESLint qui détecte les erreurs de traduction courantes dans les composants gt-next. ## Installation ```bash npm install --save-dev @generaltranslation/gt-next-lint ``` ## Configuration Ajoutez ceci à votre fichier `eslint.config.mjs` : ```javascript import gtNext from "@generaltranslation/gt-next-lint"; export default [ { plugins: { 'gt-next': gtNext }, rules: { 'gt-next/no-dynamic-jsx': 'warn', 'gt-next/no-dynamic-string': 'warn', }, }, ]; ``` ## Règles ### `no-dynamic-jsx` Encapsule le contenu dynamique dans des composants `` à l’aide de composants variables. ```jsx // ❌ Incorrect Hello {userName}! // ✅ Correct Hello {userName}! ``` ### `no-dynamic-string` Autorise uniquement les chaînes littérales dans les fonctions de traduction. ```jsx const gt = useGT(); // ❌ Incorrect gt(`Hello ${name}`) gt('Hello ' + name) // ✅ Correct gt('Hello, {name}!', { name }) ``` ## Composants pris en charge * `` - Variables * `` - Dates * `` - Nombres * `` - Monnaies ## Fonctions prises en charge * `useGT` - Traduction côté client * `getGT` - Traduction côté serveur ## Préréglages de configuration Le plugin inclut le préréglage de configuration `recommended` : ```javascript import gtNext from "@generaltranslation/gt-next-lint"; export default [ gtNext.configs.recommended, ]; ``` Cela active `no-dynamic-jsx` et `no-dynamic-string` en tant qu’avertissements.