Giter VIP home page Giter VIP logo

eslint-plugin-i18next's Introduction

eslint-plugin-i18next

ESLint plugin for i18n

For old versions below v6, plz refer this document

Installation

npm install eslint-plugin-i18next@next --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 wil only validate the plain text in JSX markup instead of all literal strings in previous versions. You can change it easily

eslint-plugin-i18next's People

Contributors

edvardchen avatar dependabot[bot] avatar jeffreyatw avatar darcros avatar emroussel avatar joshuat avatar nickskotny avatar fibo avatar megos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.