@primer/stylelint-config 12.7.1-rc.3de7c40 → 12.7.1-rc.410391d

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 CHANGED
@@ -4,14 +4,22 @@
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - [#338](https://github.com/primer/stylelint-config/pull/338) [`7cc4c08`](https://github.com/primer/stylelint-config/commit/7cc4c08f6465f495df89fc0609d3cdf012480dec) Thanks [@langermank](https://github.com/langermank)! - Add more tests to `no-deprecated-colors`
8
+
7
9
  - [#328](https://github.com/primer/stylelint-config/pull/328) [`5ae7400`](https://github.com/primer/stylelint-config/commit/5ae7400340afc2cd21006093ce7b33206a00372e) Thanks [@langermank](https://github.com/langermank)! - Fix failing tests in no-deprecated-colors
8
10
 
11
+ - [#337](https://github.com/primer/stylelint-config/pull/337) [`6bf0fd6`](https://github.com/primer/stylelint-config/commit/6bf0fd624a69b21e48803ba62a5b2b9dc21b8d8c) Thanks [@langermank](https://github.com/langermank)! - Remove inline fallback var for no-deprecated-colors
12
+
9
13
  - [#332](https://github.com/primer/stylelint-config/pull/332) [`6485cf0`](https://github.com/primer/stylelint-config/commit/6485cf053f502d71a8ce8c407ad01a939038959c) Thanks [@langermank](https://github.com/langermank)! - Updated deprecated json color file
10
14
 
11
15
  - [#333](https://github.com/primer/stylelint-config/pull/333) [`485ce04`](https://github.com/primer/stylelint-config/commit/485ce047d75a635134919678a776ea808604cf4a) Thanks [@langermank](https://github.com/langermank)! - Adding more color replacements for deprecated colors
12
16
 
17
+ - [#340](https://github.com/primer/stylelint-config/pull/340) [`4688bb4`](https://github.com/primer/stylelint-config/commit/4688bb4c0ea7975672b76af8706b80278f00f1a4) Thanks [@langermank](https://github.com/langermank)! - add inlineFallback prop to no-deprecated-colors
18
+
13
19
  - [#322](https://github.com/primer/stylelint-config/pull/322) [`726d7d1`](https://github.com/primer/stylelint-config/commit/726d7d1bf4eac82a032c448cb0be32d5bf66b29a) Thanks [@jonrohan](https://github.com/jonrohan)! - Updating no-deprecated-colors for primitives v8
14
20
 
21
+ - [#334](https://github.com/primer/stylelint-config/pull/334) [`b14c154`](https://github.com/primer/stylelint-config/commit/b14c154174ddd7190e62fe1d26698fc9cfe75c17) Thanks [@langermank](https://github.com/langermank)! - More tests for `no-deprecated-colors`
22
+
15
23
  ## 12.7.0
16
24
 
17
25
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/stylelint-config",
3
- "version": "12.7.1-rc.3de7c40",
3
+ "version": "12.7.1-rc.410391d",
4
4
  "description": "Sharable stylelint config used by GitHub's CSS",
5
5
  "homepage": "http://primer.style/css/tools/linting",
6
6
  "author": "GitHub, Inc.",
@@ -42,9 +42,9 @@
42
42
  "@changesets/cli": "2.26.1",
43
43
  "@github/prettier-config": "0.0.4",
44
44
  "@primer/css": "^20.0.0",
45
- "@primer/primitives": "^7.8.3",
45
+ "@primer/primitives": "^7.11.11",
46
46
  "dedent": "0.7.0",
47
- "eslint": "8.22.0",
47
+ "eslint": "8.39.0",
48
48
  "eslint-plugin-github": "4.3.5",
49
49
  "eslint-plugin-jest": "27.0.1",
50
50
  "eslint-plugin-prettier": "4.2.1",
@@ -219,7 +219,7 @@
219
219
  ],
220
220
  "--color-header-divider": [
221
221
  {
222
- "props": ["border", "background"],
222
+ "props": ["border", "background", "color"],
223
223
  "replacement": "--header-borderColor-divider"
224
224
  }
225
225
  ],
@@ -231,7 +231,7 @@
231
231
  ],
232
232
  "--color-header-search-bg": [
233
233
  {
234
- "props": ["background"],
234
+ "props": ["background", "background-color"],
235
235
  "replacement": "--headerSearch-bgColor"
236
236
  }
237
237
  ],
@@ -249,7 +249,7 @@
249
249
  ],
250
250
  "--color-avatar-border": [
251
251
  {
252
- "props": ["border", "background"],
252
+ "props": ["border", "background", "box-shadow"],
253
253
  "replacement": "--avatar-borderColor"
254
254
  }
255
255
  ],
@@ -727,7 +727,12 @@
727
727
  "replacement": "--control-checked-fgColor-disabled"
728
728
  }
729
729
  ],
730
- "--color-switch-track-checked-border": [],
730
+ "--color-switch-track-checked-border": [
731
+ {
732
+ "props": ["border"],
733
+ "replacement": "--borderColor-transparent"
734
+ }
735
+ ],
731
736
  "--color-switch-knob-bg": [
732
737
  {
733
738
  "props": ["background"],
@@ -806,7 +811,16 @@
806
811
  "replacement": "--treeViewItem-leadingVisual-bgColor-rest"
807
812
  }
808
813
  ],
809
- "--color-canvas-default-transparent": [],
814
+ "--color-canvas-default-transparent": [
815
+ {
816
+ "props": ["background", "color"],
817
+ "replacement": "--bgColor-transparent"
818
+ },
819
+ {
820
+ "props": ["border"],
821
+ "replacement": "--borderColor-transparent"
822
+ }
823
+ ],
810
824
  "--color-fg-default": [
811
825
  {
812
826
  "props": ["color", "fill"],
@@ -821,27 +835,35 @@
821
835
  {
822
836
  "props": ["color", "fill"],
823
837
  "replacement": "--fgColor-muted"
838
+ },
839
+ {
840
+ "props": ["background"],
841
+ "replacement": "--bgColor-neutral-emphasis"
842
+ },
843
+ {
844
+ "props": ["border"],
845
+ "replacement": "--borderColor-neutral-emphasis"
824
846
  }
825
847
  ],
826
848
  "--color-fg-subtle": [
827
849
  {
828
850
  "props": ["color", "fill"],
829
851
  "replacement": "--fgColor-muted"
852
+ },
853
+ {
854
+ "props": ["border"],
855
+ "replacement": "--borderColor-neutral-emphasis"
830
856
  }
831
857
  ],
832
858
  "--color-fg-on-emphasis": [
833
859
  {
834
- "props": ["color", "fill"],
860
+ "props": ["color", "fill", "border"],
835
861
  "replacement": "--fgColor-onEmphasis"
836
862
  }
837
863
  ],
838
864
  "--color-canvas-default": [
839
865
  {
840
- "props": ["background"],
841
- "replacement": "--bgColor-default"
842
- },
843
- {
844
- "props": ["border", "box-shadow"],
866
+ "props": ["background", "border", "box-shadow", "fill", "stroke"],
845
867
  "replacement": "--bgColor-default"
846
868
  }
847
869
  ],
@@ -859,19 +881,19 @@
859
881
  ],
860
882
  "--color-canvas-subtle": [
861
883
  {
862
- "props": ["background"],
884
+ "props": ["background", "fill", "border"],
863
885
  "replacement": "--bgColor-muted"
864
886
  }
865
887
  ],
866
888
  "--color-border-default": [
867
889
  {
868
- "props": ["border", "background", "box-shadow"],
890
+ "props": ["border", "background", "box-shadow", "stroke", "outline", "fill"],
869
891
  "replacement": "--borderColor-default"
870
892
  }
871
893
  ],
872
894
  "--color-border-muted": [
873
895
  {
874
- "props": ["border", "background", "outline"],
896
+ "props": ["border", "background", "outline", "box-shadow", "stroke"],
875
897
  "replacement": "--borderColor-muted"
876
898
  }
877
899
  ],
@@ -883,7 +905,7 @@
883
905
  ],
884
906
  "--color-neutral-emphasis-plus": [
885
907
  {
886
- "props": ["background", "border", "color"],
908
+ "props": ["background", "border", "color", "stroke"],
887
909
  "replacement": "--bgColor-emphasis"
888
910
  }
889
911
  ],
@@ -897,7 +919,7 @@
897
919
  "replacement": "--borderColor-neutral-emphasis"
898
920
  },
899
921
  {
900
- "props": ["color"],
922
+ "props": ["color", "fill"],
901
923
  "replacement": "--fgColor-neutral"
902
924
  }
903
925
  ],
@@ -915,11 +937,15 @@
915
937
  {
916
938
  "props": ["background"],
917
939
  "replacement": "--bgColor-neutral-muted"
940
+ },
941
+ {
942
+ "props": ["border", "box-shadow"],
943
+ "replacement": "--borderColor-neutral-muted"
918
944
  }
919
945
  ],
920
946
  "--color-accent-fg": [
921
947
  {
922
- "props": ["color", "fill"],
948
+ "props": ["color", "fill", "stroke"],
923
949
  "replacement": "--fgColor-accent"
924
950
  },
925
951
  {
@@ -929,6 +955,10 @@
929
955
  {
930
956
  "props": ["background"],
931
957
  "replacement": "--bgColor-accent-emphasis"
958
+ },
959
+ {
960
+ "props": ["outline"],
961
+ "replacement": "--focus-outlineColor"
932
962
  }
933
963
  ],
934
964
  "--color-accent-emphasis": [
@@ -941,8 +971,12 @@
941
971
  "replacement": "--borderColor-accent-emphasis"
942
972
  },
943
973
  {
944
- "props": ["color", "fill"],
974
+ "props": ["color", "fill", "stroke"],
945
975
  "replacement": "--fgColor-accent"
976
+ },
977
+ {
978
+ "props": ["outline"],
979
+ "replacement": "--focus-outlineColor"
946
980
  }
947
981
  ],
948
982
  "--color-accent-muted": [
@@ -959,11 +993,15 @@
959
993
  {
960
994
  "props": ["background"],
961
995
  "replacement": "--bgColor-accent-muted"
996
+ },
997
+ {
998
+ "props": ["border", "box-shadow"],
999
+ "replacement": "--borderColor-accent-muted"
962
1000
  }
963
1001
  ],
964
1002
  "--color-success-fg": [
965
1003
  {
966
- "props": ["color", "fill"],
1004
+ "props": ["color", "fill", "stroke"],
967
1005
  "replacement": "--fgColor-success"
968
1006
  },
969
1007
  {
@@ -989,6 +1027,10 @@
989
1027
  {
990
1028
  "props": ["border", "box-shadow"],
991
1029
  "replacement": "--borderColor-success-muted"
1030
+ },
1031
+ {
1032
+ "props": ["background"],
1033
+ "replacement": "--bgColor-success-muted"
992
1034
  }
993
1035
  ],
994
1036
  "--color-success-subtle": [
@@ -1017,7 +1059,7 @@
1017
1059
  "replacement": "--borderColor-attention-emphasis"
1018
1060
  },
1019
1061
  {
1020
- "props": ["color"],
1062
+ "props": ["color", "fill"],
1021
1063
  "replacement": "--fgColor-attention"
1022
1064
  }
1023
1065
  ],
@@ -1053,7 +1095,7 @@
1053
1095
  "replacement": "--borderColor-severe-emphasis"
1054
1096
  },
1055
1097
  {
1056
- "props": ["color"],
1098
+ "props": ["color", "fill", "stroke"],
1057
1099
  "replacement": "--fgColor-severe"
1058
1100
  }
1059
1101
  ],
@@ -1085,11 +1127,11 @@
1085
1127
  "replacement": "--bgColor-danger-emphasis"
1086
1128
  },
1087
1129
  {
1088
- "props": ["border", "box-shadow"],
1130
+ "props": ["border", "box-shadow", "outline"],
1089
1131
  "replacement": "--borderColor-danger-emphasis"
1090
1132
  },
1091
1133
  {
1092
- "props": ["color"],
1134
+ "props": ["color", "fill"],
1093
1135
  "replacement": "--fgColor-danger"
1094
1136
  }
1095
1137
  ],
@@ -1097,6 +1139,10 @@
1097
1139
  {
1098
1140
  "props": ["border", "box-shadow"],
1099
1141
  "replacement": "--borderColor-danger-muted"
1142
+ },
1143
+ {
1144
+ "props": ["background"],
1145
+ "replacement": "--bgColor-danger-muted"
1100
1146
  }
1101
1147
  ],
1102
1148
  "--color-danger-subtle": [
@@ -1197,7 +1243,7 @@
1197
1243
  "replacement": "--borderColor-done-emphasis"
1198
1244
  },
1199
1245
  {
1200
- "props": ["color"],
1246
+ "props": ["color", "fill", "stroke"],
1201
1247
  "replacement": "--fgColor-done"
1202
1248
  }
1203
1249
  ],
@@ -1205,6 +1251,10 @@
1205
1251
  {
1206
1252
  "props": ["border", "box-shadow"],
1207
1253
  "replacement": "--borderColor-done-muted"
1254
+ },
1255
+ {
1256
+ "props": ["background"],
1257
+ "replacement": "--bgColor-done-muted"
1208
1258
  }
1209
1259
  ],
1210
1260
  "--color-done-subtle": [
@@ -1279,7 +1329,7 @@
1279
1329
  "replacement": "--avatar-shadow"
1280
1330
  }
1281
1331
  ],
1282
- "color-btn-text": [
1332
+ "--color-btn-text": [
1283
1333
  {
1284
1334
  "props": ["color"],
1285
1335
  "replacement": "--button-default-fgColor-rest"
@@ -20,6 +20,8 @@ const replacedVars = {}
20
20
  const newVars = {}
21
21
 
22
22
  module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, context) => {
23
+ const {inlineFallback = false} = options
24
+
23
25
  if (!enabled) {
24
26
  return noop
25
27
  }
@@ -44,14 +46,11 @@ module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, contex
44
46
  }
45
47
 
46
48
  // walk these nodes
47
- if (!(node.type === 'decl' || node.type === 'atrule')) {
49
+ if (node.type !== 'decl') {
48
50
  return
49
51
  }
50
52
 
51
- for (const [, variableName] of matchAll(
52
- node.type === 'atrule' ? node.params : node.value,
53
- variableReferenceRegex
54
- )) {
53
+ for (const [, variableName] of matchAll(node.value, variableReferenceRegex)) {
55
54
  if (variableName in variableChecks) {
56
55
  let replacement = variableChecks[variableName]
57
56
  if (typeof replacement === 'object') {
@@ -70,7 +69,7 @@ module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, contex
70
69
  }
71
70
 
72
71
  if (context.fix && replacement !== null) {
73
- replacement = `${replacement}, var(${variableName})`
72
+ replacement = `${replacement}${inlineFallback ? `, var(${variableName})` : ''}`
74
73
  replacedVars[variableName] = true
75
74
  newVars[replacement] = true
76
75
  if (node.type === 'atrule') {