@antebudimir/eslint-plugin-vanilla-extract 1.4.6 → 1.5.0
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/README.md +12 -3
- package/dist/css-rules/alphabetical-order/recipe-order-enforcer.js +3 -4
- package/dist/css-rules/alphabetical-order/style-object-processor.js +7 -8
- package/dist/css-rules/concentric-order/property-order-enforcer.js +10 -11
- package/dist/css-rules/concentric-order/recipe-order-enforcer.js +3 -4
- package/dist/css-rules/concentric-order/style-object-processor.js +13 -14
- package/dist/css-rules/custom-order/property-order-enforcer.js +51 -46
- package/dist/css-rules/custom-order/recipe-order-enforcer.js +3 -4
- package/dist/css-rules/custom-order/rule-definition.js +3 -1
- package/dist/css-rules/custom-order/style-object-processor.js +25 -26
- package/dist/css-rules/shared-utils/order-strategy-visitor-creator.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/css-rules/alphabetical-order/__tests__/animation.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/animation.test.js +0 -108
- package/dist/css-rules/alphabetical-order/__tests__/font-face.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/font-face.test.js +0 -138
- package/dist/css-rules/alphabetical-order/__tests__/global.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/global.test.js +0 -51
- package/dist/css-rules/alphabetical-order/__tests__/recipe.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/recipe.test.js +0 -91
- package/dist/css-rules/alphabetical-order/__tests__/style.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/style.test.js +0 -108
- package/dist/css-rules/alphabetical-order/__tests__/variants.test.d.ts +0 -1
- package/dist/css-rules/alphabetical-order/__tests__/variants.test.js +0 -63
- package/dist/css-rules/concentric-order/__tests__/animation.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/animation.test.js +0 -69
- package/dist/css-rules/concentric-order/__tests__/font-face.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/font-face.test.js +0 -94
- package/dist/css-rules/concentric-order/__tests__/global.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/global.test.js +0 -57
- package/dist/css-rules/concentric-order/__tests__/recipe.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/recipe.test.js +0 -100
- package/dist/css-rules/concentric-order/__tests__/style.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/style.test.js +0 -126
- package/dist/css-rules/concentric-order/__tests__/variants.test.d.ts +0 -1
- package/dist/css-rules/concentric-order/__tests__/variants.test.js +0 -133
- package/dist/css-rules/custom-order/__tests__/animation.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/animation.test.js +0 -148
- package/dist/css-rules/custom-order/__tests__/font-face.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/font-face.test.js +0 -124
- package/dist/css-rules/custom-order/__tests__/global.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/global.test.js +0 -124
- package/dist/css-rules/custom-order/__tests__/recipe.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/recipe.test.js +0 -208
- package/dist/css-rules/custom-order/__tests__/style.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/style.test.js +0 -249
- package/dist/css-rules/custom-order/__tests__/variants.test.d.ts +0 -1
- package/dist/css-rules/custom-order/__tests__/variants.test.js +0 -184
- package/dist/css-rules/shared-utils/__tests__/css-property-priority-map.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/css-property-priority-map.test.js +0 -37
- package/dist/css-rules/shared-utils/__tests__/font-face-property-order-enforcer.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/font-face-property-order-enforcer.test.js +0 -58
- package/dist/css-rules/shared-utils/__tests__/order-strategy-visitor-creator.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/order-strategy-visitor-creator.test.js +0 -125
- package/dist/css-rules/shared-utils/__tests__/property-name-extractor.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/property-name-extractor.test.js +0 -53
- package/dist/css-rules/shared-utils/__tests__/recipe-property-processor.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/recipe-property-processor.test.js +0 -116
- package/dist/css-rules/shared-utils/__tests__/style-node-processor.test.d.ts +0 -1
- package/dist/css-rules/shared-utils/__tests__/style-node-processor.test.js +0 -55
- package/dist/css-rules/shared-utils/__tests__/test-property-name-rule.d.ts +0 -3
- package/dist/css-rules/shared-utils/__tests__/test-property-name-rule.js +0 -30
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import customGroupOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/custom-order/recipe',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Recipe with custom group ordering (concentric for remaining)
|
|
16
|
-
{
|
|
17
|
-
code: `
|
|
18
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
19
|
-
|
|
20
|
-
const myRecipe = recipe({
|
|
21
|
-
base: {
|
|
22
|
-
width: '100%',
|
|
23
|
-
margin: 0,
|
|
24
|
-
position: 'relative',
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
backgroundColor: 'white'
|
|
28
|
-
},
|
|
29
|
-
variants: {
|
|
30
|
-
color: {
|
|
31
|
-
blue: {
|
|
32
|
-
position: 'relative',
|
|
33
|
-
backgroundColor: 'blue',
|
|
34
|
-
color: 'white'
|
|
35
|
-
},
|
|
36
|
-
red: {
|
|
37
|
-
position: 'relative',
|
|
38
|
-
backgroundColor: 'red',
|
|
39
|
-
color: 'black'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
`,
|
|
45
|
-
options: [
|
|
46
|
-
{
|
|
47
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
48
|
-
sortRemainingProperties: 'concentric',
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
// Recipe with custom group ordering (alphabetical for remaining)
|
|
53
|
-
{
|
|
54
|
-
code: `
|
|
55
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
56
|
-
|
|
57
|
-
const myRecipe = recipe({
|
|
58
|
-
base: {
|
|
59
|
-
width: '100%',
|
|
60
|
-
margin: 0,
|
|
61
|
-
alignItems: 'center',
|
|
62
|
-
backgroundColor: 'white',
|
|
63
|
-
display: 'flex',
|
|
64
|
-
position: 'relative'
|
|
65
|
-
},
|
|
66
|
-
variants: {
|
|
67
|
-
color: {
|
|
68
|
-
blue: {
|
|
69
|
-
backgroundColor: 'blue',
|
|
70
|
-
color: 'white',
|
|
71
|
-
position: 'relative'
|
|
72
|
-
},
|
|
73
|
-
red: {
|
|
74
|
-
backgroundColor: 'red',
|
|
75
|
-
color: 'black',
|
|
76
|
-
position: 'relative'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
`,
|
|
82
|
-
options: [
|
|
83
|
-
{
|
|
84
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
85
|
-
sortRemainingProperties: 'alphabetical',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
invalid: [
|
|
91
|
-
// Recipe with incorrect ordering (concentric for remaining)
|
|
92
|
-
{
|
|
93
|
-
code: `
|
|
94
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
95
|
-
const myRecipe = recipe({
|
|
96
|
-
base: {
|
|
97
|
-
backgroundColor: 'white',
|
|
98
|
-
width: '100%',
|
|
99
|
-
display: 'flex',
|
|
100
|
-
alignItems: 'center',
|
|
101
|
-
margin: 0
|
|
102
|
-
},
|
|
103
|
-
variants: {
|
|
104
|
-
color: {
|
|
105
|
-
blue: {
|
|
106
|
-
color: 'white',
|
|
107
|
-
backgroundColor: 'blue',
|
|
108
|
-
position: 'relative'
|
|
109
|
-
},
|
|
110
|
-
red: {
|
|
111
|
-
color: 'black',
|
|
112
|
-
backgroundColor: 'red',
|
|
113
|
-
position: 'relative'
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
`,
|
|
119
|
-
options: [
|
|
120
|
-
{
|
|
121
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
122
|
-
sortRemainingProperties: 'concentric',
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
126
|
-
output: `
|
|
127
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
128
|
-
const myRecipe = recipe({
|
|
129
|
-
base: {
|
|
130
|
-
width: '100%',
|
|
131
|
-
margin: 0,
|
|
132
|
-
display: 'flex',
|
|
133
|
-
alignItems: 'center',
|
|
134
|
-
backgroundColor: 'white'
|
|
135
|
-
},
|
|
136
|
-
variants: {
|
|
137
|
-
color: {
|
|
138
|
-
blue: {
|
|
139
|
-
position: 'relative',
|
|
140
|
-
backgroundColor: 'blue',
|
|
141
|
-
color: 'white'
|
|
142
|
-
},
|
|
143
|
-
red: {
|
|
144
|
-
position: 'relative',
|
|
145
|
-
backgroundColor: 'red',
|
|
146
|
-
color: 'black'
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
`,
|
|
152
|
-
},
|
|
153
|
-
// Recipe with incorrect ordering (alphabetical for remaining)
|
|
154
|
-
{
|
|
155
|
-
code: `
|
|
156
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
157
|
-
const myRecipe = recipe({
|
|
158
|
-
base: {
|
|
159
|
-
position: 'relative',
|
|
160
|
-
display: 'flex',
|
|
161
|
-
alignItems: 'center',
|
|
162
|
-
backgroundColor: 'white',
|
|
163
|
-
width: '100%',
|
|
164
|
-
margin: 0
|
|
165
|
-
},
|
|
166
|
-
variants: {
|
|
167
|
-
color: {
|
|
168
|
-
blue: {
|
|
169
|
-
position: 'relative',
|
|
170
|
-
backgroundColor: 'blue',
|
|
171
|
-
color: 'white'
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
`,
|
|
177
|
-
options: [
|
|
178
|
-
{
|
|
179
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
180
|
-
sortRemainingProperties: 'alphabetical',
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
184
|
-
output: `
|
|
185
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
186
|
-
const myRecipe = recipe({
|
|
187
|
-
base: {
|
|
188
|
-
width: '100%',
|
|
189
|
-
margin: 0,
|
|
190
|
-
alignItems: 'center',
|
|
191
|
-
backgroundColor: 'white',
|
|
192
|
-
display: 'flex',
|
|
193
|
-
position: 'relative'
|
|
194
|
-
},
|
|
195
|
-
variants: {
|
|
196
|
-
color: {
|
|
197
|
-
blue: {
|
|
198
|
-
backgroundColor: 'blue',
|
|
199
|
-
color: 'white',
|
|
200
|
-
position: 'relative'
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
`,
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import customGroupOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/custom-order/style',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Style with custom group ordering (dimensions, margin, font, border, boxShadow)
|
|
16
|
-
{
|
|
17
|
-
code: `
|
|
18
|
-
import { style } from '@vanilla-extract/css';
|
|
19
|
-
const myStyle = style({
|
|
20
|
-
// dimensions group first
|
|
21
|
-
width: '10rem',
|
|
22
|
-
minWidth: '5rem',
|
|
23
|
-
height: '10rem',
|
|
24
|
-
maxHeight: '20rem',
|
|
25
|
-
|
|
26
|
-
// margin group second
|
|
27
|
-
margin: '1rem',
|
|
28
|
-
marginTop: '0.5rem',
|
|
29
|
-
|
|
30
|
-
// font group third
|
|
31
|
-
fontFamily: 'sans-serif',
|
|
32
|
-
fontSize: '1rem',
|
|
33
|
-
fontWeight: 'bold',
|
|
34
|
-
|
|
35
|
-
// border group fourth
|
|
36
|
-
border: '1px solid black',
|
|
37
|
-
borderRadius: '4px',
|
|
38
|
-
|
|
39
|
-
// boxShadow group fifth
|
|
40
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
41
|
-
|
|
42
|
-
// remaining properties in concentric order
|
|
43
|
-
position: 'relative',
|
|
44
|
-
display: 'flex',
|
|
45
|
-
backgroundColor: 'red',
|
|
46
|
-
padding: '2rem',
|
|
47
|
-
color: 'blue'
|
|
48
|
-
});
|
|
49
|
-
`,
|
|
50
|
-
options: [
|
|
51
|
-
{
|
|
52
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
53
|
-
sortRemainingProperties: 'concentric',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
// Style with nested selectors following custom group ordering
|
|
58
|
-
{
|
|
59
|
-
code: `
|
|
60
|
-
import { style } from '@vanilla-extract/css';
|
|
61
|
-
const myStyle = style({
|
|
62
|
-
width: '10rem',
|
|
63
|
-
margin: '1rem',
|
|
64
|
-
fontFamily: 'sans-serif',
|
|
65
|
-
border: '1px solid black',
|
|
66
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
67
|
-
position: 'relative',
|
|
68
|
-
backgroundColor: 'red',
|
|
69
|
-
selectors: {
|
|
70
|
-
'&:hover': {
|
|
71
|
-
width: '12rem',
|
|
72
|
-
margin: '12px',
|
|
73
|
-
fontSize: '1rem',
|
|
74
|
-
borderColor: 'blue',
|
|
75
|
-
boxShadow: '0 4px 8px rgba(0,0,0,0.2)',
|
|
76
|
-
position: 'relative',
|
|
77
|
-
backgroundColor: 'blue',
|
|
78
|
-
color: 'white'
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
`,
|
|
83
|
-
options: [
|
|
84
|
-
{
|
|
85
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
86
|
-
sortRemainingProperties: 'concentric',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
code: `
|
|
92
|
-
import { style } from '@vanilla-extract/css';
|
|
93
|
-
const myStyle = style({
|
|
94
|
-
// dimensions group first
|
|
95
|
-
width: '10rem',
|
|
96
|
-
height: '10rem',
|
|
97
|
-
|
|
98
|
-
// margin group second
|
|
99
|
-
margin: '1rem',
|
|
100
|
-
|
|
101
|
-
// font group third
|
|
102
|
-
fontFamily: 'sans-serif',
|
|
103
|
-
|
|
104
|
-
// border group fourth
|
|
105
|
-
border: '1px solid black',
|
|
106
|
-
|
|
107
|
-
// boxShadow group fifth
|
|
108
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
109
|
-
|
|
110
|
-
// remaining properties in alphabetical order
|
|
111
|
-
backgroundColor: 'red',
|
|
112
|
-
color: 'blue',
|
|
113
|
-
display: 'flex',
|
|
114
|
-
padding: '2rem',
|
|
115
|
-
position: 'relative'
|
|
116
|
-
});
|
|
117
|
-
`,
|
|
118
|
-
options: [
|
|
119
|
-
{
|
|
120
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
121
|
-
sortRemainingProperties: 'alphabetical',
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
invalid: [
|
|
127
|
-
// Style with incorrect custom group ordering
|
|
128
|
-
{
|
|
129
|
-
code: `
|
|
130
|
-
import { style } from '@vanilla-extract/css';
|
|
131
|
-
const myStyle = style({
|
|
132
|
-
position: 'relative',
|
|
133
|
-
border: '1px solid black',
|
|
134
|
-
width: '10rem',
|
|
135
|
-
color: 'blue',
|
|
136
|
-
margin: '1rem',
|
|
137
|
-
fontFamily: 'sans-serif',
|
|
138
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
139
|
-
backgroundColor: 'red'
|
|
140
|
-
});
|
|
141
|
-
`,
|
|
142
|
-
options: [
|
|
143
|
-
{
|
|
144
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
145
|
-
sortRemainingProperties: 'concentric',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
149
|
-
output: `
|
|
150
|
-
import { style } from '@vanilla-extract/css';
|
|
151
|
-
const myStyle = style({
|
|
152
|
-
width: '10rem',
|
|
153
|
-
margin: '1rem',
|
|
154
|
-
fontFamily: 'sans-serif',
|
|
155
|
-
border: '1px solid black',
|
|
156
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
157
|
-
position: 'relative',
|
|
158
|
-
backgroundColor: 'red',
|
|
159
|
-
color: 'blue'
|
|
160
|
-
});
|
|
161
|
-
`,
|
|
162
|
-
},
|
|
163
|
-
// Style with nested selectors having incorrect ordering
|
|
164
|
-
{
|
|
165
|
-
code: `
|
|
166
|
-
import { style } from '@vanilla-extract/css';
|
|
167
|
-
const myStyle = style({
|
|
168
|
-
border: '1px solid black',
|
|
169
|
-
width: '10rem',
|
|
170
|
-
position: 'relative',
|
|
171
|
-
margin: '1rem',
|
|
172
|
-
selectors: {
|
|
173
|
-
'&:hover': {
|
|
174
|
-
color: 'white',
|
|
175
|
-
width: '12rem',
|
|
176
|
-
border: '2px solid blue',
|
|
177
|
-
margin: '1.2rem',
|
|
178
|
-
backgroundColor: 'blue'
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
`,
|
|
183
|
-
options: [
|
|
184
|
-
{
|
|
185
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
186
|
-
sortRemainingProperties: 'concentric',
|
|
187
|
-
},
|
|
188
|
-
],
|
|
189
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
190
|
-
output: `
|
|
191
|
-
import { style } from '@vanilla-extract/css';
|
|
192
|
-
const myStyle = style({
|
|
193
|
-
width: '10rem',
|
|
194
|
-
margin: '1rem',
|
|
195
|
-
border: '1px solid black',
|
|
196
|
-
position: 'relative',
|
|
197
|
-
selectors: {
|
|
198
|
-
'&:hover': {
|
|
199
|
-
width: '12rem',
|
|
200
|
-
margin: '1.2rem',
|
|
201
|
-
border: '2px solid blue',
|
|
202
|
-
backgroundColor: 'blue',
|
|
203
|
-
color: 'white'
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
`,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
code: `
|
|
211
|
-
import { style } from '@vanilla-extract/css';
|
|
212
|
-
const myStyle = style({
|
|
213
|
-
position: 'relative',
|
|
214
|
-
border: '1px solid black',
|
|
215
|
-
width: '10rem',
|
|
216
|
-
padding: '2rem',
|
|
217
|
-
color: 'blue',
|
|
218
|
-
margin: '1rem',
|
|
219
|
-
display: 'flex',
|
|
220
|
-
fontFamily: 'sans-serif',
|
|
221
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
222
|
-
backgroundColor: 'red'
|
|
223
|
-
});
|
|
224
|
-
`,
|
|
225
|
-
options: [
|
|
226
|
-
{
|
|
227
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
228
|
-
sortRemainingProperties: 'alphabetical',
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
232
|
-
output: `
|
|
233
|
-
import { style } from '@vanilla-extract/css';
|
|
234
|
-
const myStyle = style({
|
|
235
|
-
width: '10rem',
|
|
236
|
-
margin: '1rem',
|
|
237
|
-
fontFamily: 'sans-serif',
|
|
238
|
-
border: '1px solid black',
|
|
239
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
240
|
-
backgroundColor: 'red',
|
|
241
|
-
color: 'blue',
|
|
242
|
-
display: 'flex',
|
|
243
|
-
padding: '2rem',
|
|
244
|
-
position: 'relative'
|
|
245
|
-
});
|
|
246
|
-
`,
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import customGroupOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/custom-order/variants',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// styleVariants with custom group ordering (concentric for remaining)
|
|
16
|
-
{
|
|
17
|
-
code: `
|
|
18
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
19
|
-
|
|
20
|
-
const variants = styleVariants({
|
|
21
|
-
primary: {
|
|
22
|
-
margin: '1rem',
|
|
23
|
-
padding: '0.5rem',
|
|
24
|
-
position: 'relative',
|
|
25
|
-
display: 'flex',
|
|
26
|
-
backgroundColor: 'blue',
|
|
27
|
-
color: 'white'
|
|
28
|
-
},
|
|
29
|
-
secondary: {
|
|
30
|
-
margin: '0.8rem',
|
|
31
|
-
padding: '0.4rem',
|
|
32
|
-
position: 'relative',
|
|
33
|
-
display: 'flex',
|
|
34
|
-
backgroundColor: 'gray',
|
|
35
|
-
color: 'black'
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
`,
|
|
39
|
-
options: [
|
|
40
|
-
{
|
|
41
|
-
groupOrder: ['margin', 'padding', 'dimensions', 'font', 'border', 'boxShadow'],
|
|
42
|
-
sortRemainingProperties: 'concentric',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
// styleVariants with custom group ordering (alphabetical for remaining)
|
|
47
|
-
{
|
|
48
|
-
code: `
|
|
49
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
50
|
-
|
|
51
|
-
const variants = styleVariants({
|
|
52
|
-
primary: {
|
|
53
|
-
margin: '1rem',
|
|
54
|
-
padding: '0.5rem',
|
|
55
|
-
backgroundColor: 'blue',
|
|
56
|
-
color: 'white',
|
|
57
|
-
display: 'flex',
|
|
58
|
-
position: 'relative'
|
|
59
|
-
},
|
|
60
|
-
secondary: {
|
|
61
|
-
margin: '0.8rem',
|
|
62
|
-
padding: '0.4rem',
|
|
63
|
-
backgroundColor: 'gray',
|
|
64
|
-
color: 'black',
|
|
65
|
-
display: 'flex',
|
|
66
|
-
position: 'relative'
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
`,
|
|
70
|
-
options: [
|
|
71
|
-
{
|
|
72
|
-
groupOrder: ['margin', 'padding', 'dimensions', 'font', 'border', 'boxShadow'],
|
|
73
|
-
sortRemainingProperties: 'alphabetical',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
invalid: [
|
|
79
|
-
// styleVariants with incorrect ordering (concentric for remaining)
|
|
80
|
-
{
|
|
81
|
-
code: `
|
|
82
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
83
|
-
const variants = styleVariants({
|
|
84
|
-
primary: {
|
|
85
|
-
color: 'white',
|
|
86
|
-
backgroundColor: 'blue',
|
|
87
|
-
padding: '0.5rem',
|
|
88
|
-
margin: '1rem',
|
|
89
|
-
display: 'flex',
|
|
90
|
-
position: 'relative'
|
|
91
|
-
},
|
|
92
|
-
secondary: {
|
|
93
|
-
color: 'black',
|
|
94
|
-
backgroundColor: 'gray',
|
|
95
|
-
padding: '0.4rem',
|
|
96
|
-
margin: '0.8rem',
|
|
97
|
-
display: 'flex',
|
|
98
|
-
position: 'relative'
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
`,
|
|
102
|
-
options: [
|
|
103
|
-
{
|
|
104
|
-
groupOrder: ['margin', 'padding', 'dimensions', 'font', 'border', 'boxShadow'],
|
|
105
|
-
sortRemainingProperties: 'concentric',
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
109
|
-
output: `
|
|
110
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
111
|
-
const variants = styleVariants({
|
|
112
|
-
primary: {
|
|
113
|
-
margin: '1rem',
|
|
114
|
-
padding: '0.5rem',
|
|
115
|
-
position: 'relative',
|
|
116
|
-
display: 'flex',
|
|
117
|
-
backgroundColor: 'blue',
|
|
118
|
-
color: 'white'
|
|
119
|
-
},
|
|
120
|
-
secondary: {
|
|
121
|
-
margin: '0.8rem',
|
|
122
|
-
padding: '0.4rem',
|
|
123
|
-
position: 'relative',
|
|
124
|
-
display: 'flex',
|
|
125
|
-
backgroundColor: 'gray',
|
|
126
|
-
color: 'black'
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
`,
|
|
130
|
-
},
|
|
131
|
-
// styleVariants with incorrect ordering (alphabetical for remaining)
|
|
132
|
-
{
|
|
133
|
-
code: `
|
|
134
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
135
|
-
const variants = styleVariants({
|
|
136
|
-
primary: {
|
|
137
|
-
position: 'relative',
|
|
138
|
-
display: 'flex',
|
|
139
|
-
margin: '1rem',
|
|
140
|
-
padding: '0.5rem',
|
|
141
|
-
backgroundColor: 'blue',
|
|
142
|
-
color: 'white'
|
|
143
|
-
},
|
|
144
|
-
secondary: {
|
|
145
|
-
color: 'black',
|
|
146
|
-
backgroundColor: 'gray',
|
|
147
|
-
padding: '0.4rem',
|
|
148
|
-
margin: '0.8rem',
|
|
149
|
-
display: 'flex',
|
|
150
|
-
position: 'relative'
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
`,
|
|
154
|
-
options: [
|
|
155
|
-
{
|
|
156
|
-
groupOrder: ['margin', 'padding', 'dimensions', 'font', 'border', 'boxShadow'],
|
|
157
|
-
sortRemainingProperties: 'alphabetical',
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
161
|
-
output: `
|
|
162
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
163
|
-
const variants = styleVariants({
|
|
164
|
-
primary: {
|
|
165
|
-
margin: '1rem',
|
|
166
|
-
padding: '0.5rem',
|
|
167
|
-
backgroundColor: 'blue',
|
|
168
|
-
color: 'white',
|
|
169
|
-
display: 'flex',
|
|
170
|
-
position: 'relative'
|
|
171
|
-
},
|
|
172
|
-
secondary: {
|
|
173
|
-
margin: '0.8rem',
|
|
174
|
-
padding: '0.4rem',
|
|
175
|
-
backgroundColor: 'gray',
|
|
176
|
-
color: 'black',
|
|
177
|
-
display: 'flex',
|
|
178
|
-
position: 'relative'
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
`,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import concentricOrderRule from '../../concentric-order/rule-definition.js';
|
|
4
|
-
import { createCSSPropertyPriorityMap } from '../css-property-priority-map.js';
|
|
5
|
-
// A modified version of the rule that uses invalid group names
|
|
6
|
-
const testPropertyPriorityMapRule = {
|
|
7
|
-
...concentricOrderRule,
|
|
8
|
-
create(context) {
|
|
9
|
-
// This will trigger the || [] fallback by using non-existent group names
|
|
10
|
-
createCSSPropertyPriorityMap(['non-existent-group', 'another-fake-group']);
|
|
11
|
-
// Return the original rule's implementation
|
|
12
|
-
return concentricOrderRule.create(context);
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
run({
|
|
16
|
-
name: 'vanilla-extract/css-property-priority-map-tests',
|
|
17
|
-
rule: testPropertyPriorityMapRule,
|
|
18
|
-
languageOptions: {
|
|
19
|
-
parser: tsParser,
|
|
20
|
-
parserOptions: {
|
|
21
|
-
ecmaVersion: 2022,
|
|
22
|
-
sourceType: 'module',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
valid: [
|
|
26
|
-
// Simple test case to execute the rule
|
|
27
|
-
`
|
|
28
|
-
import { style } from '@vanilla-extract/css';
|
|
29
|
-
|
|
30
|
-
const myStyle = style({
|
|
31
|
-
backgroundColor: 'white',
|
|
32
|
-
color: 'blue'
|
|
33
|
-
});
|
|
34
|
-
`,
|
|
35
|
-
],
|
|
36
|
-
invalid: [],
|
|
37
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|