1.0.0 • Published 9 months ago

eslint-plugin-transify v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

eslint-plugin-transify

ESLint plugin for i18n

For old versions below v6, plz refer this document

Installation

npm install eslint-plugin-transify --save-dev

Usage

Add transify to the plugins section of your .eslintrc configuration file.

{
  "plugins": ["transify"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "transify/no-literal-string": 2
  }
}

or

{
  "extends": ["plugin:transify/recommended"]
}

Rule no-literal-string

This rule aims to avoid developers to display literal string directly to users without translating them.

Note: Disable auto-fix because key in the call i18next.t(key) usually was not the same as the literal

Example of incorrect code:

/*eslint transify/no-literal-string: "error"*/
<div>hello world</div>

Example of correct code:

/*eslint transify/no-literal-string: "error"*/
<div>{i18next.t('HELLO_KEY')}</div>

More options can be found here

Breaking change

By default, it will only validate the plain text in JSX markup instead of all literal strings in previous versions. You can change it easily

1.0.0

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago