Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-i18next

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-i18next - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## [4.2.0](https://github.com/edvardchen/eslint-plugin-i18next/compare/v4.1.0...v4.2.0) (2020-07-01)
### Bug Fixes
* remove console ([f361e63](https://github.com/edvardchen/eslint-plugin-i18next/commit/f361e63))
### Features
* allow ignoring lists of components ([eebb338](https://github.com/edvardchen/eslint-plugin-i18next/commit/eebb338))
## [4.1.0](https://github.com/edvardchen/eslint-plugin-i18next/compare/v4.0.0...v4.1.0) (2020-06-30)

@@ -7,0 +19,0 @@

16

lib/rules/no-literal-string.js

@@ -45,2 +45,8 @@ /**

},
ignoreComponent: {
type: 'array',
items: {
type: 'string'
}
},
markupOnly: {

@@ -139,2 +145,6 @@ type: 'boolean'

// Ignore the Trans component for react-i18next compatibility
let ignoredComponents = ['Trans'];
if (option && option.ignoreComponent)
ignoredComponents = ignoredComponents.concat(option.ignoreComponent);
function hasValidElementName(node) {

@@ -148,3 +158,7 @@ let currentNode = node;

) {
if (currentNode.parent.openingElement.name.name === 'Trans') {
if (
ignoredComponents.includes(
currentNode.parent.openingElement.name.name
)
) {
return true;

@@ -151,0 +165,0 @@ }

2

package.json
{
"name": "eslint-plugin-i18next",
"version": "4.1.0",
"version": "4.2.0",
"description": "ESLint plugin for i18n",

@@ -5,0 +5,0 @@ "keywords": [

@@ -318,1 +318,12 @@ # eslint-plugin-i18next

```
#### ignoreComponent
The `ignoreComponent` option specifies exceptions not to check for string literals inside a list of named components. It includes `<Trans>` per default.
Examples of correct code for the `{ "ignoreComponent": ["Icon"] }` option:
```jsx
/*eslint i18next/no-literal-string: ["error", { "ignoreComponent": ["Icon"] }]*/
<Icon>arrow<Icon/>
```

@@ -106,2 +106,4 @@ /**

{ code: '<Trans><span>bar</span></Trans>' },
{ code: '<Trans>foo</Trans>', options: [{ ignoreComponent: ['Icon'] }] },
{ code: '<Icon>arrow</Icon>', options: [{ ignoreComponent: ['Icon'] }] },
{ code: 'a + "b"', options: [{ markupOnly: true }] },

@@ -108,0 +110,0 @@ { code: '<div>{import("abc")}</div>', options: [{ markupOnly: true }] },

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc