guard-my-design-system 1.3.4 → 1.3.5

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/README.md CHANGED
@@ -36,7 +36,9 @@ it updates that same comment. It never adds more comments:
36
36
  ## What it catches
37
37
 
38
38
  - **A hard-coded colour where a token exists.** The finding names the token:
39
- `var(--blue-500)`, not just a hex code.
39
+ `var(--blue-500)`, not just a hex code. This works across colour notations:
40
+ a hex stray is matched to an hsl or oklch token, including shadcn's
41
+ bare-triplet variables.
40
42
  - **A spacing value your codebase has never used**, with the nearest existing
41
43
  step named.
42
44
  - **A border radius, font size or shadow your system does not declare**, with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guard-my-design-system",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Your design system dies one pull request at a time. This makes sure it doesn't. A guard that judges only the lines a change adds, against the system the repo already has, and names the on-system value the author probably meant.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "src/"
12
12
  ],
13
13
  "dependencies": {
14
- "roast-my-design-system": "5.7.2"
14
+ "roast-my-design-system": "5.10.2"
15
15
  },
16
16
  "keywords": [
17
17
  "design-system",
package/src/judge.mjs CHANGED
@@ -90,7 +90,10 @@ export function judge(added, system) {
90
90
  // "use var(--blue-500)", not "go hunt this hex": name a value when the
91
91
  // system defines it as a custom property.
92
92
  const named = (value) => {
93
- const n = system.tokenNames?.[value];
93
+ // shadcn-style tokens are defined as bare triplets (--primary: 222.2 47.4%
94
+ // 11.2%) but normalised to hsl(...); try the unwrapped form too.
95
+ const n = system.tokenNames?.[value]
96
+ ?? system.tokenNames?.[value.replace(/^hsla?\((.*)\)$/i, '$1')];
94
97
  return n ? `var(${n}), ${value}` : value;
95
98
  };
96
99
  const faceCounts = new Map();