-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.js
96 lines (86 loc) · 1.6 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
function trbl (prefix) {
const rules = []
if (prefix) {
rules.push(prefix)
prefix = prefix + '-'
} else {
prefix = ''
}
return rules.concat([
prefix + 'top',
prefix + 'right',
prefix + 'bottom',
prefix + 'left'
])
}
function minMax (suffix) {
return [suffix, 'min-' + suffix, 'max-' + suffix]
}
function border (infix) {
if (infix) {
infix = '-' + infix
} else {
infix = ''
}
return [
'border' + infix,
'border' + infix + '-width',
'border' + infix + '-style',
'border' + infix + '-color',
'border' + infix + '-radius'
]
}
const cssModules = []
.concat([
'composes'
])
const reset = ['all']
const positioning = []
.concat([
'position',
'z-index'
])
.concat(trbl())
const displayAndBoxModel = []
.concat([
'display',
'overflow'
])
.concat(minMax('width'))
.concat(minMax('height'))
.concat([
'box-sizing',
'flex',
'flex-basis',
'flex-direction',
'flex-flow',
'flex-grow',
'flex-shrink',
'flex-wrap',
'align-content',
'align-items',
'align-self',
'justify-content',
'order'
])
.concat(trbl('padding'))
.concat([]
.concat(border())
.concat(border('top'))
.concat(border('right'))
.concat(border('bottom'))
.concat(border('left')))
.concat(trbl('margin'))
module.exports = {
plugins: 'stylelint-order',
rules: {
'order/properties-order': [
[]
.concat(cssModules)
.concat(reset)
.concat(positioning)
.concat(displayAndBoxModel),
{ unspecified: 'bottomAlphabetical' }
]
}
}