@primer/stylelint-config 0.0.0-20230615215421 → 0.0.0-20230620172018
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/package.json +1 -1
- package/plugins/borders.js +2 -4
- package/plugins/box-shadow.js +2 -4
- package/plugins/colors.js +4 -10
- package/plugins/no-deprecated-colors.js +3 -1
package/package.json
CHANGED
package/plugins/borders.js
CHANGED
|
@@ -31,11 +31,9 @@ module.exports = createVariableRule(
|
|
|
31
31
|
'$border-*',
|
|
32
32
|
'transparent',
|
|
33
33
|
'currentColor',
|
|
34
|
-
// Match variables in any of the following formats: --color-border-*, --color-*-border-*, --color-*-border
|
|
34
|
+
// Match variables in any of the following formats: --color-border-*, --color-*-border-*, --color-*-border
|
|
35
35
|
/var\(--color-(.+-)*border(-.+)*\)/,
|
|
36
|
-
/var\(--color-[^)]+\)
|
|
37
|
-
/var\(--borderColor-[^)]+\)/,
|
|
38
|
-
/var\((.+-)*borderColor(-.+)*\)/
|
|
36
|
+
/var\(--color-[^)]+\)/
|
|
39
37
|
],
|
|
40
38
|
replacements: {
|
|
41
39
|
'$border-gray': '$border-color'
|
package/plugins/box-shadow.js
CHANGED
|
@@ -10,10 +10,8 @@ module.exports = createVariableRule(
|
|
|
10
10
|
'$box-shadow*',
|
|
11
11
|
'$*-shadow',
|
|
12
12
|
'none',
|
|
13
|
-
// Match variables in any of the following formats: --color-shadow-*, --color-*-shadow-*, --color-*-shadow
|
|
14
|
-
/var\(--color-(.+-)*shadow(-.+)*\)
|
|
15
|
-
/var\(--shadow(-.+)*\)/,
|
|
16
|
-
/var\((.+-)*shadow(-.+)*\)/
|
|
13
|
+
// Match variables in any of the following formats: --color-shadow-*, --color-*-shadow-*, --color-*-shadow
|
|
14
|
+
/var\(--color-(.+-)*shadow(-.+)*\)/
|
|
17
15
|
],
|
|
18
16
|
singular: true
|
|
19
17
|
}
|
package/plugins/colors.js
CHANGED
|
@@ -3,13 +3,9 @@ const {createVariableRule} = require('./lib/variable-rules')
|
|
|
3
3
|
const bgVars = [
|
|
4
4
|
'$bg-*',
|
|
5
5
|
'$tooltip-background-color',
|
|
6
|
-
// Match variables in any of the following formats: --color-bg-*, --color-*-bg-*, --color-*-bg
|
|
6
|
+
// Match variables in any of the following formats: --color-bg-*, --color-*-bg-*, --color-*-bg
|
|
7
7
|
/var\(--color-(.+-)*bg(-.+)*\)/,
|
|
8
|
-
/var\(--color-[^)]+\)
|
|
9
|
-
/var\((.+-)*bgColor(-.+)*\)/,
|
|
10
|
-
/var\((.+-)*fgColor(-.+)*\)/,
|
|
11
|
-
/var\((.+-)*borderColor(-.+)*\)/,
|
|
12
|
-
/var\((.+-)*iconColor(-.+)*\)/
|
|
8
|
+
/var\(--color-[^)]+\)/
|
|
13
9
|
]
|
|
14
10
|
|
|
15
11
|
module.exports = createVariableRule(
|
|
@@ -30,12 +26,10 @@ module.exports = createVariableRule(
|
|
|
30
26
|
'$text-*',
|
|
31
27
|
'$tooltip-text-color',
|
|
32
28
|
'inherit',
|
|
33
|
-
// Match variables in any of the following formats: --color-text-*, --color-*-text-*, --color-*-text
|
|
29
|
+
// Match variables in any of the following formats: --color-text-*, --color-*-text-*, --color-*-text
|
|
34
30
|
/var\(--color-(.+-)*text(-.+)*\)/,
|
|
35
31
|
/var\(--color-(.+-)*fg(-.+)*\)/,
|
|
36
|
-
/var\(--color-[^)]+\)
|
|
37
|
-
/var\((.+-)*fgColor(-.+)*\)/,
|
|
38
|
-
/var\((.+-)*iconColor(-.+)*\)/
|
|
32
|
+
/var\(--color-[^)]+\)/
|
|
39
33
|
]
|
|
40
34
|
}
|
|
41
35
|
},
|
|
@@ -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
|
}
|
|
@@ -67,7 +69,7 @@ module.exports = stylelint.createPlugin(ruleName, (enabled, options = {}, contex
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
if (context.fix && replacement !== null) {
|
|
70
|
-
replacement = `${replacement}`
|
|
72
|
+
replacement = `${replacement}${inlineFallback ? `, var(${variableName})` : ''}`
|
|
71
73
|
replacedVars[variableName] = true
|
|
72
74
|
newVars[replacement] = true
|
|
73
75
|
if (node.type === 'atrule') {
|