Skip to content

ESLint plugin for React Intl Universal Library enforce locale and avoid display literal strings

License

Notifications You must be signed in to change notification settings

victorsoares96/eslint-plugin-react-intl-universal

Repository files navigation

eslint-plugin-react-intl-universal

react-intl-universal linting rules for Alibaba React Intl Universal internationalization library.

Installation

$ npm install eslint-plugin-react-intl-universal --save-dev
$ yarn add -D eslint-plugin-react-intl-universal

Usage

Add react-intl-universal to the plugins section of your .eslintrc configuration file.

{
  "plugins": ["react-intl-universal"]
}

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

{
  "rules": {
    "react-intl-universal/no-literal-string": "error",
    "react-intl-universal/id-missing": ["error", { "locales": ["src/locales/en-US.json"] }]
  }
}

or

{
  "extends": ["plugin:react-intl-universal/recommended"]
}
  • By default id-missing rule, list of locale files, defaults to ['locales/en-US.json']

Supported Rules

  • id-missing - This rule was based on the rule in this repository.
  • no-literal-string - This rule aims to avoid developers to display literal string directly to users without translating them.

Thanks

License

eslint-plugin-react-intl-universal is licensed under the MIT License.

About

ESLint plugin for React Intl Universal Library enforce locale and avoid display literal strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published