Skip to main content

ESLint Plugin

Lingui provides an ESLint plugin to help you find common Lingui usage errors in your code.

npm-version npm-downloads

Installation

Install ESLint:

npm install --save-dev eslint

Next, install eslint-plugin-lingui:

npm install --save-dev eslint-plugin-lingui

If you have installed ESLint globally (using the -g flag), you must also install eslint-plugin-lingui globally.

Usage

Add lingui to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
"plugins": ["lingui"]
}

In the rules section, configure the rules you want to use:

{
"rules": {
"lingui/no-unlocalized-strings": 2,
"lingui/t-call-in-function": 2,
"lingui/no-single-variables-to-translate": 2,
"lingui/no-expression-in-message": 2,
"lingui/no-single-tag-to-translate": 2,
"lingui/no-trans-inside-trans": 2
}
}
info

See the official repository for more information about the rules.

caution

The ESLint's Flat Config is not yet supported. See #31.