forked from primer/stylelint-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathborders.js
62 lines (61 loc) · 2.25 KB
/
borders.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const {createVariableRule} = require('./lib/variable-rules')
module.exports = createVariableRule(
'primer/borders',
{
border: {
expects: 'a border variable',
props: 'border{,-top,-right,-bottom,-left}',
values: ['$border', 'none', '0'],
components: ['border-width', 'border-style', 'border-color'],
replacements: {
// because shorthand border properties ¯\_(ツ)_/¯
'$border-width $border-style $border-gray': '$border',
'$border-width $border-gray $border-style': '$border',
'$border-style $border-width $border-gray': '$border',
'$border-style $border-gray $border-width': '$border',
'$border-gray $border-width $border-style': '$border',
'$border-gray $border-style $border-width': '$border',
'$border-width $border-style $border-color': '$border',
'$border-width $border-color $border-style': '$border',
'$border-style $border-width $border-color': '$border',
'$border-style $border-color $border-width': '$border',
'$border-color $border-width $border-style': '$border',
'$border-color $border-style $border-width': '$border'
}
},
'border color': {
expects: 'a border color variable',
props: 'border{,-top,-right,-bottom,-left}-color',
values: [
'$border-*',
'transparent',
'currentColor',
// Match variables in any of the following formats: --color-border-*, --color-*-border-*, --color-*-border
/var\(--color-(.+-)*border(-.+)*\)/,
/var\(--color-[^)]+\)/
],
replacements: {
'$border-gray': '$border-color'
}
},
'border style': {
expects: 'a border style variable',
props: 'border{,-top,-right,-bottom,-left}-style',
values: ['$border-style', 'none']
},
'border width': {
expects: 'a border width variable',
props: 'border{,-top,-right,-bottom,-left}-width',
values: ['$border-width*', '0']
},
'border radius': {
expects: 'a border radius variable',
props: 'border{,-{top,bottom}-{left,right}}-radius',
values: ['$border-radius', '0', '50%', 'inherit'],
replacements: {
'100%': '50%'
}
}
},
'https://primer.style/css/utilities/borders'
)