@antebudimir/eslint-plugin-vanilla-extract 1.12.0 → 1.14.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.
Files changed (34) hide show
  1. package/README.md +90 -14
  2. package/dist/css-rules/no-px-unit/_tests_/no-px-unit.test.d.ts +1 -0
  3. package/dist/css-rules/no-px-unit/_tests_/no-px-unit.test.js +163 -0
  4. package/dist/css-rules/no-px-unit/index.d.ts +2 -0
  5. package/dist/css-rules/no-px-unit/index.js +2 -0
  6. package/dist/css-rules/no-px-unit/no-px-unit-visitor-creator.d.ts +2 -0
  7. package/dist/css-rules/no-px-unit/no-px-unit-visitor-creator.js +55 -0
  8. package/dist/css-rules/no-px-unit/processor.d.ts +3 -0
  9. package/dist/css-rules/no-px-unit/processor.js +93 -0
  10. package/dist/css-rules/no-px-unit/px-unit-processor.d.ts +14 -0
  11. package/dist/css-rules/no-px-unit/px-unit-processor.js +104 -0
  12. package/dist/css-rules/no-px-unit/px-unit-visitor-creator.d.ts +11 -0
  13. package/dist/css-rules/no-px-unit/px-unit-visitor-creator.js +64 -0
  14. package/dist/css-rules/no-px-unit/rule-definition.d.ts +3 -0
  15. package/dist/css-rules/no-px-unit/rule-definition.js +37 -0
  16. package/dist/css-rules/no-px-unit/visitor-creator.d.ts +2 -0
  17. package/dist/css-rules/no-px-unit/visitor-creator.js +55 -0
  18. package/dist/css-rules/prefer-logical-properties/_tests_/prefer-logical-properties.test.d.ts +1 -0
  19. package/dist/css-rules/prefer-logical-properties/_tests_/prefer-logical-properties.test.js +572 -0
  20. package/dist/css-rules/prefer-logical-properties/index.d.ts +2 -0
  21. package/dist/css-rules/prefer-logical-properties/index.js +2 -0
  22. package/dist/css-rules/prefer-logical-properties/logical-properties-processor.d.ts +19 -0
  23. package/dist/css-rules/prefer-logical-properties/logical-properties-processor.js +202 -0
  24. package/dist/css-rules/prefer-logical-properties/logical-properties-visitor-creator.d.ts +14 -0
  25. package/dist/css-rules/prefer-logical-properties/logical-properties-visitor-creator.js +67 -0
  26. package/dist/css-rules/prefer-logical-properties/property-mappings.d.ts +44 -0
  27. package/dist/css-rules/prefer-logical-properties/property-mappings.js +179 -0
  28. package/dist/css-rules/prefer-logical-properties/rule-definition.d.ts +3 -0
  29. package/dist/css-rules/prefer-logical-properties/rule-definition.js +35 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +5 -1
  32. package/dist/sample.css.d.ts +75 -0
  33. package/dist/sample.css.js +540 -0
  34. package/package.json +2 -2
@@ -0,0 +1,540 @@
1
+ import { fontFace, globalFontFace, globalKeyframes, globalStyle, keyframes, style, styleVariants, } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+ // fontFaces
4
+ export const theFont = fontFace({
5
+ // Comment to test that the linter doesn't remove it
6
+ src: ['url("/fonts/MyFont.woff2") format("woff2")', 'url("/fonts/MyFont.woff") format("woff")'],
7
+ ascentOverride: '90%',
8
+ descentOverride: '10%',
9
+ fontDisplay: 'swap',
10
+ fontFeatureSettings: '"liga" 1',
11
+ fontStretch: 'normal',
12
+ fontStyle: 'normal',
13
+ fontVariant: 'normal',
14
+ fontVariationSettings: '"wght" 400',
15
+ fontWeight: '400 700',
16
+ lineGapOverride: '10%',
17
+ sizeAdjust: '90%',
18
+ unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
19
+ });
20
+ globalFontFace('GlobalFont', {
21
+ // Comment to test that the linter doesn't remove it
22
+ src: ['url("/fonts/MyFont.woff2") format("woff2")', 'url("/fonts/MyFont.woff") format("woff")'],
23
+ ascentOverride: '90%',
24
+ descentOverride: '10%',
25
+ fontDisplay: 'swap',
26
+ fontFeatureSettings: '"liga" 1',
27
+ fontStretch: 'normal',
28
+ fontStyle: 'normal',
29
+ fontVariant: 'normal',
30
+ fontVariationSettings: '"wght" 400',
31
+ fontWeight: '400 700',
32
+ lineGapOverride: '10%',
33
+ sizeAdjust: '90%',
34
+ unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
35
+ });
36
+ // keyframes
37
+ export const spinster = globalKeyframes('spin', {
38
+ // Comment to test that the linter doesn't remove it
39
+ from: {
40
+ boxSizing: 'inherit',
41
+ position: 'relative',
42
+ insetInlineEnd: 'inherit',
43
+ display: 'flex',
44
+ gap: 'revert',
45
+ transform: 'none',
46
+ margin: '11rem',
47
+ outline: 'none',
48
+ border: 'Background',
49
+ borderRadius: 'initial',
50
+ borderEndStartRadius: 'initial',
51
+ borderEndEndRadius: 'initial',
52
+ borderInlineStart: 'ActiveBorder',
53
+ borderInlineEnd: 'ActiveBorder',
54
+ boxShadow: 'none',
55
+ backgroundColor: 'initial',
56
+ cursor: 'pointer',
57
+ inlineSize: '100%',
58
+ color: 'red',
59
+ fontSize: 'large',
60
+ },
61
+ // Comment to test that the linter doesn't remove it
62
+ to: {
63
+ // Comment to test that the linter doesn't remove it
64
+ boxSizing: 'inherit',
65
+ position: 'relative',
66
+ insetInlineEnd: 'inherit',
67
+ display: 'flex',
68
+ gap: 'revert',
69
+ transform: 'none',
70
+ margin: '11rem',
71
+ outline: 'none',
72
+ border: 'Background',
73
+ borderRadius: 'initial',
74
+ borderEndStartRadius: 'initial',
75
+ borderEndEndRadius: 'initial',
76
+ borderInlineStart: 'ActiveBorder',
77
+ borderInlineEnd: 'ActiveBorder',
78
+ boxShadow: 'none',
79
+ backgroundColor: 'initial',
80
+ cursor: 'pointer',
81
+ inlineSize: '100%',
82
+ color: 'red',
83
+ fontSize: 'large',
84
+ },
85
+ });
86
+ export const starter = keyframes({
87
+ // Comment to test that the linter doesn't remove it
88
+ '0%': {
89
+ boxSizing: 'inherit',
90
+ position: 'relative',
91
+ insetInlineEnd: 'inherit',
92
+ display: 'flex',
93
+ gap: 'revert',
94
+ transform: 'none',
95
+ margin: '11rem',
96
+ outline: 'none',
97
+ border: 'Background',
98
+ borderRadius: 'initial',
99
+ borderEndStartRadius: 'initial',
100
+ borderEndEndRadius: 'initial',
101
+ borderInlineStart: 'ActiveBorder',
102
+ borderInlineEnd: 'ActiveBorder',
103
+ boxShadow: 'none',
104
+ backgroundColor: 'initial',
105
+ cursor: 'pointer',
106
+ inlineSize: '100%',
107
+ color: 'red',
108
+ fontSize: 'large',
109
+ },
110
+ // Comment to test that the linter doesn't remove it
111
+ '100%': {
112
+ // Comment to test that the linter doesn't remove it
113
+ boxSizing: 'inherit',
114
+ position: 'relative',
115
+ insetInlineEnd: 'inherit',
116
+ display: 'flex',
117
+ gap: 'revert',
118
+ transform: 'none',
119
+ margin: '11rem',
120
+ outline: 'none',
121
+ border: 'Background',
122
+ borderRadius: 'initial',
123
+ borderEndStartRadius: 'initial',
124
+ borderEndEndRadius: 'initial',
125
+ borderInlineStart: 'ActiveBorder',
126
+ borderInlineEnd: 'ActiveBorder',
127
+ boxShadow: 'none',
128
+ backgroundColor: 'initial',
129
+ cursor: 'pointer',
130
+ inlineSize: '100%',
131
+ color: 'red',
132
+ fontSize: 'large',
133
+ },
134
+ });
135
+ globalStyle('*, ::before, ::after', {
136
+ // Comment to test that the linter doesn't remove it
137
+ boxSizing: 'inherit',
138
+ position: 'relative',
139
+ insetInlineEnd: 'inherit',
140
+ display: 'flex',
141
+ gap: 'revert',
142
+ transform: 'none',
143
+ margin: '11rem',
144
+ outline: 'none',
145
+ border: 'Background',
146
+ borderRadius: 'initial',
147
+ borderEndStartRadius: 'initial',
148
+ borderEndEndRadius: 'initial',
149
+ borderInlineStart: 'ActiveBorder',
150
+ borderInlineEnd: 'ActiveBorder',
151
+ backgroundColor: 'initial',
152
+ cursor: 'pointer',
153
+ inlineSize: '100%',
154
+ color: 'red',
155
+ fontSize: 'large',
156
+ });
157
+ // style with an array
158
+ const accordionContentBase = style([
159
+ // Comment to test that the linter doesn't remove it
160
+ {
161
+ // Comment to test that the linter doesn't remove it
162
+ boxSizing: 'inherit',
163
+ position: 'relative',
164
+ insetInlineEnd: 'inherit',
165
+ display: 'flex',
166
+ gap: 'revert',
167
+ transform: 'none',
168
+ margin: '11rem',
169
+ outline: 'none',
170
+ border: 'Background',
171
+ borderRadius: 'initial',
172
+ borderEndStartRadius: 'initial',
173
+ borderEndEndRadius: 'initial',
174
+ borderInlineStart: 'ActiveBorder',
175
+ borderInlineEnd: 'ActiveBorder',
176
+ boxShadow: 'none',
177
+ backgroundColor: 'initial',
178
+ cursor: 'pointer',
179
+ inlineSize: '100%',
180
+ color: 'red',
181
+ fontSize: 'large',
182
+ // special selector to test that the linter doesn't remove it
183
+ '@supports': {
184
+ '(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none)': {
185
+ // Comment to test that the linter doesn't remove it
186
+ boxSizing: 'inherit',
187
+ position: 'relative',
188
+ insetInlineEnd: 'inherit',
189
+ display: 'flex',
190
+ gap: 'revert',
191
+ transform: 'none',
192
+ margin: '11rem',
193
+ outline: 'none',
194
+ border: 'Background',
195
+ borderRadius: 'initial',
196
+ borderEndStartRadius: 'initial',
197
+ borderEndEndRadius: 'initial',
198
+ borderInlineStart: 'ActiveBorder',
199
+ borderInlineEnd: 'ActiveBorder',
200
+ boxShadow: 'none',
201
+ backgroundColor: 'initial',
202
+ cursor: 'pointer',
203
+ inlineSize: '100%',
204
+ color: 'red',
205
+ fontSize: 'large',
206
+ },
207
+ },
208
+ },
209
+ ]);
210
+ export const accordionContent = recipe({
211
+ // Comment to test that the linter doesn't remove it
212
+ base: accordionContentBase,
213
+ // Comment to test that the linter doesn't remove it
214
+ variants: {
215
+ // Comment to test that the linter doesn't remove it
216
+ isOpen: {
217
+ // Comment to test that the linter doesn't remove it
218
+ false: {
219
+ // Comment to test that the linter doesn't remove it
220
+ boxSizing: 'inherit',
221
+ position: 'relative',
222
+ insetInlineEnd: 'inherit',
223
+ display: 'flex',
224
+ gap: 'revert',
225
+ transform: 'none',
226
+ margin: '11rem',
227
+ outline: 'none',
228
+ border: 'Background',
229
+ borderRadius: 'initial',
230
+ borderEndStartRadius: 'initial',
231
+ borderEndEndRadius: 'initial',
232
+ borderInlineStart: 'ActiveBorder',
233
+ borderInlineEnd: 'ActiveBorder',
234
+ boxShadow: 'none',
235
+ backgroundColor: 'initial',
236
+ cursor: 'pointer',
237
+ inlineSize: '100%',
238
+ color: 'red',
239
+ fontSize: 'large',
240
+ },
241
+ true: {
242
+ boxSizing: 'inherit',
243
+ position: 'relative',
244
+ insetInlineEnd: 'inherit',
245
+ display: 'flex',
246
+ gap: 'revert',
247
+ transform: 'none',
248
+ margin: '11rem',
249
+ outline: 'none',
250
+ border: 'Background',
251
+ borderRadius: 'initial',
252
+ borderEndStartRadius: 'initial',
253
+ borderEndEndRadius: 'initial',
254
+ borderInlineStart: 'ActiveBorder',
255
+ borderInlineEnd: 'ActiveBorder',
256
+ boxShadow: 'none',
257
+ backgroundColor: 'initial',
258
+ cursor: 'pointer',
259
+ inlineSize: '100%',
260
+ color: 'red',
261
+ fontSize: 'large',
262
+ // pseudo selector inside a variant
263
+ ':hover': {
264
+ // Comment to test that the linter doesn't remove it
265
+ boxSizing: 'inherit',
266
+ position: 'relative',
267
+ insetInlineEnd: 'inherit',
268
+ display: 'flex',
269
+ gap: 'revert',
270
+ transform: 'none',
271
+ margin: '11rem',
272
+ outline: 'none',
273
+ border: 'Background',
274
+ borderRadius: 'initial',
275
+ borderEndStartRadius: 'initial',
276
+ borderEndEndRadius: 'initial',
277
+ borderInlineStart: 'ActiveBorder',
278
+ borderInlineEnd: 'ActiveBorder',
279
+ boxShadow: 'none',
280
+ backgroundColor: 'initial',
281
+ cursor: 'pointer',
282
+ inlineSize: '100%',
283
+ color: 'red',
284
+ fontSize: 'large',
285
+ },
286
+ },
287
+ },
288
+ },
289
+ });
290
+ export const item = style({
291
+ boxSizing: 'inherit',
292
+ position: 'relative',
293
+ insetInlineEnd: 'inherit',
294
+ display: 'flex',
295
+ gap: 'revert',
296
+ transform: 'none',
297
+ margin: '11rem',
298
+ outline: 'none',
299
+ border: 'Background',
300
+ borderRadius: 'initial',
301
+ borderEndStartRadius: 'initial',
302
+ borderEndEndRadius: 'initial',
303
+ borderInlineStart: 'ActiveBorder',
304
+ borderInlineEnd: 'ActiveBorder',
305
+ backgroundColor: 'initial',
306
+ cursor: 'pointer',
307
+ inlineSize: '100%',
308
+ color: 'red',
309
+ fontSize: 'large',
310
+ // pseudo selector inside a style
311
+ ':focus-visible': {
312
+ // Comment to test that the linter doesn't remove it
313
+ boxSizing: 'inherit',
314
+ position: 'relative',
315
+ insetInlineEnd: 'inherit',
316
+ display: 'flex',
317
+ gap: 'revert',
318
+ transform: 'none',
319
+ margin: '11rem',
320
+ outline: 'none',
321
+ border: 'Background',
322
+ borderRadius: 'initial',
323
+ borderEndStartRadius: 'initial',
324
+ borderEndEndRadius: 'initial',
325
+ borderInlineStart: 'ActiveBorder',
326
+ borderInlineEnd: 'ActiveBorder',
327
+ boxShadow: 'none',
328
+ backgroundColor: 'initial',
329
+ cursor: 'pointer',
330
+ inlineSize: '100%',
331
+ color: 'red',
332
+ fontSize: 'large',
333
+ },
334
+ selectors: {
335
+ // Comment to test that the linter doesn't remove it
336
+ '&[data-pressed]': {
337
+ // Comment to test that the linter doesn't remove it
338
+ boxSizing: 'inherit',
339
+ position: 'relative',
340
+ insetInlineEnd: 'inherit',
341
+ display: 'flex',
342
+ gap: 'revert',
343
+ transform: 'none',
344
+ margin: '11rem',
345
+ outline: 'none',
346
+ border: 'Background',
347
+ borderRadius: 'initial',
348
+ borderEndStartRadius: 'initial',
349
+ borderEndEndRadius: 'initial',
350
+ borderInlineStart: 'ActiveBorder',
351
+ borderInlineEnd: 'ActiveBorder',
352
+ boxShadow: 'none',
353
+ backgroundColor: 'initial',
354
+ cursor: 'pointer',
355
+ inlineSize: '100%',
356
+ color: 'red',
357
+ fontSize: 'large',
358
+ },
359
+ },
360
+ });
361
+ export const selectButtonVariants = styleVariants({
362
+ // Comment to test that the linter doesn't remove it
363
+ bordered: {
364
+ // Comment to test that the linter doesn't remove it
365
+ boxSizing: 'inherit',
366
+ position: 'relative',
367
+ insetInlineEnd: 'inherit',
368
+ display: 'flex',
369
+ gap: 'revert',
370
+ transform: 'none',
371
+ margin: '11rem',
372
+ marginInlineStart: '11rem',
373
+ outline: 'none',
374
+ border: 'Background',
375
+ borderRadius: 'initial',
376
+ borderEndStartRadius: 'initial',
377
+ borderEndEndRadius: 'initial',
378
+ borderInlineStart: 'ActiveBorder',
379
+ borderInlineEnd: 'ActiveBorder',
380
+ backgroundColor: 'initial',
381
+ cursor: 'pointer',
382
+ inlineSize: '100%',
383
+ color: 'red',
384
+ fontSize: 'large',
385
+ },
386
+ borderless: {
387
+ boxSizing: 'inherit',
388
+ position: 'relative',
389
+ insetInlineEnd: 'inherit',
390
+ display: 'flex',
391
+ gap: 'revert',
392
+ transform: 'none',
393
+ margin: '11rem',
394
+ outline: 'none',
395
+ border: 'Background',
396
+ borderRadius: 'initial',
397
+ borderEndStartRadius: 'initial',
398
+ borderEndEndRadius: 'initial',
399
+ borderInlineStart: 'ActiveBorder',
400
+ borderInlineEnd: 'ActiveBorder',
401
+ boxShadow: 'none',
402
+ backgroundColor: 'initial',
403
+ cursor: 'pointer',
404
+ inlineSize: '100%',
405
+ color: 'red',
406
+ fontSize: 'large',
407
+ },
408
+ });
409
+ // Test cases for noEmptyStyleBlocksRule
410
+ // export const myRecipe = recipe({
411
+ // base: {
412
+ // color: 'blue',
413
+ // selectors: {},
414
+ // '@media': {},
415
+ // '@supports': {},
416
+ // },
417
+ // variants: {
418
+ // size: {
419
+ // small: {
420
+ // selectors: {
421
+ // '&:hover': {},
422
+ // },
423
+ // '@media': {
424
+ // '(min-width: 768px)': {},
425
+ // },
426
+ // '@supports': {
427
+ // '(display: grid)': {},
428
+ // },
429
+ // },
430
+ // },
431
+ // },
432
+ // });
433
+ // const base = style({ padding: 12 });
434
+ // export const variant = styleVariants({
435
+ // primary: [],
436
+ // secondary: [],
437
+ // bordered: {},
438
+ // borderless: {},
439
+ // });
440
+ // const baseStyles = {
441
+ // color: 'blue',
442
+ // margin: '10px',
443
+ // };
444
+ // const isDarkMode = false;
445
+ // export const spreadStyle = style({
446
+ // ...baseStyles,
447
+ // ...{},
448
+ // });
449
+ // export const recipeWithNonObjectValue = recipe({
450
+ // base: { color: 'black' },
451
+ // variants: {
452
+ // color: {
453
+ // red: { color: 'red' },
454
+ // // string instead of object
455
+ // string: 'string',
456
+ // // variable instead of object
457
+ // variable: baseStyles,
458
+ // },
459
+ // },
460
+ // });
461
+ // export const conditionalStyle = style(isDarkMode ? {} : {});
462
+ // export const recipeWithEmptyVariantValues = recipe({
463
+ // base: { color: 'black' },
464
+ // variants: {
465
+ // color: {
466
+ // blue: {},
467
+ // red: {},
468
+ // },
469
+ // },
470
+ // });
471
+ // export const nestedEmptyStyle = style({
472
+ // selectors: {
473
+ // '&:hover': {},
474
+ // '&:focus': {},
475
+ // },
476
+ // });
477
+ // const myEmptyStyle = style({});
478
+ // export { myEmptyStyle };
479
+ // export const emptyStyle1 = style({});
480
+ // export const emptyStyle2 = style({});
481
+ // export const emptyVariants = styleVariants({});
482
+ // export const emptyRecipe = recipe({});
483
+ // export const styleWithComments = style({
484
+ // /_This is an empty style_/
485
+ // });
486
+ // export const styleWithEmptyMedia = style({
487
+ // color: 'blue',
488
+ // '@media': {
489
+ // '(min-width: 768px)': {},
490
+ // },
491
+ // });
492
+ // export const styleWithEmptySelector = style({
493
+ // color: 'blue',
494
+ // selectors: {
495
+ // '&:hover': {},
496
+ // },
497
+ // });
498
+ // export const recipeWithBothEmpty = recipe({
499
+ // base: {},
500
+ // variants: {},
501
+ // });
502
+ // export const recipeWithEmptyVariants = recipe({
503
+ // base: { color: 'black' },
504
+ // variants: {},
505
+ // });
506
+ // export const recipeWithEmptyBase = recipe({
507
+ // base: {},
508
+ // variants: {
509
+ // color: {
510
+ // blue: { color: 'blue' },
511
+ // },
512
+ // },
513
+ // });
514
+ // export const recipe = recipe({
515
+ // base: {},
516
+ // variants: {
517
+ // color: {
518
+ // red: {},
519
+ // blue: {},
520
+ // },
521
+ // },
522
+ // });
523
+ // export const recipeWithNonObjectVariants = recipe({
524
+ // base: { color: 'blue' },
525
+ // variants: {
526
+ // color: {
527
+ // size: 'string instead of object', // This is a string, not an object
528
+ // red: {},
529
+ // },
530
+ // },
531
+ // });
532
+ // Using the same empty object reference in both branches
533
+ // export const myStyle = style(true ? {} : {});
534
+ // export const emptyFontFace = fontFace({});
535
+ // globalFontFace('GlobalFont', {});
536
+ // globalKeyframes('a', {});
537
+ // export const emptyKeyframes = keyframes({});
538
+ // globalStyle('ul', {});
539
+ // export const emptyStyleVariants = styleVariants({});
540
+ // export const emptyStyle = style({});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antebudimir/eslint-plugin-vanilla-extract",
3
- "version": "1.12.0",
4
- "description": "ESLint plugin for enforcing best practices in vanilla-extract CSS styles, including CSS property ordering and additional linting rules.",
3
+ "version": "1.14.0",
4
+ "description": "Comprehensive ESLint plugin for vanilla-extract with CSS property ordering, style validation, and best practices enforcement. Supports alphabetical, concentric and custom CSS ordering, auto-fixing, and zero-runtime safety.",
5
5
  "author": "Ante Budimir",
6
6
  "license": "MIT",
7
7
  "keywords": [