🚀 Socket Launch Week 🚀 Day 3: Socket Acquires Coana.Learn More

eslint-plugin-lingui

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-lingui - npm Package Compare versions

Comparing version

to
0.8.4

@@ -71,4 +71,2 @@ "use strict";

switch (node.type) {
case utils_1.TSESTree.AST_NODE_TYPES.Literal:
case utils_1.TSESTree.AST_NODE_TYPES.TemplateLiteral:
case utils_1.TSESTree.AST_NODE_TYPES.LogicalExpression:

@@ -248,5 +246,2 @@ case utils_1.TSESTree.AST_NODE_TYPES.BinaryExpression:

return false;
if (node.type === utils_1.TSESTree.AST_NODE_TYPES.TSAsExpression) {
return isStringLiteral(node.expression);
}
switch (node.type) {

@@ -259,4 +254,4 @@ case utils_1.TSESTree.AST_NODE_TYPES.Literal:

return true;
/* istanbul ignore next */
default:
/* istanbul ignore next */
return false;

@@ -269,2 +264,3 @@ }

}
/* istanbul ignore next */
return node === null || node === void 0 ? void 0 : node.name;

@@ -287,2 +283,17 @@ };

}
function isInsideTypeContext(node) {
let parent = node.parent;
while (parent) {
switch (parent.type) {
case utils_1.TSESTree.AST_NODE_TYPES.TSPropertySignature:
case utils_1.TSESTree.AST_NODE_TYPES.TSIndexSignature:
case utils_1.TSESTree.AST_NODE_TYPES.TSTypeAnnotation:
case utils_1.TSESTree.AST_NODE_TYPES.TSTypeLiteral:
case utils_1.TSESTree.AST_NODE_TYPES.TSLiteralType:
return true;
}
parent = parent.parent;
}
return false;
}
const processTextNode = (node) => {

@@ -292,2 +303,3 @@ visited.add(node);

if (!text || isIgnoredSymbol(text) || isTextWhiteListed(text)) {
/* istanbul ignore next */
return;

@@ -328,5 +340,2 @@ }

},
'JSXElement > Literal'(node) {
processTextNode(node);
},
'JSXElement > JSXExpressionContainer > Literal'(node) {

@@ -439,11 +448,15 @@ processTextNode(node);

return;
if (isTextWhiteListed(trimmed))
if (isTextWhiteListed(trimmed)) {
return;
}
if (isAssignedToIgnoredVariable(node, isIgnoredName)) {
return; // Do not report this literal
return;
}
// New check: if the literal is inside an ignored property, do not report
if (isInsideIgnoredProperty(node)) {
return;
}
// Only ignore type context for property keys
if (isInsideTypeContext(node)) {
return;
}
context.report({ node, messageId: 'default' });

@@ -460,3 +473,2 @@ },

}
// New check: if the template literal is inside an ignored property, do not report
if (isInsideIgnoredProperty(node)) {

@@ -463,0 +475,0 @@ return;

{
"name": "eslint-plugin-lingui",
"version": "0.8.3",
"version": "0.8.4",
"description": "ESLint plugin for Lingui",

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

Sorry, the diff of this file is not supported yet