@cloudflare/eslint-plugin-i18n

0.0.24 • Public • Published

eslint-plugin-i18n

A list of recommended rules for how to catch naked strings. A naked string is a string that is not internationalized.

Installation

You'll first need to install ESLint:

$ yarn -D eslint

Next, install eslint-plugin-i18n:

$ yarn add eslint-plugin-i18n

Note: If you installed ESLint globally (using the yarn global flag) then you must also install eslint-plugin-i18n globally.

Usage

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

{
    "plugins": [
        "i18n"
    ]
}

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

{
    "rules": {
        "i18n/rule-name": 2
    }
}

Supported Rules

This plugin will throw errors for:

  • variable declarations of naked string literals ie) const foo = 'test'; <p>{foo}</p>

  • variable declarations of naked template literals ie) const foo2 = `test`; <p>{foo}</p>

  • naked template literals inside of jsx expression containers ie) const bar = <Trans id={`TESTING`} />

  • naked string literals inside of jsx expression containers ie) <div>{'wtf'}</div>

Package Sidebar

Install

npm i @cloudflare/eslint-plugin-i18n

Weekly Downloads

657

Version

0.0.24

License

ISC

Unpacked Size

18.1 kB

Total Files

8

Last publish

Collaborators

  • rexscaria
  • dcruz_cf
  • xuranwang
  • jculvey
  • sejoker
  • cf-radar
  • cf-ci-write
  • segments-write
  • thibmeu
  • xortive
  • gurjinder
  • cf-ci2
  • lvalenta
  • worenga
  • chiminator
  • third774
  • jasnell
  • terinjokes
  • celso
  • jsteinberger
  • gregbrimble
  • asapzacy
  • g4brym
  • wrangler-publisher
  • cf-media-manager
  • dash_service_account
  • jacobbednarz
  • lerwincf
  • simonabadoiu
  • cms1919
  • mgirouard-cf
  • musa-cf
  • vaishakpdinesh
  • ichernetsky-cf
  • jseba_cf
  • gabivlj-cf
  • ganders-cloudflare
  • nsharma-cf
  • mikenomitch
  • tlefebvre_cf
  • nafeezcf
  • eduardo-vargas