diff --git a/.changeset/quiet-toes-burn.md b/.changeset/quiet-toes-burn.md new file mode 100644 index 0000000..c18fa61 --- /dev/null +++ b/.changeset/quiet-toes-burn.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-rtl-friendly": minor +--- + +feat: Support BinaryExpression `"..." + "..."` diff --git a/src/rules/no-phyisical-properties/test.ts b/src/rules/no-phyisical-properties/test.ts index a7eb3ab..3d803ed 100644 --- a/src/rules/no-phyisical-properties/test.ts +++ b/src/rules/no-phyisical-properties/test.ts @@ -104,6 +104,12 @@ tester.run("no-physical-properties", noPhysicalProperties, { output: "
", errors: [{ messageId: NO_PHYSICAL_CLASSESS }], }, + { + name: `{"..." + "..."}`, + code: `
`, + output: `
`, + errors: [{messageId: NO_PHYSICAL_CLASSESS}, {messageId: NO_PHYSICAL_CLASSESS}, {messageId: NO_PHYSICAL_CLASSESS}] + }, { name: '{isCondition && "..."}', code: `
`, diff --git a/src/utils/ast.ts b/src/utils/ast.ts index 9b9e919..9bf1dad 100644 --- a/src/utils/ast.ts +++ b/src/utils/ast.ts @@ -121,8 +121,13 @@ function extractTokenFromExpression( }); } + if (is(exp, "BinaryExpression")) { + const right = rerun(exp.right); + if (exp.left.type === "PrivateIdentifier") return right; + return [...right, ...rerun(exp.left)]; + } + // if ( - // is(exp, "BinaryExpression") || // is(exp, "Identifier") || // is(exp, "MemberExpression") || // is(exp, "TaggedTemplateExpression")