Skip to content

Commit ffe199b

Browse files
committed
refactor(no-unlocalized-strings): remove plural forms from suffix pattern
- Plural forms (Colors, Styles, etc.) were too risky for false positives - classNames is handled via explicit default ignore list - Other plural cases can be configured manually via ignoreProperties
1 parent 20eb965 commit ffe199b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,8 @@ ruleTester.run("no-unlocalized-strings", noUnlocalizedStrings, {
134134
/>`,
135135
filename: "test.tsx"
136136
},
137-
// Plural styling properties
137+
// classNames is in default ignore list (not a suffix pattern)
138138
{ code: '<Calendar classNames={{ day: "bg-white", cell: "p-2" }} />', filename: "test.tsx" },
139-
{ code: '({ buttonColors: { primary: "#0000ff", secondary: "#cccccc" } })', filename: "test.tsx" },
140139
// Color properties
141140
{ code: '<Box backgroundColor="#ff0000" />', filename: "test.tsx" },
142141
{ code: '<Text textColor="red-500" />', filename: "test.tsx" },

src/rules/no-unlocalized-strings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function isErrorConstructorArgument(
490490
const CAMEL_CASE_PATTERN = /^[a-z]+([A-Z][a-z]+)+$/
491491

492492
/** Technical suffixes with at least one lowercase char before (ensures prefix exists) */
493-
const STYLING_SUFFIX_PATTERN = /[a-z](ClassNames?|Class|Colors?|Styles?|Icons?|Images?|Sizes?|Ids?)$/
493+
const STYLING_SUFFIX_PATTERN = /[a-z](ClassName|Class|Color|Style|Icon|Image|Size|Id)$/
494494

495495
/**
496496
* Checks if a property name is a styling/technical property.

0 commit comments

Comments
 (0)