Skip to content

Commit 81715ba

Browse files
committed
fix(no-unlocalized-strings): ignore SVG technical attributes
Add common SVG attributes to ignore list: transform, gradientTransform, patternTransform, preserveAspectRatio, clipPath, filter, mask, marker*, strokeDasharray, strokeLinecap, strokeLinejoin, fillRule, clipRule. These attributes contain technical values, not user-visible text.
1 parent 17f9285 commit 81715ba

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/rules/no-unlocalized-strings.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ ruleTester.run("no-unlocalized-strings", noUnlocalizedStrings, {
389389
{ code: '<svg viewBox="0 0 20 40"></svg>', filename: "test.tsx" },
390390
{ code: '<path d="M10 10" />', filename: "test.tsx" },
391391
{ code: '<circle cx="10" cy="10" r="2" fill="red" />', filename: "test.tsx" },
392+
{ code: '<g transform="translate(10, 20) rotate(45)" />', filename: "test.tsx" },
393+
{ code: '<svg preserveAspectRatio="xMidYMid meet" />', filename: "test.tsx" },
394+
{ code: '<linearGradient gradientTransform="rotate(90)" />', filename: "test.tsx" },
395+
{ code: '<path strokeDasharray="5 10" strokeLinecap="round" />', filename: "test.tsx" },
392396

393397
// Computed member expressions (object keys)
394398
{ code: 'obj["key with spaces"] = value', filename: "test.tsx" },

src/rules/no-unlocalized-strings.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,23 @@ const DEFAULT_IGNORE_PROPERTIES = [
4343
// React key prop
4444
"key",
4545
// Testing ID - DOM Testing Library standard
46-
"data-testid"
46+
"data-testid",
47+
// SVG attributes with technical string values
48+
"transform",
49+
"gradientTransform",
50+
"patternTransform",
51+
"preserveAspectRatio",
52+
"clipPath",
53+
"filter",
54+
"mask",
55+
"markerStart",
56+
"markerMid",
57+
"markerEnd",
58+
"strokeDasharray",
59+
"strokeLinecap",
60+
"strokeLinejoin",
61+
"fillRule",
62+
"clipRule"
4763
]
4864

4965
/**

0 commit comments

Comments
 (0)