@antebudimir/eslint-plugin-vanilla-extract 1.4.6 → 1.4.7

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.
Files changed (52) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -1
  3. package/dist/css-rules/alphabetical-order/__tests__/animation.test.d.ts +0 -1
  4. package/dist/css-rules/alphabetical-order/__tests__/animation.test.js +0 -108
  5. package/dist/css-rules/alphabetical-order/__tests__/font-face.test.d.ts +0 -1
  6. package/dist/css-rules/alphabetical-order/__tests__/font-face.test.js +0 -138
  7. package/dist/css-rules/alphabetical-order/__tests__/global.test.d.ts +0 -1
  8. package/dist/css-rules/alphabetical-order/__tests__/global.test.js +0 -51
  9. package/dist/css-rules/alphabetical-order/__tests__/recipe.test.d.ts +0 -1
  10. package/dist/css-rules/alphabetical-order/__tests__/recipe.test.js +0 -91
  11. package/dist/css-rules/alphabetical-order/__tests__/style.test.d.ts +0 -1
  12. package/dist/css-rules/alphabetical-order/__tests__/style.test.js +0 -108
  13. package/dist/css-rules/alphabetical-order/__tests__/variants.test.d.ts +0 -1
  14. package/dist/css-rules/alphabetical-order/__tests__/variants.test.js +0 -63
  15. package/dist/css-rules/concentric-order/__tests__/animation.test.d.ts +0 -1
  16. package/dist/css-rules/concentric-order/__tests__/animation.test.js +0 -69
  17. package/dist/css-rules/concentric-order/__tests__/font-face.test.d.ts +0 -1
  18. package/dist/css-rules/concentric-order/__tests__/font-face.test.js +0 -94
  19. package/dist/css-rules/concentric-order/__tests__/global.test.d.ts +0 -1
  20. package/dist/css-rules/concentric-order/__tests__/global.test.js +0 -57
  21. package/dist/css-rules/concentric-order/__tests__/recipe.test.d.ts +0 -1
  22. package/dist/css-rules/concentric-order/__tests__/recipe.test.js +0 -100
  23. package/dist/css-rules/concentric-order/__tests__/style.test.d.ts +0 -1
  24. package/dist/css-rules/concentric-order/__tests__/style.test.js +0 -126
  25. package/dist/css-rules/concentric-order/__tests__/variants.test.d.ts +0 -1
  26. package/dist/css-rules/concentric-order/__tests__/variants.test.js +0 -133
  27. package/dist/css-rules/custom-order/__tests__/animation.test.d.ts +0 -1
  28. package/dist/css-rules/custom-order/__tests__/animation.test.js +0 -148
  29. package/dist/css-rules/custom-order/__tests__/font-face.test.d.ts +0 -1
  30. package/dist/css-rules/custom-order/__tests__/font-face.test.js +0 -124
  31. package/dist/css-rules/custom-order/__tests__/global.test.d.ts +0 -1
  32. package/dist/css-rules/custom-order/__tests__/global.test.js +0 -124
  33. package/dist/css-rules/custom-order/__tests__/recipe.test.d.ts +0 -1
  34. package/dist/css-rules/custom-order/__tests__/recipe.test.js +0 -208
  35. package/dist/css-rules/custom-order/__tests__/style.test.d.ts +0 -1
  36. package/dist/css-rules/custom-order/__tests__/style.test.js +0 -249
  37. package/dist/css-rules/custom-order/__tests__/variants.test.d.ts +0 -1
  38. package/dist/css-rules/custom-order/__tests__/variants.test.js +0 -184
  39. package/dist/css-rules/shared-utils/__tests__/css-property-priority-map.test.d.ts +0 -1
  40. package/dist/css-rules/shared-utils/__tests__/css-property-priority-map.test.js +0 -37
  41. package/dist/css-rules/shared-utils/__tests__/font-face-property-order-enforcer.test.d.ts +0 -1
  42. package/dist/css-rules/shared-utils/__tests__/font-face-property-order-enforcer.test.js +0 -58
  43. package/dist/css-rules/shared-utils/__tests__/order-strategy-visitor-creator.test.d.ts +0 -1
  44. package/dist/css-rules/shared-utils/__tests__/order-strategy-visitor-creator.test.js +0 -125
  45. package/dist/css-rules/shared-utils/__tests__/property-name-extractor.test.d.ts +0 -1
  46. package/dist/css-rules/shared-utils/__tests__/property-name-extractor.test.js +0 -53
  47. package/dist/css-rules/shared-utils/__tests__/recipe-property-processor.test.d.ts +0 -1
  48. package/dist/css-rules/shared-utils/__tests__/recipe-property-processor.test.js +0 -116
  49. package/dist/css-rules/shared-utils/__tests__/style-node-processor.test.d.ts +0 -1
  50. package/dist/css-rules/shared-utils/__tests__/style-node-processor.test.js +0 -55
  51. package/dist/css-rules/shared-utils/__tests__/test-property-name-rule.d.ts +0 -3
  52. package/dist/css-rules/shared-utils/__tests__/test-property-name-rule.js +0 -30
@@ -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,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,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,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,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,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
- });