This repository contains an ESLint plugin for validating usage of i18next
.
yarn add -D @lifeomic/eslint-plugin-i18next
// .eslintrc.js
module.exports = {
plugins: ['@lifeomic/i18next'],
rules: {
'@lifeomic/i18next/default-value': [
'error',
{
/* optional options object */
},
],
},
};
translateFunctionNames
: an array of translation function names to validate. Default is['t']
allowKeyOnly
: whether to allow e.g.t('just-the-key')
. Default isfalse
.allowNestingInterpolation
: Whether to allow e.g.{ defaultValue: 'some string $t(interpolated)' }
. Default isfalse
.nestingPrefix
: Used whenallowNestingInterpolation
isfalse
to identify interpolated variables. Default is"$t("
.