Skip to content

Commit

Permalink
docs(readme): fix misleading doc on plugin usage (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
leethree committed Mar 17, 2021
1 parent d19ef06 commit ea2c272
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/eslint-plugin-i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ yarn build

## Rules

* **i18n/no-unknown-key**: Verify that all translation keys you use are present in your primary translation files.
* **i18n/no-unknown-key-secondary-langs**: Same as the previous one. Allow you to have a different error level for secondary languages.
* **i18n/no-text-as-children**: Verify that you have no text children in your react code.
* **i18n/no-text-as-attribute**: Verify that you have no text in some attributes in your react components. List of attributes as to be provided in the config.
* **i18n/interpolation-data**: Checks for usage of keys containing string interpolation, if translate function is called without
* **@m6web/i18n/no-unknown-key**: Verify that all translation keys you use are present in your primary translation files.
* **@m6web/i18n/no-unknown-key-secondary-langs**: Same as the previous one. Allow you to have a different error level for secondary languages.
* **@m6web/i18n/no-text-as-children**: Verify that you have no text children in your react code.
* **@m6web/i18n/no-text-as-attribute**: Verify that you have no text in some attributes in your react components. List of attributes as to be provided in the config.
* **@m6web/i18n/interpolation-data**: Checks for usage of keys containing string interpolation, if translate function is called without
interpolation data it will show an error. Also if interpolation data is given and key doesn't contain interpolation it will also
show an error. `interpolationPattern` option is required to match interpolation in your translation file.

Expand All @@ -39,15 +39,15 @@ You have to add the following lines in your `.eslintrc` file to configure this p
```js
// Declare the plugin
"plugins": [
"m6web-i18n"
"@m6web/i18n"
],
// Specify rules severity
"rules": {
"m6web-i18n/no-unknown-key": "error",
"m6web-i18n/no-unknown-key-secondary-langs": "warn",
"m6web-i18n/no-text-as-children": ["error", {"ignorePattern": "^\\s?[/.]\\s?$"}],
"m6web-i18n/no-text-as-attribute": ["error", {"attributes": ["alt", "title"]}],
"m6web-i18n/interpolation-data": ["error", { "interpolationPattern": "\\{\\.+\\}" }]
"@m6web/i18n/no-unknown-key": "error",
"@m6web/i18n/no-unknown-key-secondary-langs": "warn",
"@m6web/i18n/no-text-as-children": ["error", {"ignorePattern": "^\\s?[/.]\\s?$"}],
"@m6web/i18n/no-text-as-attribute": ["error", {"attributes": ["alt", "title"]}],
"@m6web/i18n/interpolation-data": ["error", { "interpolationPattern": "\\{\\.+\\}" }]
},
// The plugin needs jsx feature to be on for 'no-text-as-children' rule
"parserOptions": {
Expand Down

0 comments on commit ea2c272

Please sign in to comment.