@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,51 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/alphabetical-order/global',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// globalStyle with alphabetical ordering
|
|
16
|
-
`
|
|
17
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
globalStyle('body', {
|
|
20
|
-
backgroundColor: 'white',
|
|
21
|
-
color: 'black',
|
|
22
|
-
margin: 0,
|
|
23
|
-
padding: 0
|
|
24
|
-
});
|
|
25
|
-
`,
|
|
26
|
-
],
|
|
27
|
-
invalid: [
|
|
28
|
-
// globalStyle with incorrect ordering
|
|
29
|
-
{
|
|
30
|
-
code: `
|
|
31
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
32
|
-
globalStyle('body', {
|
|
33
|
-
color: 'black',
|
|
34
|
-
backgroundColor: 'white',
|
|
35
|
-
padding: 0,
|
|
36
|
-
margin: 0
|
|
37
|
-
});
|
|
38
|
-
`,
|
|
39
|
-
errors: [{ messageId: 'alphabeticalOrder' }],
|
|
40
|
-
output: `
|
|
41
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
42
|
-
globalStyle('body', {
|
|
43
|
-
backgroundColor: 'white',
|
|
44
|
-
color: 'black',
|
|
45
|
-
margin: 0,
|
|
46
|
-
padding: 0
|
|
47
|
-
});
|
|
48
|
-
`,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/alphabetical-order/recipe',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Recipe with alphabetical ordering
|
|
16
|
-
`
|
|
17
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
18
|
-
|
|
19
|
-
const myRecipe = recipe({
|
|
20
|
-
base: {
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
display: 'flex'
|
|
23
|
-
},
|
|
24
|
-
variants: {
|
|
25
|
-
color: {
|
|
26
|
-
blue: {
|
|
27
|
-
backgroundColor: 'blue',
|
|
28
|
-
color: 'white'
|
|
29
|
-
},
|
|
30
|
-
red: {
|
|
31
|
-
backgroundColor: 'red',
|
|
32
|
-
color: 'black'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
`,
|
|
38
|
-
],
|
|
39
|
-
invalid: [
|
|
40
|
-
// Recipe with incorrect ordering
|
|
41
|
-
{
|
|
42
|
-
code: `
|
|
43
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
44
|
-
const myRecipe = recipe({
|
|
45
|
-
base: {
|
|
46
|
-
display: 'flex',
|
|
47
|
-
alignItems: 'center'
|
|
48
|
-
},
|
|
49
|
-
variants: {
|
|
50
|
-
color: {
|
|
51
|
-
blue: {
|
|
52
|
-
color: 'white',
|
|
53
|
-
backgroundColor: 'blue'
|
|
54
|
-
},
|
|
55
|
-
red: {
|
|
56
|
-
color: 'black',
|
|
57
|
-
backgroundColor: 'red'
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
`,
|
|
63
|
-
errors: [
|
|
64
|
-
{ messageId: 'alphabeticalOrder' },
|
|
65
|
-
{ messageId: 'alphabeticalOrder' },
|
|
66
|
-
{ messageId: 'alphabeticalOrder' },
|
|
67
|
-
],
|
|
68
|
-
output: `
|
|
69
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
70
|
-
const myRecipe = recipe({
|
|
71
|
-
base: {
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
display: 'flex'
|
|
74
|
-
},
|
|
75
|
-
variants: {
|
|
76
|
-
color: {
|
|
77
|
-
blue: {
|
|
78
|
-
backgroundColor: 'blue',
|
|
79
|
-
color: 'white'
|
|
80
|
-
},
|
|
81
|
-
red: {
|
|
82
|
-
backgroundColor: 'red',
|
|
83
|
-
color: 'black'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
`,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/alphabetical-order/style',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Basic style object with alphabetical ordering
|
|
16
|
-
`
|
|
17
|
-
import { style } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const myStyle = style({
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
backgroundColor: 'red',
|
|
22
|
-
color: 'blue',
|
|
23
|
-
display: 'flex',
|
|
24
|
-
margin: '10px',
|
|
25
|
-
padding: '20px',
|
|
26
|
-
zIndex: 1
|
|
27
|
-
});
|
|
28
|
-
`,
|
|
29
|
-
// Style with nested selectors
|
|
30
|
-
`
|
|
31
|
-
import { style } from '@vanilla-extract/css';
|
|
32
|
-
|
|
33
|
-
const myStyle = style({
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
backgroundColor: 'red',
|
|
36
|
-
color: 'blue',
|
|
37
|
-
selectors: {
|
|
38
|
-
'&:hover': {
|
|
39
|
-
backgroundColor: 'blue',
|
|
40
|
-
color: 'white'
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
`,
|
|
45
|
-
],
|
|
46
|
-
invalid: [
|
|
47
|
-
// Basic style object with incorrect ordering
|
|
48
|
-
{
|
|
49
|
-
code: `
|
|
50
|
-
import { style } from '@vanilla-extract/css';
|
|
51
|
-
const myStyle = style({
|
|
52
|
-
backgroundColor: 'red',
|
|
53
|
-
alignItems: 'center',
|
|
54
|
-
padding: '20px',
|
|
55
|
-
color: 'blue',
|
|
56
|
-
margin: '10px',
|
|
57
|
-
display: 'flex',
|
|
58
|
-
zIndex: 1
|
|
59
|
-
});
|
|
60
|
-
`,
|
|
61
|
-
errors: [{ messageId: 'alphabeticalOrder' }],
|
|
62
|
-
output: `
|
|
63
|
-
import { style } from '@vanilla-extract/css';
|
|
64
|
-
const myStyle = style({
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
backgroundColor: 'red',
|
|
67
|
-
color: 'blue',
|
|
68
|
-
display: 'flex',
|
|
69
|
-
margin: '10px',
|
|
70
|
-
padding: '20px',
|
|
71
|
-
zIndex: 1
|
|
72
|
-
});
|
|
73
|
-
`,
|
|
74
|
-
},
|
|
75
|
-
// Style with nested selectors having incorrect ordering
|
|
76
|
-
{
|
|
77
|
-
code: `
|
|
78
|
-
import { style } from '@vanilla-extract/css';
|
|
79
|
-
const myStyle = style({
|
|
80
|
-
backgroundColor: 'red',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
color: 'blue',
|
|
83
|
-
selectors: {
|
|
84
|
-
'&:hover': {
|
|
85
|
-
color: 'white',
|
|
86
|
-
backgroundColor: 'blue'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
`,
|
|
91
|
-
errors: [{ messageId: 'alphabeticalOrder' }, { messageId: 'alphabeticalOrder' }],
|
|
92
|
-
output: `
|
|
93
|
-
import { style } from '@vanilla-extract/css';
|
|
94
|
-
const myStyle = style({
|
|
95
|
-
alignItems: 'center',
|
|
96
|
-
backgroundColor: 'red',
|
|
97
|
-
color: 'blue',
|
|
98
|
-
selectors: {
|
|
99
|
-
'&:hover': {
|
|
100
|
-
backgroundColor: 'blue',
|
|
101
|
-
color: 'white'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
`,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/alphabetical-order/variants',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// styleVariants with alphabetical ordering
|
|
16
|
-
`
|
|
17
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const variants = styleVariants({
|
|
20
|
-
primary: {
|
|
21
|
-
backgroundColor: 'blue',
|
|
22
|
-
color: 'white'
|
|
23
|
-
},
|
|
24
|
-
secondary: {
|
|
25
|
-
backgroundColor: 'gray',
|
|
26
|
-
color: 'black'
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
`,
|
|
30
|
-
],
|
|
31
|
-
invalid: [
|
|
32
|
-
// styleVariants with incorrect ordering
|
|
33
|
-
{
|
|
34
|
-
code: `
|
|
35
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
36
|
-
const variants = styleVariants({
|
|
37
|
-
primary: {
|
|
38
|
-
color: 'white',
|
|
39
|
-
backgroundColor: 'blue'
|
|
40
|
-
},
|
|
41
|
-
secondary: {
|
|
42
|
-
color: 'black',
|
|
43
|
-
backgroundColor: 'gray'
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
`,
|
|
47
|
-
errors: [{ messageId: 'alphabeticalOrder' }, { messageId: 'alphabeticalOrder' }],
|
|
48
|
-
output: `
|
|
49
|
-
import { styleVariants } from '@vanilla-extract/css';
|
|
50
|
-
const variants = styleVariants({
|
|
51
|
-
primary: {
|
|
52
|
-
backgroundColor: 'blue',
|
|
53
|
-
color: 'white'
|
|
54
|
-
},
|
|
55
|
-
secondary: {
|
|
56
|
-
backgroundColor: 'gray',
|
|
57
|
-
color: 'black'
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
`,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,69 +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/animation',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// keyframes with concentric ordering
|
|
16
|
-
`
|
|
17
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const fadeIn = keyframes({
|
|
20
|
-
'0%': {
|
|
21
|
-
position: 'relative',
|
|
22
|
-
transform: 'translateY(1rem)',
|
|
23
|
-
opacity: 0
|
|
24
|
-
},
|
|
25
|
-
'100%': {
|
|
26
|
-
position: 'relative',
|
|
27
|
-
transform: 'translateY(0)',
|
|
28
|
-
opacity: 1
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
`,
|
|
32
|
-
],
|
|
33
|
-
invalid: [
|
|
34
|
-
// keyframes with incorrect ordering
|
|
35
|
-
{
|
|
36
|
-
code: `
|
|
37
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
38
|
-
const fadeIn = keyframes({
|
|
39
|
-
'0%': {
|
|
40
|
-
opacity: 0,
|
|
41
|
-
transform: 'translateY(1rem)',
|
|
42
|
-
position: 'relative'
|
|
43
|
-
},
|
|
44
|
-
'100%': {
|
|
45
|
-
opacity: 1,
|
|
46
|
-
transform: 'translateY(0)',
|
|
47
|
-
position: 'relative'
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
`,
|
|
51
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
52
|
-
output: `
|
|
53
|
-
import { keyframes } from '@vanilla-extract/css';
|
|
54
|
-
const fadeIn = keyframes({
|
|
55
|
-
'0%': {
|
|
56
|
-
position: 'relative',
|
|
57
|
-
transform: 'translateY(1rem)',
|
|
58
|
-
opacity: 0
|
|
59
|
-
},
|
|
60
|
-
'100%': {
|
|
61
|
-
position: 'relative',
|
|
62
|
-
transform: 'translateY(0)',
|
|
63
|
-
opacity: 1
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
`,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,94 +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/font-face',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// fontFace with src first and other properties alphabetically ordered
|
|
16
|
-
`
|
|
17
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const myFont = fontFace({
|
|
20
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
21
|
-
ascentOverride: '90%',
|
|
22
|
-
descentOverride: '10%',
|
|
23
|
-
fontDisplay: 'swap',
|
|
24
|
-
fontFeatureSettings: '"liga" 1',
|
|
25
|
-
fontStretch: 'normal',
|
|
26
|
-
fontStyle: 'normal',
|
|
27
|
-
fontVariant: 'normal',
|
|
28
|
-
fontWeight: '400'
|
|
29
|
-
});
|
|
30
|
-
`,
|
|
31
|
-
// globalFontFace with src first and other properties alphabetically ordered
|
|
32
|
-
`
|
|
33
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
34
|
-
|
|
35
|
-
globalFontFace('GlobalFont', {
|
|
36
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
37
|
-
ascentOverride: '90%',
|
|
38
|
-
descentOverride: '10%',
|
|
39
|
-
fontDisplay: 'swap',
|
|
40
|
-
fontFeatureSettings: '"liga" 1',
|
|
41
|
-
fontStretch: 'normal',
|
|
42
|
-
fontStyle: 'normal',
|
|
43
|
-
fontVariant: 'normal',
|
|
44
|
-
fontWeight: '400'
|
|
45
|
-
});
|
|
46
|
-
`,
|
|
47
|
-
],
|
|
48
|
-
invalid: [
|
|
49
|
-
// fontFace with src not first
|
|
50
|
-
{
|
|
51
|
-
code: `
|
|
52
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
53
|
-
const myFont = fontFace({
|
|
54
|
-
fontWeight: '400',
|
|
55
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
56
|
-
ascentOverride: '90%',
|
|
57
|
-
fontStyle: 'normal'
|
|
58
|
-
});
|
|
59
|
-
`,
|
|
60
|
-
errors: [{ messageId: 'fontFaceOrder' }],
|
|
61
|
-
output: `
|
|
62
|
-
import { fontFace } from '@vanilla-extract/css';
|
|
63
|
-
const myFont = fontFace({
|
|
64
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
65
|
-
ascentOverride: '90%',
|
|
66
|
-
fontStyle: 'normal',
|
|
67
|
-
fontWeight: '400'
|
|
68
|
-
});
|
|
69
|
-
`,
|
|
70
|
-
},
|
|
71
|
-
// globalFontFace with src not first
|
|
72
|
-
{
|
|
73
|
-
code: `
|
|
74
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
75
|
-
globalFontFace('GlobalFont', {
|
|
76
|
-
fontWeight: '400',
|
|
77
|
-
fontStyle: 'normal',
|
|
78
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
79
|
-
ascentOverride: '90%'
|
|
80
|
-
});
|
|
81
|
-
`,
|
|
82
|
-
errors: [{ messageId: 'fontFaceOrder' }],
|
|
83
|
-
output: `
|
|
84
|
-
import { globalFontFace } from '@vanilla-extract/css';
|
|
85
|
-
globalFontFace('GlobalFont', {
|
|
86
|
-
src: ['url("/fonts/MyFont.woff2") format("woff2")'],
|
|
87
|
-
ascentOverride: '90%',
|
|
88
|
-
fontStyle: 'normal',
|
|
89
|
-
fontWeight: '400'
|
|
90
|
-
});
|
|
91
|
-
`,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,57 +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/global',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// globalStyle with concentric ordering
|
|
16
|
-
`
|
|
17
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
globalStyle('body', {
|
|
20
|
-
position: 'relative',
|
|
21
|
-
display: 'block',
|
|
22
|
-
margin: 0,
|
|
23
|
-
backgroundColor: 'white',
|
|
24
|
-
padding: 0,
|
|
25
|
-
color: 'black'
|
|
26
|
-
});
|
|
27
|
-
`,
|
|
28
|
-
],
|
|
29
|
-
invalid: [
|
|
30
|
-
// globalStyle with incorrect ordering
|
|
31
|
-
{
|
|
32
|
-
code: `
|
|
33
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
34
|
-
globalStyle('body', {
|
|
35
|
-
color: 'black',
|
|
36
|
-
margin: 0,
|
|
37
|
-
backgroundColor: 'white',
|
|
38
|
-
padding: 0,
|
|
39
|
-
display: 'block',
|
|
40
|
-
position: 'relative'
|
|
41
|
-
});
|
|
42
|
-
`,
|
|
43
|
-
errors: [{ messageId: 'incorrectOrder' }],
|
|
44
|
-
output: `
|
|
45
|
-
import { globalStyle } from '@vanilla-extract/css';
|
|
46
|
-
globalStyle('body', {
|
|
47
|
-
position: 'relative',
|
|
48
|
-
display: 'block',
|
|
49
|
-
margin: 0,
|
|
50
|
-
backgroundColor: 'white',
|
|
51
|
-
padding: 0,
|
|
52
|
-
color: 'black'
|
|
53
|
-
});
|
|
54
|
-
`,
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,100 +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/recipe',
|
|
6
|
-
rule: concentricOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Recipe with concentric ordering
|
|
16
|
-
`
|
|
17
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
18
|
-
|
|
19
|
-
const myRecipe = recipe({
|
|
20
|
-
base: {
|
|
21
|
-
position: 'relative',
|
|
22
|
-
display: 'flex',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
backgroundColor: 'white',
|
|
25
|
-
width: '100%'
|
|
26
|
-
},
|
|
27
|
-
variants: {
|
|
28
|
-
color: {
|
|
29
|
-
blue: {
|
|
30
|
-
position: 'relative',
|
|
31
|
-
backgroundColor: 'blue',
|
|
32
|
-
color: 'white'
|
|
33
|
-
},
|
|
34
|
-
red: {
|
|
35
|
-
position: 'relative',
|
|
36
|
-
backgroundColor: 'red',
|
|
37
|
-
color: 'black'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
`,
|
|
43
|
-
],
|
|
44
|
-
invalid: [
|
|
45
|
-
// Recipe with incorrect ordering
|
|
46
|
-
{
|
|
47
|
-
code: `
|
|
48
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
49
|
-
const myRecipe = recipe({
|
|
50
|
-
base: {
|
|
51
|
-
backgroundColor: 'white',
|
|
52
|
-
width: '100%',
|
|
53
|
-
display: 'flex',
|
|
54
|
-
alignItems: 'center'
|
|
55
|
-
},
|
|
56
|
-
variants: {
|
|
57
|
-
color: {
|
|
58
|
-
blue: {
|
|
59
|
-
color: 'white',
|
|
60
|
-
backgroundColor: 'blue',
|
|
61
|
-
position: 'relative'
|
|
62
|
-
},
|
|
63
|
-
red: {
|
|
64
|
-
color: 'black',
|
|
65
|
-
backgroundColor: 'red',
|
|
66
|
-
position: 'relative'
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
`,
|
|
72
|
-
errors: [{ messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }, { messageId: 'incorrectOrder' }],
|
|
73
|
-
output: `
|
|
74
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
75
|
-
const myRecipe = recipe({
|
|
76
|
-
base: {
|
|
77
|
-
display: 'flex',
|
|
78
|
-
alignItems: 'center',
|
|
79
|
-
backgroundColor: 'white',
|
|
80
|
-
width: '100%'
|
|
81
|
-
},
|
|
82
|
-
variants: {
|
|
83
|
-
color: {
|
|
84
|
-
blue: {
|
|
85
|
-
position: 'relative',
|
|
86
|
-
backgroundColor: 'blue',
|
|
87
|
-
color: 'white'
|
|
88
|
-
},
|
|
89
|
-
red: {
|
|
90
|
-
position: 'relative',
|
|
91
|
-
backgroundColor: 'red',
|
|
92
|
-
color: 'black'
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
`,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|