New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-lingui

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-lingui - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

35

lib/rules/no-unlocalized-strings.js

@@ -36,2 +36,8 @@ "use strict";

},
ignoreProperty: {
type: 'array',
items: {
type: 'string',
},
},
},

@@ -100,5 +106,12 @@ additionalProperties: false,

];
function isValidAttrName(name) {
return userJSXAttrs.includes(name);
}
const ignoredProperties = (option && option.ignoreProperty) || [];
const userProperties = [
'className',
'styleName',
'type',
'id',
'width',
'height',
...ignoredProperties,
];
//----------------------------------------------------------------------

@@ -136,3 +149,3 @@ // Public

// allow <MyComponent className="active" />
if (isValidAttrName(getAttrName((_b = parent === null || parent === void 0 ? void 0 : parent.name) === null || _b === void 0 ? void 0 : _b.name))) {
if (userJSXAttrs.includes(getAttrName((_b = parent === null || parent === void 0 ? void 0 : parent.name) === null || _b === void 0 ? void 0 : _b.name))) {
visited.add(node);

@@ -149,3 +162,3 @@ return;

const onProperty = (node) => {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e, _f, _g, _h;
const { parent } = node;

@@ -160,14 +173,14 @@ if (parent.type === utils_1.TSESTree.AST_NODE_TYPES.Property) {

if (((_a = parent === null || parent === void 0 ? void 0 : parent.key) === null || _a === void 0 ? void 0 : _a.type) === utils_1.TSESTree.AST_NODE_TYPES.Identifier &&
(0, helpers_1.isUpperCase)((_b = parent === null || parent === void 0 ? void 0 : parent.key) === null || _b === void 0 ? void 0 : _b.name)) {
((0, helpers_1.isUpperCase)((_b = parent === null || parent === void 0 ? void 0 : parent.key) === null || _b === void 0 ? void 0 : _b.name) || userProperties.includes((_c = parent === null || parent === void 0 ? void 0 : parent.key) === null || _c === void 0 ? void 0 : _c.name))) {
visited.add(node);
}
if (((_c = parent === null || parent === void 0 ? void 0 : parent.key) === null || _c === void 0 ? void 0 : _c.type) === utils_1.TSESTree.AST_NODE_TYPES.Literal &&
(0, helpers_1.isUpperCase)(`${(_d = parent === null || parent === void 0 ? void 0 : parent.key) === null || _d === void 0 ? void 0 : _d.value}`)) {
if (((_d = parent === null || parent === void 0 ? void 0 : parent.key) === null || _d === void 0 ? void 0 : _d.type) === utils_1.TSESTree.AST_NODE_TYPES.Literal &&
(0, helpers_1.isUpperCase)(`${(_e = parent === null || parent === void 0 ? void 0 : parent.key) === null || _e === void 0 ? void 0 : _e.value}`)) {
visited.add(node);
}
if (((_e = parent === null || parent === void 0 ? void 0 : parent.value) === null || _e === void 0 ? void 0 : _e.type) === utils_1.TSESTree.AST_NODE_TYPES.Literal &&
(0, helpers_1.isUpperCase)(`${(_f = parent === null || parent === void 0 ? void 0 : parent.value) === null || _f === void 0 ? void 0 : _f.value}`)) {
if (((_f = parent === null || parent === void 0 ? void 0 : parent.value) === null || _f === void 0 ? void 0 : _f.type) === utils_1.TSESTree.AST_NODE_TYPES.Literal &&
(0, helpers_1.isUpperCase)(`${(_g = parent === null || parent === void 0 ? void 0 : parent.value) === null || _g === void 0 ? void 0 : _g.value}`)) {
visited.add(node);
}
if (((_g = parent === null || parent === void 0 ? void 0 : parent.key) === null || _g === void 0 ? void 0 : _g.type) === utils_1.TSESTree.AST_NODE_TYPES.TemplateLiteral &&
if (((_h = parent === null || parent === void 0 ? void 0 : parent.key) === null || _h === void 0 ? void 0 : _h.type) === utils_1.TSESTree.AST_NODE_TYPES.TemplateLiteral &&
(0, helpers_1.isUpperCase)((0, helpers_1.getQuasisValue)(parent === null || parent === void 0 ? void 0 : parent.key))) {

@@ -174,0 +187,0 @@ visited.add(node);

{
"name": "eslint-plugin-lingui",
"version": "0.1.2",
"version": "0.2.0",
"description": "ESLint plugin for Lingui",

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

@@ -114,2 +114,17 @@ # <div align="center">An ESLint Plugin For Lingui<sub>js</sub></div>

By default, the following attributes are ignored: `className`, `styleName`, `type`, `id`, `width`, `height`
#### ignoreProperty
The `ignoreProperty` option specifies property names not to check.
Examples of correct code for the `{ "ignoreProperty": ["text"] }` option:
```jsx
/*eslint lingui/no-unlocalized-strings: ["error", { "ignoreProperty": ["text"] }]*/
const test = { text: 'This is ignored' }
```
By default, the following properties are ignored: `className`, `styleName`, `type`, `id`, `width`, `height`
## t-call-in-function

@@ -116,0 +131,0 @@

Sorry, the diff of this file is not supported yet

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