You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

eslint-plugin-i18next

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-i18next

ESLint plugin for i18n


Version published
Weekly downloads
187K
decreased by-3.46%
Maintainers
1
Install size
1.38 MB
Created
Weekly downloads
 

Readme

Source

eslint-plugin-i18next

ESLint plugin for i18n

For old versions below v6, plz refer this document

Installation

npm install eslint-plugin-i18next --save-dev

Usage

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

{
  "plugins": ["i18next"]
}

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

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

or

{
  "extends": ["plugin:i18next/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 i18next/no-literal-string: "error"*/
<div>hello world</div>

Example of correct code:

/*eslint i18next/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

Keywords

FAQs

Package last updated on 13 Jul 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc