@antebudimir/eslint-plugin-vanilla-extract 1.0.1

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +242 -0
  3. package/dist/css/test.css.d.ts +159 -0
  4. package/dist/css/test.css.js +468 -0
  5. package/dist/css/testFileForOtherMethods.css.d.ts +3 -0
  6. package/dist/css/testFileForOtherMethods.css.js +101 -0
  7. package/dist/css-rules/alphabetical-order/index.d.ts +2 -0
  8. package/dist/css-rules/alphabetical-order/index.js +2 -0
  9. package/dist/css-rules/alphabetical-order/property-order-enforcer.d.ts +14 -0
  10. package/dist/css-rules/alphabetical-order/property-order-enforcer.js +57 -0
  11. package/dist/css-rules/alphabetical-order/recipe-order-enforcer.d.ts +14 -0
  12. package/dist/css-rules/alphabetical-order/recipe-order-enforcer.js +22 -0
  13. package/dist/css-rules/alphabetical-order/rule-definition.d.ts +3 -0
  14. package/dist/css-rules/alphabetical-order/rule-definition.js +20 -0
  15. package/dist/css-rules/alphabetical-order/style-object-processor.d.ts +15 -0
  16. package/dist/css-rules/alphabetical-order/style-object-processor.js +28 -0
  17. package/dist/css-rules/concentric-order/concentric-groups.d.ts +7 -0
  18. package/dist/css-rules/concentric-order/concentric-groups.js +307 -0
  19. package/dist/css-rules/concentric-order/index.d.ts +2 -0
  20. package/dist/css-rules/concentric-order/index.js +2 -0
  21. package/dist/css-rules/concentric-order/property-order-enforcer.d.ts +16 -0
  22. package/dist/css-rules/concentric-order/property-order-enforcer.js +60 -0
  23. package/dist/css-rules/concentric-order/recipe-order-enforcer.d.ts +14 -0
  24. package/dist/css-rules/concentric-order/recipe-order-enforcer.js +22 -0
  25. package/dist/css-rules/concentric-order/rule-definition.d.ts +3 -0
  26. package/dist/css-rules/concentric-order/rule-definition.js +20 -0
  27. package/dist/css-rules/concentric-order/style-object-processor.d.ts +21 -0
  28. package/dist/css-rules/concentric-order/style-object-processor.js +59 -0
  29. package/dist/css-rules/concentric-order/types.d.ts +8 -0
  30. package/dist/css-rules/concentric-order/types.js +1 -0
  31. package/dist/css-rules/custom-order/property-order-enforcer.d.ts +17 -0
  32. package/dist/css-rules/custom-order/property-order-enforcer.js +67 -0
  33. package/dist/css-rules/custom-order/recipe-order-enforcer.d.ts +16 -0
  34. package/dist/css-rules/custom-order/recipe-order-enforcer.js +24 -0
  35. package/dist/css-rules/custom-order/rule-definition.d.ts +3 -0
  36. package/dist/css-rules/custom-order/rule-definition.js +40 -0
  37. package/dist/css-rules/custom-order/style-object-processor.d.ts +19 -0
  38. package/dist/css-rules/custom-order/style-object-processor.js +52 -0
  39. package/dist/css-rules/shared-utils/css-order-fixer.d.ts +17 -0
  40. package/dist/css-rules/shared-utils/css-order-fixer.js +39 -0
  41. package/dist/css-rules/shared-utils/css-property-priority-map.d.ts +25 -0
  42. package/dist/css-rules/shared-utils/css-property-priority-map.js +48 -0
  43. package/dist/css-rules/shared-utils/nested-selectors-processor.d.ts +25 -0
  44. package/dist/css-rules/shared-utils/nested-selectors-processor.js +35 -0
  45. package/dist/css-rules/shared-utils/order-strategy-visitor-creator.d.ts +17 -0
  46. package/dist/css-rules/shared-utils/order-strategy-visitor-creator.js +76 -0
  47. package/dist/css-rules/shared-utils/property-separator.d.ts +28 -0
  48. package/dist/css-rules/shared-utils/property-separator.js +49 -0
  49. package/dist/css-rules/shared-utils/recipe-property-processor.d.ts +16 -0
  50. package/dist/css-rules/shared-utils/recipe-property-processor.js +37 -0
  51. package/dist/css-rules/shared-utils/style-node-processor.d.ts +9 -0
  52. package/dist/css-rules/shared-utils/style-node-processor.js +22 -0
  53. package/dist/css-sample/sample.css.d.ts +161 -0
  54. package/dist/css-sample/sample.css.js +551 -0
  55. package/dist/index.d.ts +38 -0
  56. package/dist/index.js +37 -0
  57. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ante Budimir
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # @antebudimir/eslint-plugin-vanilla-extract
2
+
3
+ An ESLint plugin for enforcing CSS ordering in vanilla-extract css styles. Available presets are for alphabetical and
4
+ [concentric](https://rhodesmill.org/brandon/2011/concentric-css/) CSS ordering. The plugin also supports a custom group ordering option based on groups available in concentric CSS.
5
+
6
+ ## Features
7
+
8
+ - Enforces CSS property ordering in vanilla-extract style objects with two available presets:
9
+ - Alphabetical ordering for clean, predictable style organization
10
+ - Concentric ordering for logical, outside-in property arrangement
11
+ - Custom group ordering option for more fine-grained control
12
+ - Built for ESLint 9 flat config system
13
+ - Provides auto-fix capability to automatically sort properties
14
+ - Handles multiple vanilla-extract APIs (style, styleVariants, recipe, globalStyle, etc.)
15
+ - Handles complex cases like nested objects, arrays of styles, and pseudo selectors
16
+ - Works with camelCase properties as used in vanilla-extract
17
+
18
+ <!-- TODO: test with pre-react 18 edu-portal app to see if eslint v8 is supported -->
19
+ ## Requirements
20
+
21
+ - ESLint 9.0.0 or higher
22
+ - Node.js 18.18.0 or higher
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ # Using npm
28
+ npm install --save-dev @antebudimir/eslint-plugin-vanilla-extract
29
+
30
+ # Using yarn
31
+ yarn add --dev @antebudimir/eslint-plugin-vanilla-extract
32
+
33
+ # Using pnpm
34
+ pnpm add -D @antebudimir/eslint-plugin-vanilla-extract
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ ### ESLint Flat Config (ESLint 9+)
40
+
41
+ Create or update your `eslint.config.js` or `eslint.config.mjs` file:
42
+
43
+ ```typescript
44
+ import vanillaExtract from '@antebudimir/eslint-plugin-vanilla-extract';
45
+
46
+ export default [
47
+ {
48
+ files: ['**/*.css.ts'],
49
+ ignores: ['src/**/theme-contract.css.ts'],
50
+ plugins: {
51
+ 'vanilla-extract': vanillaExtract,
52
+ },
53
+ rules: {
54
+ // 'vanilla-extract/alphabetical-order': 'warn',
55
+ // OR
56
+ // 'vanilla-extract/concentric-order': 'warn',
57
+ // OR
58
+ 'vanilla-extract/custom-order': [
59
+ 'warn',
60
+ {
61
+ groupOrder: ['font', 'dimensions', 'margin', 'padding', 'position', 'border'], // example group order
62
+ // optional
63
+ sortRemainingProperties: 'concentric', // 'alphabetical' is default
64
+ },
65
+ ],
66
+ },
67
+ },
68
+ ];
69
+ ```
70
+
71
+ ## Rules
72
+
73
+ ### vanilla-extract/alphabetical-order
74
+
75
+ This rule enforces that CSS properties in vanilla-extract style objects follow alphabetical ordering.
76
+
77
+ ```typescript
78
+ // ❌ Incorrect
79
+ import { style } from '@vanilla-extract/css';
80
+
81
+ export const myStyle = style({
82
+ display: 'flex',
83
+ justifyContent: 'center',
84
+ alignItems: 'center',
85
+ height: 19,
86
+ marginBottom: 1,
87
+ marginLeft: 2,
88
+ });
89
+
90
+ // ✅ Correct
91
+ import { style } from '@vanilla-extract/css';
92
+
93
+ export const myStyle = style({
94
+ alignItems: 'center',
95
+ display: 'flex',
96
+ height: 19,
97
+ justifyContent: 'center',
98
+ marginBottom: 1,
99
+ marginLeft: 2,
100
+ });
101
+ ```
102
+
103
+ ### vanilla-extract/concentric-order
104
+
105
+ This rule enforces that CSS properties in vanilla-extract style objects follow the concentric CSS ordering pattern,
106
+ which organizes properties from outside to inside.
107
+
108
+ ```typescript
109
+ // ❌ Incorrect
110
+ import { style } from '@vanilla-extract/css';
111
+
112
+ export const myStyle = style({
113
+ color: 'red',
114
+ display: 'flex',
115
+ position: 'relative',
116
+ padding: '10px',
117
+ margin: '20px',
118
+ });
119
+
120
+ // ✅ Correct
121
+ import { style } from '@vanilla-extract/css';
122
+
123
+ export const myStyle = style({
124
+ position: 'relative',
125
+ display: 'flex',
126
+ margin: '20px',
127
+ padding: '10px',
128
+ color: 'red',
129
+ });
130
+ ```
131
+
132
+ ### vanilla-extract/custom-order
133
+
134
+ The `vanilla-extract/custom-order` rule allows you to enforce a custom ordering of CSS properties in your vanilla-extract styles. You can specify an array of property groups in the order you prefer, and the rule will ensure that properties within these groups are sorted according to their position in the concentric CSS model. All other groups that aren't included in the groups array will have their respective properties sorted after the last group in the array. You can choose to sort them either alphabetically or following the concentric CSS order (see list of concentric groups) by setting the `sortRemainingProperties` option to 'alphabetical' or 'concentric' respectively. If not set, `sortRemainingProperties` defaults to 'alphabetical'.
135
+
136
+ To configure the rule, add it to your ESLint configuration file with your desired options. You can customize the `groups` array to include any number of available CSS property groups you want to enforce, but minimum of 1 is required.
137
+
138
+ Example usage:
139
+
140
+ ```typescript
141
+ // ❌ Incorrect (Unordered)
142
+ import { style } from '@vanilla-extract/css';
143
+
144
+ export const myStyle = style({
145
+ color: 'blue',
146
+ padding: '10px',
147
+ fontFamily: 'Arial, sans-serif',
148
+ margin: '20px',
149
+ width: '200px',
150
+ border: '1px solid black',
151
+ display: 'flex',
152
+ });
153
+
154
+ // ✅ Correct
155
+ import { style } from '@vanilla-extract/css';
156
+
157
+ export const myStyle = style({
158
+ // font group
159
+ fontFamily: 'Arial, sans-serif',
160
+ color: 'blue',
161
+
162
+ // dimensions group
163
+ width: '200px',
164
+
165
+ // margin group
166
+ margin: '20px',
167
+
168
+ // padding group
169
+ padding: '10px',
170
+
171
+ // display group
172
+ display: 'flex',
173
+
174
+ // border group
175
+ border: '1px solid black',
176
+ });
177
+ ```
178
+
179
+ ## Concentric CSS Model
180
+
181
+ Here's a list of all available groups from the provided concentricGroups array:
182
+
183
+ 1. boxSizing
184
+ 2. position
185
+ 3. display
186
+ 4. flex
187
+ 5. grid
188
+ 6. alignment
189
+ 7. columns
190
+ 8. transform
191
+ 9. transitions
192
+ 10. visibility
193
+ 11. shape
194
+ 12. margin
195
+ 13. outline
196
+ 14. border
197
+ 15. boxShadow
198
+ 16. background
199
+ 17. cursor
200
+ 18. padding
201
+ 19. dimensions
202
+ 20. overflow
203
+ 21. listStyle
204
+ 22. tables
205
+ 23. animation
206
+ 24. text
207
+ 25. textSpacing
208
+ 26. font
209
+ 27. content
210
+ 28. counters
211
+ 29. breaks
212
+
213
+ These groups represent different categories of CSS properties, organized in a concentric order from outside to inside. Each group contains related CSS properties that affect specific aspects of an element's styling and layout.
214
+
215
+ ## Roadmap
216
+
217
+ The roadmap outlines the project's current status and future plans:
218
+
219
+ ### Completed Milestones
220
+
221
+ - Initial release with support for alphabetical, concentric, and custom group CSS ordering.
222
+ - Auto-fix capability integrated into ESLint.
223
+ - Support for multiple vanilla-extract APIs (e.g., `style`, `styleVariants`, `recipe`, `globalStyle` etc.).
224
+
225
+ ### Current Work
226
+
227
+ - Compatibility testing to determine if the plugin works with ESLint v8. **Note**: There are no immediate plans to ensure compatibility if issues arise. Upcoming features will be prioritized.
228
+
229
+ ### Upcoming Features
230
+
231
+ - Begin work on test coverage.
232
+ - Support for additional vanilla-extract APIs, including `fontFace`, `globalFontFace`, `globalKeyframes`, and `keyframes`.
233
+ - Option to sort properties within user-defined concentric groups alphabetically instead of following the concentric order. **Note**: This feature will only be implemented if there's sufficient interest from the community.
234
+
235
+ ## Contributing
236
+
237
+ All well-intentioned contributions are welcome, of course! Please feel free to submit a Pull Request or get in touch via
238
+ GitHub issues.
239
+
240
+ ## License
241
+
242
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,159 @@
1
+ export declare const root: string;
2
+ export declare const item: string;
3
+ export declare const selectButtonVariants: Record<"bordered" | "borderless", string>;
4
+ export declare const trigger: import("@vanilla-extract/recipes").RuntimeFn<{
5
+ isOpen: {
6
+ false: {
7
+ margin: "0";
8
+ fontSize: "large";
9
+ border: "Background";
10
+ borderRight: "ActiveBorder";
11
+ borderLeft: "ActiveBorder";
12
+ borderRadius: "initial";
13
+ borderBottomLeftRadius: "initial";
14
+ borderBottomRightRadius: "initial";
15
+ boxShadow: "none";
16
+ boxSizing: "inherit";
17
+ position: "relative";
18
+ right: "inherit";
19
+ display: "flex";
20
+ gap: "revert";
21
+ transform: "none";
22
+ outline: "none";
23
+ backgroundColor: "initial";
24
+ cursor: "pointer";
25
+ color: "red";
26
+ ':hover': {
27
+ margin: "0";
28
+ fontSize: "large";
29
+ border: "Background";
30
+ borderRight: "ActiveBorder";
31
+ borderLeft: "ActiveBorder";
32
+ borderRadius: "initial";
33
+ borderBottomLeftRadius: "initial";
34
+ borderBottomRightRadius: "initial";
35
+ boxShadow: "none";
36
+ boxSizing: "inherit";
37
+ position: "relative";
38
+ right: "inherit";
39
+ display: "flex";
40
+ gap: "revert";
41
+ transform: "none";
42
+ outline: "none";
43
+ backgroundColor: "initial";
44
+ cursor: "pointer";
45
+ color: "red";
46
+ };
47
+ };
48
+ true: {
49
+ margin: "0";
50
+ fontSize: "large";
51
+ border: "Background";
52
+ borderRight: "ActiveBorder";
53
+ borderLeft: "ActiveBorder";
54
+ borderRadius: "initial";
55
+ borderBottomLeftRadius: "initial";
56
+ borderBottomRightRadius: "initial";
57
+ boxShadow: "none";
58
+ boxSizing: "inherit";
59
+ position: "relative";
60
+ right: "inherit";
61
+ display: "flex";
62
+ gap: "revert";
63
+ transform: "none";
64
+ outline: "none";
65
+ backgroundColor: "initial";
66
+ cursor: "pointer";
67
+ color: "red";
68
+ ':hover': {
69
+ margin: "0";
70
+ fontSize: "large";
71
+ border: "Background";
72
+ borderRight: "ActiveBorder";
73
+ borderLeft: "ActiveBorder";
74
+ borderRadius: "initial";
75
+ borderBottomLeftRadius: "initial";
76
+ borderBottomRightRadius: "initial";
77
+ boxShadow: "none";
78
+ boxSizing: "inherit";
79
+ position: "relative";
80
+ right: "inherit";
81
+ display: "flex";
82
+ gap: "revert";
83
+ transform: "none";
84
+ outline: "none";
85
+ backgroundColor: "initial";
86
+ cursor: "pointer";
87
+ color: "red";
88
+ };
89
+ };
90
+ };
91
+ }>;
92
+ export declare const accordionContent: import("@vanilla-extract/recipes").RuntimeFn<{
93
+ isOpen: {
94
+ false: {
95
+ margin: "0";
96
+ fontSize: "large";
97
+ border: "Background";
98
+ borderRight: "ActiveBorder";
99
+ borderLeft: "ActiveBorder";
100
+ borderRadius: "initial";
101
+ borderBottomLeftRadius: "initial";
102
+ borderBottomRightRadius: "initial";
103
+ boxShadow: "none";
104
+ boxSizing: "inherit";
105
+ position: "relative";
106
+ right: "inherit";
107
+ display: "flex";
108
+ gap: "revert";
109
+ transform: "none";
110
+ outline: "none";
111
+ backgroundColor: "initial";
112
+ cursor: "pointer";
113
+ color: "red";
114
+ };
115
+ true: {
116
+ margin: "0";
117
+ fontSize: "large";
118
+ border: "Background";
119
+ borderRight: "ActiveBorder";
120
+ borderLeft: "ActiveBorder";
121
+ borderRadius: "initial";
122
+ borderBottomLeftRadius: "initial";
123
+ borderBottomRightRadius: "initial";
124
+ boxShadow: "none";
125
+ boxSizing: "inherit";
126
+ position: "relative";
127
+ right: "inherit";
128
+ display: "flex";
129
+ gap: "revert";
130
+ transform: "none";
131
+ outline: "none";
132
+ backgroundColor: "initial";
133
+ cursor: "pointer";
134
+ color: "red";
135
+ ':focus-visible': {
136
+ margin: "0";
137
+ fontSize: "large";
138
+ border: "Background";
139
+ borderRight: "ActiveBorder";
140
+ borderLeft: "ActiveBorder";
141
+ borderRadius: "initial";
142
+ borderBottomLeftRadius: "initial";
143
+ borderBottomRightRadius: "initial";
144
+ boxShadow: "none";
145
+ boxSizing: "inherit";
146
+ position: "relative";
147
+ right: "inherit";
148
+ display: "flex";
149
+ gap: "revert";
150
+ transform: "none";
151
+ outline: "none";
152
+ backgroundColor: "initial";
153
+ cursor: "pointer";
154
+ color: "red";
155
+ };
156
+ };
157
+ };
158
+ }>;
159
+ export declare const clearAllFiltersButton: string;