Skip to content

Commit

Permalink
Add more tests to no-deprecated-colors (#338)
Browse files Browse the repository at this point in the history
* few more additions

* Create cool-turtles-know.md

* more testing in dotcom

* facepalm
  • Loading branch information
langermank committed Jun 15, 2023
1 parent 6bf0fd6 commit 7cc4c08
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-turtles-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/stylelint-config": patch
---

Add more tests to `no-deprecated-colors`
7 changes: 7 additions & 0 deletions __tests__/no-deprecated-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ testRule({
line: 1,
column: 6
},
{
code: '.x { border: var(--borderWidth-thin) solid var(--color-border-default); }',
fixed: '.x { border: var(--borderWidth-thin) solid var(--borderColor-default); }',
message: `Variable --color-border-default is deprecated for property border. Please use the replacement --borderColor-default. (primer/no-deprecated-colors)`,
line: 1,
column: 6
},
{
code: '.x { border-color: var(--color-canvas-default-transparent); }',
fixed: '.x { border-color: var(--borderColor-transparent); }',
Expand Down
74 changes: 51 additions & 23 deletions plugins/lib/primitives-v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
],
"--color-header-divider": [
{
"props": ["border", "background"],
"props": ["border", "background", "color"],
"replacement": "--header-borderColor-divider"
}
],
Expand All @@ -231,7 +231,7 @@
],
"--color-header-search-bg": [
{
"props": ["background"],
"props": ["background", "background-color"],
"replacement": "--headerSearch-bgColor"
}
],
Expand All @@ -249,7 +249,7 @@
],
"--color-avatar-border": [
{
"props": ["border", "background"],
"props": ["border", "background", "box-shadow"],
"replacement": "--avatar-borderColor"
}
],
Expand Down Expand Up @@ -813,7 +813,7 @@
],
"--color-canvas-default-transparent": [
{
"props": ["background"],
"props": ["background", "color"],
"replacement": "--bgColor-transparent"
},
{
Expand All @@ -839,6 +839,10 @@
{
"props": ["background"],
"replacement": "--bgColor-neutral-emphasis"
},
{
"props": ["border"],
"replacement": "--borderColor-neutral-emphasis"
}
],
"--color-fg-subtle": [
Expand All @@ -859,11 +863,7 @@
],
"--color-canvas-default": [
{
"props": ["background"],
"replacement": "--bgColor-default"
},
{
"props": ["border", "box-shadow"],
"props": ["background", "border", "box-shadow", "fill", "stroke"],
"replacement": "--bgColor-default"
}
],
Expand All @@ -881,19 +881,19 @@
],
"--color-canvas-subtle": [
{
"props": ["background"],
"props": ["background", "fill", "border"],
"replacement": "--bgColor-muted"
}
],
"--color-border-default": [
{
"props": ["border", "background", "box-shadow"],
"props": ["border", "background", "box-shadow", "stroke", "outline", "fill"],
"replacement": "--borderColor-default"
}
],
"--color-border-muted": [
{
"props": ["border", "background", "outline", "box-shadow"],
"props": ["border", "background", "outline", "box-shadow", "stroke"],
"replacement": "--borderColor-muted"
}
],
Expand All @@ -905,7 +905,7 @@
],
"--color-neutral-emphasis-plus": [
{
"props": ["background", "border", "color"],
"props": ["background", "border", "color", "stroke"],
"replacement": "--bgColor-emphasis"
}
],
Expand All @@ -919,7 +919,7 @@
"replacement": "--borderColor-neutral-emphasis"
},
{
"props": ["color"],
"props": ["color", "fill"],
"replacement": "--fgColor-neutral"
}
],
Expand All @@ -937,11 +937,15 @@
{
"props": ["background"],
"replacement": "--bgColor-neutral-muted"
},
{
"props": ["border", "box-shadow"],
"replacement": "--borderColor-neutral-muted"
}
],
"--color-accent-fg": [
{
"props": ["color", "fill"],
"props": ["color", "fill", "stroke"],
"replacement": "--fgColor-accent"
},
{
Expand All @@ -951,6 +955,10 @@
{
"props": ["background"],
"replacement": "--bgColor-accent-emphasis"
},
{
"props": ["outline"],
"replacement": "--focus-outlineColor"
}
],
"--color-accent-emphasis": [
Expand All @@ -963,8 +971,12 @@
"replacement": "--borderColor-accent-emphasis"
},
{
"props": ["color", "fill"],
"props": ["color", "fill", "stroke"],
"replacement": "--fgColor-accent"
},
{
"props": ["outline"],
"replacement": "--focus-outlineColor"
}
],
"--color-accent-muted": [
Expand All @@ -981,11 +993,15 @@
{
"props": ["background"],
"replacement": "--bgColor-accent-muted"
},
{
"props": ["border", "box-shadow"],
"replacement": "--borderColor-accent-muted"
}
],
"--color-success-fg": [
{
"props": ["color", "fill"],
"props": ["color", "fill", "stroke"],
"replacement": "--fgColor-success"
},
{
Expand All @@ -1011,6 +1027,10 @@
{
"props": ["border", "box-shadow"],
"replacement": "--borderColor-success-muted"
},
{
"props": ["background"],
"replacement": "--bgColor-success-muted"
}
],
"--color-success-subtle": [
Expand Down Expand Up @@ -1039,7 +1059,7 @@
"replacement": "--borderColor-attention-emphasis"
},
{
"props": ["color"],
"props": ["color", "fill"],
"replacement": "--fgColor-attention"
}
],
Expand Down Expand Up @@ -1075,7 +1095,7 @@
"replacement": "--borderColor-severe-emphasis"
},
{
"props": ["color"],
"props": ["color", "fill", "stroke"],
"replacement": "--fgColor-severe"
}
],
Expand Down Expand Up @@ -1107,18 +1127,22 @@
"replacement": "--bgColor-danger-emphasis"
},
{
"props": ["border", "box-shadow"],
"props": ["border", "box-shadow", "outline"],
"replacement": "--borderColor-danger-emphasis"
},
{
"props": ["color"],
"props": ["color", "fill"],
"replacement": "--fgColor-danger"
}
],
"--color-danger-muted": [
{
"props": ["border", "box-shadow"],
"replacement": "--borderColor-danger-muted"
},
{
"props": ["background"],
"replacement": "--bgColor-danger-muted"
}
],
"--color-danger-subtle": [
Expand Down Expand Up @@ -1219,14 +1243,18 @@
"replacement": "--borderColor-done-emphasis"
},
{
"props": ["color"],
"props": ["color", "fill", "stroke"],
"replacement": "--fgColor-done"
}
],
"--color-done-muted": [
{
"props": ["border", "box-shadow"],
"replacement": "--borderColor-done-muted"
},
{
"props": ["background"],
"replacement": "--bgColor-done-muted"
}
],
"--color-done-subtle": [
Expand Down Expand Up @@ -1301,7 +1329,7 @@
"replacement": "--avatar-shadow"
}
],
"color-btn-text": [
"--color-btn-text": [
{
"props": ["color"],
"replacement": "--button-default-fgColor-rest"
Expand Down

0 comments on commit 7cc4c08

Please sign in to comment.