You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@cloudflare/eslint-plugin-i18n

Package Overview
Dependencies
Maintainers
29
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/eslint-plugin-i18n

A list of recommended rules for @cloudflare/eslint-plugin-i18n

0.0.24
latest
npmnpm
Version published
Maintainers
29
Created
Source

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>

Keywords

eslint

FAQs

Package last updated on 06 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts