agama/web/eslint-plugin-agama-i18n
2023-10-13 17:14:21 +02:00
..
eslint-plugin-agama-i18n.js Added ESlint plugin for checking translation issues 2023-10-13 17:14:21 +02:00
package.json Added ESlint plugin for checking translation issues 2023-10-13 17:14:21 +02:00
README.md Added ESlint plugin for checking translation issues 2023-10-13 17:14:21 +02:00
string-literals.js Added ESlint plugin for checking translation issues 2023-10-13 17:14:21 +02:00
string-literals.test.js Added ESlint plugin for checking translation issues 2023-10-13 17:14:21 +02:00

The ESLint Plugin

This directory contains an ESLint plugin which checks that only string literals are passed to the translation functions.

It is bundled here because it is closely tied to the Agama project and probably does not make sense for other projects.

Disabling the Check

In some rare cases using a variable instead of a string literal is correct. In that case disable the check locally:

const SIZES = [ N_("small"), N_("medium"), N_("large") ];

// returns one of the sizes above
const sz = getSize();

// eslint-disable-next-line agama-i18n/string-literals
return <span>{_(sz)}</span>;