@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,126 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import concentricOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/concentric-order/style',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Basic style object with concentric ordering
|
|
16
|
-
`
|
|
17
|
-
import { style } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const myStyle = style({
|
|
20
|
-
boxSizing: 'border-box',
|
|
21
|
-
position: 'relative',
|
|
22
|
-
zIndex: 1,
|
|
23
|
-
display: 'flex',
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
transform: 'none',
|
|
26
|
-
opacity: 1,
|
|
27
|
-
margin: '1rem',
|
|
28
|
-
border: '1px solid black',
|
|
29
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
30
|
-
backgroundColor: 'red',
|
|
31
|
-
padding: '2rem',
|
|
32
|
-
width: '10rem',
|
|
33
|
-
height: '10rem',
|
|
34
|
-
color: 'blue',
|
|
35
|
-
fontSize: '16rem'
|
|
36
|
-
});
|
|
37
|
-
`,
|
|
38
|
-
// Style with nested selectors
|
|
39
|
-
`
|
|
40
|
-
import { style } from '@vanilla-extract/css';
|
|
41
|
-
|
|
42
|
-
const myStyle = style({
|
|
43
|
-
position: 'relative',
|
|
44
|
-
display: 'flex',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
backgroundColor: 'red',
|
|
47
|
-
color: 'blue',
|
|
48
|
-
|
|
49
|
-
selectors: {
|
|
50
|
-
'&:hover': {
|
|
51
|
-
position: 'relative',
|
|
52
|
-
opacity: 0.8,
|
|
53
|
-
backgroundColor: 'blue',
|
|
54
|
-
color: 'white'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
`,
|
|
59
|
-
],
|
|
60
|
-
invalid: [
|
|
61
|
-
// Basic style object with incorrect ordering
|
|
62
|
-
{
|
|
63
|
-
code: `
|
|
64
|
-
import { style } from '@vanilla-extract/css';
|
|
65
|
-
const myStyle = style({
|
|
66
|
-
color: 'blue',
|
|
67
|
-
width: '10rem',
|
|
68
|
-
display: 'flex',
|
|
69
|
-
backgroundColor: 'red',
|
|
70
|
-
margin: '1rem',
|
|
71
|
-
position: 'relative'
|
|
72
|
-
});
|
|
73
|
-
`,
|
|
74
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
75
|
-
output: `
|
|
76
|
-
import { style } from '@vanilla-extract/css';
|
|
77
|
-
const myStyle = style({
|
|
78
|
-
position: 'relative',
|
|
79
|
-
display: 'flex',
|
|
80
|
-
margin: '1rem',
|
|
81
|
-
backgroundColor: 'red',
|
|
82
|
-
width: '10rem',
|
|
83
|
-
color: 'blue'
|
|
84
|
-
});
|
|
85
|
-
`,
|
|
86
|
-
},
|
|
87
|
-
// Style with nested selectors having incorrect ordering
|
|
88
|
-
{
|
|
89
|
-
code: `
|
|
90
|
-
import { style } from '@vanilla-extract/css';
|
|
91
|
-
const myStyle = style({
|
|
92
|
-
color: 'blue',
|
|
93
|
-
display: 'flex',
|
|
94
|
-
backgroundColor: 'red',
|
|
95
|
-
position: 'relative',
|
|
96
|
-
|
|
97
|
-
selectors: {
|
|
98
|
-
'&:hover': {
|
|
99
|
-
color: 'white',
|
|
100
|
-
position: 'relative',
|
|
101
|
-
backgroundColor: 'blue'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
`,
|
|
106
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
107
|
-
output: `
|
|
108
|
-
import { style } from '@vanilla-extract/css';
|
|
109
|
-
const myStyle = style({
|
|
110
|
-
position: 'relative',
|
|
111
|
-
display: 'flex',
|
|
112
|
-
backgroundColor: 'red',
|
|
113
|
-
color: 'blue',
|
|
114
|
-
|
|
115
|
-
selectors: {
|
|
116
|
-
'&:hover': {
|
|
117
|
-
position: 'relative',
|
|
118
|
-
backgroundColor: 'blue',
|
|
119
|
-
color: 'white'
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
`,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import concentricOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/concentric-order/variants',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// styleVariants with concentric ordering
|
|
16
|
-
`
|
|
17
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const variants = styleVariants({
|
|
20
|
-
primary: {
|
|
21
|
-
position: 'relative',
|
|
22
|
-
display: 'flex',
|
|
23
|
-
margin: '1rem',
|
|
24
|
-
backgroundColor: 'blue',
|
|
25
|
-
padding: '0.5rem',
|
|
26
|
-
color: 'white'
|
|
27
|
-
},
|
|
28
|
-
secondary: {
|
|
29
|
-
position: 'relative',
|
|
30
|
-
display: 'flex',
|
|
31
|
-
margin: '0.8rem',
|
|
32
|
-
backgroundColor: 'gray',
|
|
33
|
-
padding: '0.4rem',
|
|
34
|
-
color: 'black'
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
`,
|
|
38
|
-
],
|
|
39
|
-
invalid: [
|
|
40
|
-
// styleVariants with incorrect ordering
|
|
41
|
-
{
|
|
42
|
-
code: `
|
|
43
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
44
|
-
const variants = styleVariants({
|
|
45
|
-
primary: {
|
|
46
|
-
color: 'white',
|
|
47
|
-
backgroundColor: 'blue',
|
|
48
|
-
padding: '0.5rem',
|
|
49
|
-
margin: '1rem',
|
|
50
|
-
display: 'flex',
|
|
51
|
-
position: 'relative'
|
|
52
|
-
},
|
|
53
|
-
secondary: {
|
|
54
|
-
color: 'black',
|
|
55
|
-
backgroundColor: 'gray',
|
|
56
|
-
padding: '0.4rem',
|
|
57
|
-
margin: '0.8rem',
|
|
58
|
-
display: 'flex',
|
|
59
|
-
position: 'relative'
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
`,
|
|
63
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
64
|
-
output: `
|
|
65
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
66
|
-
const variants = styleVariants({
|
|
67
|
-
primary: {
|
|
68
|
-
position: 'relative',
|
|
69
|
-
display: 'flex',
|
|
70
|
-
margin: '1rem',
|
|
71
|
-
backgroundColor: 'blue',
|
|
72
|
-
padding: '0.5rem',
|
|
73
|
-
color: 'white'
|
|
74
|
-
},
|
|
75
|
-
secondary: {
|
|
76
|
-
position: 'relative',
|
|
77
|
-
display: 'flex',
|
|
78
|
-
margin: '0.8rem',
|
|
79
|
-
backgroundColor: 'gray',
|
|
80
|
-
padding: '0.4rem',
|
|
81
|
-
color: 'black'
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
`,
|
|
85
|
-
},
|
|
86
|
-
// styleVariants with some variants having incorrect ordering
|
|
87
|
-
{
|
|
88
|
-
code: `
|
|
89
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
90
|
-
const variants = styleVariants({
|
|
91
|
-
primary: {
|
|
92
|
-
position: 'relative',
|
|
93
|
-
display: 'flex',
|
|
94
|
-
margin: '1rem',
|
|
95
|
-
padding: '0.5rem',
|
|
96
|
-
backgroundColor: 'blue',
|
|
97
|
-
color: 'white'
|
|
98
|
-
},
|
|
99
|
-
secondary: {
|
|
100
|
-
color: 'black',
|
|
101
|
-
backgroundColor: 'gray',
|
|
102
|
-
padding: '0.4rem',
|
|
103
|
-
margin: '0.8rem',
|
|
104
|
-
display: 'flex',
|
|
105
|
-
position: 'relative'
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
`,
|
|
109
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
110
|
-
output: `
|
|
111
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
112
|
-
const variants = styleVariants({
|
|
113
|
-
primary: {
|
|
114
|
-
position: 'relative',
|
|
115
|
-
display: 'flex',
|
|
116
|
-
margin: '1rem',
|
|
117
|
-
backgroundColor: 'blue',
|
|
118
|
-
padding: '0.5rem',
|
|
119
|
-
color: 'white'
|
|
120
|
-
},
|
|
121
|
-
secondary: {
|
|
122
|
-
position: 'relative',
|
|
123
|
-
display: 'flex',
|
|
124
|
-
margin: '0.8rem',
|
|
125
|
-
backgroundColor: 'gray',
|
|
126
|
-
padding: '0.4rem',
|
|
127
|
-
color: 'black'
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
`,
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,148 +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/animation',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// keyframes with custom group ordering (concentric for remaining)
|
|
16
|
-
{
|
|
17
|
-
code: `
|
|
18
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
19
|
-
|
|
20
|
-
const fadeIn = keyframes({
|
|
21
|
-
'0%': {
|
|
22
|
-
position: 'relative',
|
|
23
|
-
transform: 'translateY(1rem)',
|
|
24
|
-
opacity: 0
|
|
25
|
-
},
|
|
26
|
-
'100%': {
|
|
27
|
-
position: 'relative',
|
|
28
|
-
transform: 'translateY(0)',
|
|
29
|
-
opacity: 1
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
`,
|
|
33
|
-
options: [
|
|
34
|
-
{
|
|
35
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
36
|
-
sortRemainingProperties: 'concentric',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
// keyframes with custom group ordering (alphabetical for remaining)
|
|
41
|
-
{
|
|
42
|
-
code: `
|
|
43
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
44
|
-
|
|
45
|
-
const fadeIn = keyframes({
|
|
46
|
-
'0%': {
|
|
47
|
-
opacity: 0,
|
|
48
|
-
position: 'relative',
|
|
49
|
-
transform: 'translateY(1rem)'
|
|
50
|
-
},
|
|
51
|
-
'100%': {
|
|
52
|
-
opacity: 1,
|
|
53
|
-
position: 'relative',
|
|
54
|
-
transform: 'translateY(0)'
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
`,
|
|
58
|
-
options: [
|
|
59
|
-
{
|
|
60
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
61
|
-
sortRemainingProperties: 'alphabetical',
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
invalid: [
|
|
67
|
-
// keyframes with incorrect ordering (concentric for remaining)
|
|
68
|
-
{
|
|
69
|
-
code: `
|
|
70
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
71
|
-
const fadeIn = keyframes({
|
|
72
|
-
'0%': {
|
|
73
|
-
opacity: 0,
|
|
74
|
-
transform: 'translateY(1rem)',
|
|
75
|
-
position: 'relative'
|
|
76
|
-
},
|
|
77
|
-
'100%': {
|
|
78
|
-
opacity: 1,
|
|
79
|
-
transform: 'translateY(0)',
|
|
80
|
-
position: 'relative'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
`,
|
|
84
|
-
options: [
|
|
85
|
-
{
|
|
86
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
87
|
-
sortRemainingProperties: 'concentric',
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
91
|
-
output: `
|
|
92
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
93
|
-
const fadeIn = keyframes({
|
|
94
|
-
'0%': {
|
|
95
|
-
position: 'relative',
|
|
96
|
-
transform: 'translateY(1rem)',
|
|
97
|
-
opacity: 0
|
|
98
|
-
},
|
|
99
|
-
'100%': {
|
|
100
|
-
position: 'relative',
|
|
101
|
-
transform: 'translateY(0)',
|
|
102
|
-
opacity: 1
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
`,
|
|
106
|
-
},
|
|
107
|
-
// keyframes with incorrect ordering (alphabetical for remaining)
|
|
108
|
-
{
|
|
109
|
-
code: `
|
|
110
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
111
|
-
const fadeIn = keyframes({
|
|
112
|
-
'0%': {
|
|
113
|
-
transform: 'translateY(1rem)',
|
|
114
|
-
position: 'relative',
|
|
115
|
-
opacity: 0
|
|
116
|
-
},
|
|
117
|
-
'100%': {
|
|
118
|
-
transform: 'translateY(0)',
|
|
119
|
-
position: 'relative',
|
|
120
|
-
opacity: 1
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
`,
|
|
124
|
-
options: [
|
|
125
|
-
{
|
|
126
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
127
|
-
sortRemainingProperties: 'alphabetical',
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
131
|
-
output: `
|
|
132
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
133
|
-
const fadeIn = keyframes({
|
|
134
|
-
'0%': {
|
|
135
|
-
opacity: 0,
|
|
136
|
-
position: 'relative',
|
|
137
|
-
transform: 'translateY(1rem)'
|
|
138
|
-
},
|
|
139
|
-
'100%': {
|
|
140
|
-
opacity: 1,
|
|
141
|
-
position: 'relative',
|
|
142
|
-
transform: 'translateY(0)'
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
`,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,124 +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/font-face',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
configs: {
|
|
8
|
-
languageOptions: {
|
|
9
|
-
parser: tsParser,
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: 2022,
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
valid: [
|
|
17
|
-
// fontFace
|
|
18
|
-
{
|
|
19
|
-
code: `
|
|
20
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
21
|
-
|
|
22
|
-
const myFont = fontFace({
|
|
23
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
24
|
-
ascentOverride: '90%',
|
|
25
|
-
descentOverride: '10%',
|
|
26
|
-
fontDisplay: 'swap',
|
|
27
|
-
fontFeatureSettings: '"liga" 1',
|
|
28
|
-
fontStretch: 'normal',
|
|
29
|
-
fontStyle: 'normal',
|
|
30
|
-
fontVariant: 'normal',
|
|
31
|
-
fontWeight: '400'
|
|
32
|
-
});
|
|
33
|
-
`,
|
|
34
|
-
options: [
|
|
35
|
-
{
|
|
36
|
-
groupOrder: ['dimensions', 'margin', 'font'],
|
|
37
|
-
sortRemainingProperties: 'concentric',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
// globalFontFace
|
|
42
|
-
{
|
|
43
|
-
code: `
|
|
44
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
45
|
-
|
|
46
|
-
globalFontFace('GlobalFont', {
|
|
47
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
48
|
-
ascentOverride: '90%',
|
|
49
|
-
descentOverride: '10%',
|
|
50
|
-
fontDisplay: 'swap',
|
|
51
|
-
fontFeatureSettings: '"liga" 1',
|
|
52
|
-
fontStretch: 'normal',
|
|
53
|
-
fontStyle: 'normal',
|
|
54
|
-
fontVariant: 'normal',
|
|
55
|
-
fontWeight: '400'
|
|
56
|
-
});
|
|
57
|
-
`,
|
|
58
|
-
options: [
|
|
59
|
-
{
|
|
60
|
-
groupOrder: ['dimensions', 'margin', 'font'],
|
|
61
|
-
sortRemainingProperties: 'concentric',
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
invalid: [
|
|
67
|
-
// fontFace with src not first
|
|
68
|
-
{
|
|
69
|
-
code: `
|
|
70
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
71
|
-
const myFont = fontFace({
|
|
72
|
-
fontWeight: '400',
|
|
73
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
74
|
-
ascentOverride: '90%',
|
|
75
|
-
fontStyle: 'normal'
|
|
76
|
-
});
|
|
77
|
-
`,
|
|
78
|
-
options: [
|
|
79
|
-
{
|
|
80
|
-
groupOrder: ['dimensions', 'margin', 'font'],
|
|
81
|
-
sortRemainingProperties: 'concentric',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
errors: [{ messageId: 'fontFaceOrder' }],
|
|
85
|
-
output: `
|
|
86
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
87
|
-
const myFont = fontFace({
|
|
88
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
89
|
-
ascentOverride: '90%',
|
|
90
|
-
fontStyle: 'normal',
|
|
91
|
-
fontWeight: '400'
|
|
92
|
-
});
|
|
93
|
-
`,
|
|
94
|
-
},
|
|
95
|
-
// globalFontFace with src not first
|
|
96
|
-
{
|
|
97
|
-
code: `
|
|
98
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
99
|
-
globalFontFace('GlobalFont', {
|
|
100
|
-
fontWeight: '400',
|
|
101
|
-
fontStyle: 'normal',
|
|
102
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
103
|
-
ascentOverride: '90%'
|
|
104
|
-
});
|
|
105
|
-
`,
|
|
106
|
-
options: [
|
|
107
|
-
{
|
|
108
|
-
groupOrder: ['dimensions', 'margin', 'font'],
|
|
109
|
-
sortRemainingProperties: 'concentric',
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
errors: [{ messageId: 'fontFaceOrder' }],
|
|
113
|
-
output: `
|
|
114
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
115
|
-
globalFontFace('GlobalFont', {
|
|
116
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
117
|
-
ascentOverride: '90%',
|
|
118
|
-
fontStyle: 'normal',
|
|
119
|
-
fontWeight: '400'
|
|
120
|
-
});
|
|
121
|
-
`,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,124 +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/global',
|
|
6
|
-
rule: customGroupOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// globalStyle with custom group ordering (concentric for remaining)
|
|
16
|
-
{
|
|
17
|
-
code: `
|
|
18
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
19
|
-
|
|
20
|
-
globalStyle('body', {
|
|
21
|
-
margin: 0,
|
|
22
|
-
position: 'relative',
|
|
23
|
-
display: 'block',
|
|
24
|
-
backgroundColor: 'white',
|
|
25
|
-
padding: 0,
|
|
26
|
-
color: 'black'
|
|
27
|
-
});
|
|
28
|
-
`,
|
|
29
|
-
options: [
|
|
30
|
-
{
|
|
31
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
32
|
-
sortRemainingProperties: 'concentric',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
// globalStyle with custom group ordering (alphabetical for remaining)
|
|
37
|
-
{
|
|
38
|
-
code: `
|
|
39
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
40
|
-
|
|
41
|
-
globalStyle('body', {
|
|
42
|
-
margin: 0,
|
|
43
|
-
backgroundColor: 'white',
|
|
44
|
-
color: 'black',
|
|
45
|
-
display: 'block',
|
|
46
|
-
padding: 0,
|
|
47
|
-
position: 'relative'
|
|
48
|
-
});
|
|
49
|
-
`,
|
|
50
|
-
options: [
|
|
51
|
-
{
|
|
52
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
53
|
-
sortRemainingProperties: 'alphabetical',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
invalid: [
|
|
59
|
-
// globalStyle with incorrect ordering (concentric for remaining)
|
|
60
|
-
{
|
|
61
|
-
code: `
|
|
62
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
63
|
-
globalStyle('body', {
|
|
64
|
-
color: 'black',
|
|
65
|
-
margin: 0,
|
|
66
|
-
backgroundColor: 'white',
|
|
67
|
-
padding: 0,
|
|
68
|
-
display: 'block',
|
|
69
|
-
position: 'relative'
|
|
70
|
-
});
|
|
71
|
-
`,
|
|
72
|
-
options: [
|
|
73
|
-
{
|
|
74
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
75
|
-
sortRemainingProperties: 'concentric',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
79
|
-
output: `
|
|
80
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
81
|
-
globalStyle('body', {
|
|
82
|
-
margin: 0,
|
|
83
|
-
position: 'relative',
|
|
84
|
-
display: 'block',
|
|
85
|
-
backgroundColor: 'white',
|
|
86
|
-
padding: 0,
|
|
87
|
-
color: 'black'
|
|
88
|
-
});
|
|
89
|
-
`,
|
|
90
|
-
},
|
|
91
|
-
// globalStyle with incorrect ordering (alphabetical for remaining)
|
|
92
|
-
{
|
|
93
|
-
code: `
|
|
94
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
95
|
-
globalStyle('body', {
|
|
96
|
-
position: 'relative',
|
|
97
|
-
display: 'block',
|
|
98
|
-
margin: 0,
|
|
99
|
-
backgroundColor: 'white',
|
|
100
|
-
padding: 0,
|
|
101
|
-
color: 'black'
|
|
102
|
-
});
|
|
103
|
-
`,
|
|
104
|
-
options: [
|
|
105
|
-
{
|
|
106
|
-
groupOrder: ['dimensions', 'margin', 'font', 'border', 'boxShadow'],
|
|
107
|
-
sortRemainingProperties: 'alphabetical',
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
111
|
-
output: `
|
|
112
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
113
|
-
globalStyle('body', {
|
|
114
|
-
margin: 0,
|
|
115
|
-
backgroundColor: 'white',
|
|
116
|
-
color: 'black',
|
|
117
|
-
display: 'block',
|
|
118
|
-
padding: 0,
|
|
119
|
-
position: 'relative'
|
|
120
|
-
});
|
|
121
|
-
`,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|