eslint-plugin-code-style 1.9.3 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/index.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.9.4] - 2026-02-03
|
|
11
|
+
|
|
12
|
+
### Enhanced
|
|
13
|
+
|
|
14
|
+
- **`no-hardcoded-strings`** - Skip UI component patterns only in JSX attributes:
|
|
15
|
+
- In JSX attributes: `<Button variant="ghost" />` is now ignored
|
|
16
|
+
- In logic: `const status = "success"` or `setValue("primary")` is still detected
|
|
17
|
+
- UI patterns: `primary`, `secondary`, `ghost`, `outline`, `link`, `muted`, `danger`, `warning`, `success`, `error`, `sm`, `md`, `lg`, `xl`, `left`, `right`, `center`, `top`, `bottom`, `hover`, `focus`, `click`, etc.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
10
21
|
## [1.9.3] - 2026-02-03
|
|
11
22
|
|
|
12
23
|
### Enhanced
|
|
@@ -1288,6 +1299,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1288
1299
|
|
|
1289
1300
|
---
|
|
1290
1301
|
|
|
1302
|
+
[1.9.4]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.9.3...v1.9.4
|
|
1291
1303
|
[1.9.3]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.9.2...v1.9.3
|
|
1292
1304
|
[1.9.2]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.9.1...v1.9.2
|
|
1293
1305
|
[1.9.1]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.9.0...v1.9.1
|
package/index.js
CHANGED
|
@@ -14090,6 +14090,9 @@ const noHardcodedStrings = {
|
|
|
14090
14090
|
|
|
14091
14091
|
const allIgnorePatterns = [...technicalPatterns, ...extraIgnorePatterns];
|
|
14092
14092
|
|
|
14093
|
+
// UI component patterns - only ignored in JSX attributes, not in logic
|
|
14094
|
+
const uiComponentPattern = /^(primary|secondary|tertiary|ghost|outline|link|muted|danger|warning|info|success|error|default|subtle|solid|soft|plain|flat|elevated|filled|tonal|text|contained|standard|xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|xxs|xxl|small|medium|large|tiny|huge|compact|comfortable|spacious|left|right|center|top|bottom|start|end|middle|baseline|stretch|between|around|evenly|horizontal|vertical|row|column|inline|block|flex|grid|auto|none|hidden|visible|static|relative|absolute|fixed|sticky|on|off|hover|focus|click|blur|always|never)$/;
|
|
14095
|
+
|
|
14093
14096
|
// HTTP status codes that should NOT be hardcoded (2xx, 4xx, and 5xx)
|
|
14094
14097
|
const httpStatusCodePattern = /^[245]\d{2}$/;
|
|
14095
14098
|
|
|
@@ -14545,6 +14548,9 @@ const noHardcodedStrings = {
|
|
|
14545
14548
|
if (node.value.type === "Literal" && typeof node.value.value === "string") {
|
|
14546
14549
|
const str = node.value.value;
|
|
14547
14550
|
|
|
14551
|
+
// Skip UI component patterns in JSX attributes (variant, size, position props)
|
|
14552
|
+
if (uiComponentPattern.test(str)) return;
|
|
14553
|
+
|
|
14548
14554
|
// Check if it's a flagged special string (status code, role name)
|
|
14549
14555
|
const isSpecialString = isFlaggedSpecialStringHandler(str);
|
|
14550
14556
|
|
|
@@ -14569,6 +14575,9 @@ const noHardcodedStrings = {
|
|
|
14569
14575
|
if (expression.type === "Literal" && typeof expression.value === "string") {
|
|
14570
14576
|
const str = expression.value;
|
|
14571
14577
|
|
|
14578
|
+
// Skip UI component patterns in JSX attributes (variant, size, position props)
|
|
14579
|
+
if (uiComponentPattern.test(str)) return;
|
|
14580
|
+
|
|
14572
14581
|
// Check if it's a flagged special string (status code, role name)
|
|
14573
14582
|
const isSpecialString = isFlaggedSpecialStringHandler(str);
|
|
14574
14583
|
|
package/package.json
CHANGED