@antebudimir/eslint-plugin-vanilla-extract 1.17.0 → 1.18.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.
@@ -0,0 +1,39 @@
1
+ import { createTheme } from '@vanilla-extract/css';
2
+ // Create a theme with design tokens
3
+ export const [themeClass, theme] = createTheme({
4
+ colors: {
5
+ primary: '#3b82f6',
6
+ secondary: '#8b5cf6',
7
+ background: '#ffffff',
8
+ text: '#1f2937',
9
+ error: '#ef4444',
10
+ success: '#10b981',
11
+ warning: '#f59e0b',
12
+ hover: '#2563eb',
13
+ border: '#e5e7eb',
14
+ },
15
+ spacing: {
16
+ xs: '0.25rem',
17
+ sm: '0.5rem',
18
+ md: '1rem',
19
+ lg: '1.5rem',
20
+ xl: '2rem',
21
+ '2xl': '3rem',
22
+ },
23
+ fontSizes: {
24
+ xs: '0.75rem',
25
+ sm: '0.875rem',
26
+ base: '1rem',
27
+ lg: '1.125rem',
28
+ xl: '1.25rem',
29
+ '2xl': '1.5rem',
30
+ '3xl': '1.875rem',
31
+ },
32
+ radii: {
33
+ none: '0',
34
+ sm: '0.125rem',
35
+ md: '0.375rem',
36
+ lg: '0.5rem',
37
+ full: '9999px',
38
+ },
39
+ });
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import preferThemeTokensRule from './css-rules/prefer-theme-tokens/index.js';
12
12
  const vanillaExtract = {
13
13
  meta: {
14
14
  name: '@antebudimir/eslint-plugin-vanilla-extract',
15
- version: '1.17.0',
15
+ version: '1.18.0',
16
16
  },
17
17
  rules: {
18
18
  'alphabetical-order': alphabeticalOrderRule,
@@ -0,0 +1,26 @@
1
+ export declare const badButton: string;
2
+ export declare const badCard: string;
3
+ export declare const badText: string;
4
+ export declare const badBox: string;
5
+ export declare const badComponent: string;
6
+ export declare const badRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
7
+ size: {
8
+ small: {
9
+ fontSize: "12px";
10
+ padding: "8px";
11
+ };
12
+ large: {
13
+ fontSize: "18px";
14
+ padding: "24px";
15
+ };
16
+ };
17
+ variant: {
18
+ primary: {
19
+ backgroundColor: "#3b82f6";
20
+ };
21
+ danger: {
22
+ backgroundColor: "#ef4444";
23
+ };
24
+ };
25
+ }>;
26
+ export declare const badResponsive: string;
@@ -0,0 +1,85 @@
1
+ import { style, globalStyle } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+ // ❌ BAD: Hard-coded colors
4
+ export const badButton = style({
5
+ color: '#ffffff', // Should use theme.colors.text
6
+ backgroundColor: '#3b82f6', // Should use theme.colors.primary
7
+ borderColor: 'rgb(59, 130, 246)', // Should use theme.colors.primary
8
+ });
9
+ // ❌ BAD: Hard-coded spacing
10
+ export const badCard = style({
11
+ padding: '16px', // Should use theme.spacing.md
12
+ margin: '8px', // Should use theme.spacing.sm
13
+ gap: '12px', // Should use theme.spacing between sm and md
14
+ width: '200px', // Should use theme or percentage
15
+ });
16
+ // ❌ BAD: Hard-coded font sizes
17
+ export const badText = style({
18
+ fontSize: '14px', // Should use theme.fontSizes.sm
19
+ lineHeight: '1.5rem', // Should use theme.fontSizes
20
+ });
21
+ // ❌ BAD: Hard-coded border radius
22
+ export const badBox = style({
23
+ borderRadius: '8px', // Should use theme.radii.md
24
+ borderTopLeftRadius: '4px', // Should use theme.radii.sm
25
+ });
26
+ // ❌ BAD: Multiple violations
27
+ export const badComponent = style({
28
+ color: 'red', // Hard-coded color
29
+ backgroundColor: '#f0f0f0', // Hard-coded color
30
+ padding: '20px', // Hard-coded spacing
31
+ margin: '10px 15px', // Hard-coded spacing
32
+ fontSize: '16px', // Hard-coded font size
33
+ borderRadius: '6px', // Hard-coded border radius
34
+ border: '1px solid #ccc', // Hard-coded color in border
35
+ });
36
+ // ❌ BAD: Recipe with hard-coded values
37
+ export const badRecipe = recipe({
38
+ base: {
39
+ color: '#000000', // Hard-coded color
40
+ padding: '12px', // Hard-coded spacing
41
+ },
42
+ variants: {
43
+ size: {
44
+ small: {
45
+ fontSize: '12px', // Hard-coded font size
46
+ padding: '8px', // Hard-coded spacing
47
+ },
48
+ large: {
49
+ fontSize: '18px', // Hard-coded font size
50
+ padding: '24px', // Hard-coded spacing
51
+ },
52
+ },
53
+ variant: {
54
+ primary: {
55
+ backgroundColor: '#3b82f6', // Hard-coded color
56
+ },
57
+ danger: {
58
+ backgroundColor: '#ef4444', // Hard-coded color
59
+ },
60
+ },
61
+ },
62
+ });
63
+ // ❌ BAD: Nested structures with hard-coded values
64
+ export const badResponsive = style({
65
+ color: '#333',
66
+ '@media': {
67
+ '(min-width: 768px)': {
68
+ padding: '32px', // Hard-coded spacing
69
+ fontSize: '20px', // Hard-coded font size
70
+ },
71
+ },
72
+ selectors: {
73
+ '&:hover': {
74
+ backgroundColor: '#e0e0e0', // Hard-coded color
75
+ borderColor: 'blue', // Hard-coded color
76
+ },
77
+ },
78
+ });
79
+ // ❌ BAD: Global styles with hard-coded values
80
+ globalStyle('body', {
81
+ color: '#1f2937', // Hard-coded color
82
+ backgroundColor: '#ffffff', // Hard-coded color
83
+ margin: '0px', // Hard-coded spacing (though 0 is often allowed)
84
+ padding: '0px', // Hard-coded spacing
85
+ });
@@ -0,0 +1,27 @@
1
+ export declare const goodButton: string;
2
+ export declare const goodCard: string;
3
+ export declare const goodText: string;
4
+ export declare const goodBox: string;
5
+ export declare const goodComponent: string;
6
+ export declare const goodRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
7
+ size: {
8
+ small: {
9
+ fontSize: any;
10
+ padding: any;
11
+ };
12
+ large: {
13
+ fontSize: any;
14
+ padding: any;
15
+ };
16
+ };
17
+ variant: {
18
+ primary: {
19
+ backgroundColor: any;
20
+ };
21
+ danger: {
22
+ backgroundColor: any;
23
+ };
24
+ };
25
+ }>;
26
+ export declare const goodResponsive: string;
27
+ export declare const goodMixed: string;
@@ -0,0 +1,94 @@
1
+ import { style, globalStyle } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+ import { theme } from './sample-theme.css';
4
+ // ✅ GOOD: Using theme tokens for colors
5
+ export const goodButton = style({
6
+ color: theme.colors.text,
7
+ backgroundColor: theme.colors.primary,
8
+ borderColor: theme.colors.border,
9
+ });
10
+ // ✅ GOOD: Using theme tokens for spacing
11
+ export const goodCard = style({
12
+ padding: theme.spacing.md,
13
+ margin: theme.spacing.sm,
14
+ gap: theme.spacing.md,
15
+ width: '100%', // Percentages are allowed
16
+ });
17
+ // ✅ GOOD: Using theme tokens for font sizes
18
+ export const goodText = style({
19
+ fontSize: theme.fontSizes.sm,
20
+ lineHeight: theme.fontSizes.base,
21
+ });
22
+ // ✅ GOOD: Using theme tokens for border radius
23
+ export const goodBox = style({
24
+ borderRadius: theme.radii.md,
25
+ borderTopLeftRadius: theme.radii.sm,
26
+ });
27
+ // ✅ GOOD: All theme tokens
28
+ export const goodComponent = style({
29
+ color: theme.colors.text,
30
+ backgroundColor: theme.colors.background,
31
+ padding: theme.spacing.lg,
32
+ margin: `${theme.spacing.sm} ${theme.spacing.md}`,
33
+ fontSize: theme.fontSizes.base,
34
+ borderRadius: theme.radii.md,
35
+ border: `1px solid ${theme.colors.border}`,
36
+ });
37
+ // ✅ GOOD: Recipe with theme tokens
38
+ export const goodRecipe = recipe({
39
+ base: {
40
+ color: theme.colors.text,
41
+ padding: theme.spacing.md,
42
+ },
43
+ variants: {
44
+ size: {
45
+ small: {
46
+ fontSize: theme.fontSizes.sm,
47
+ padding: theme.spacing.sm,
48
+ },
49
+ large: {
50
+ fontSize: theme.fontSizes.xl,
51
+ padding: theme.spacing.xl,
52
+ },
53
+ },
54
+ variant: {
55
+ primary: {
56
+ backgroundColor: theme.colors.primary,
57
+ },
58
+ danger: {
59
+ backgroundColor: theme.colors.error,
60
+ },
61
+ },
62
+ },
63
+ });
64
+ // ✅ GOOD: Nested structures with theme tokens
65
+ export const goodResponsive = style({
66
+ color: theme.colors.text,
67
+ '@media': {
68
+ '(min-width: 768px)': {
69
+ padding: theme.spacing['2xl'],
70
+ fontSize: theme.fontSizes['2xl'],
71
+ },
72
+ },
73
+ selectors: {
74
+ '&:hover': {
75
+ backgroundColor: theme.colors.hover,
76
+ borderColor: theme.colors.primary,
77
+ },
78
+ },
79
+ });
80
+ // ✅ GOOD: Global styles with theme tokens
81
+ globalStyle('body', {
82
+ color: theme.colors.text,
83
+ backgroundColor: theme.colors.background,
84
+ margin: '0', // Special values like '0' are allowed
85
+ padding: '0',
86
+ });
87
+ // ✅ GOOD: Mixed with allowed values
88
+ export const goodMixed = style({
89
+ color: theme.colors.text,
90
+ margin: '0', // '0' is allowed
91
+ padding: 'auto', // 'auto' is allowed
92
+ width: '100%', // Percentages are allowed
93
+ height: 'inherit', // CSS keywords are allowed
94
+ });
@@ -0,0 +1,37 @@
1
+ export declare const themeClass: string, theme: {
2
+ colors: {
3
+ primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
4
+ secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
5
+ background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
6
+ text: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
7
+ error: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
8
+ success: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
9
+ warning: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
10
+ hover: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
11
+ border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
12
+ };
13
+ spacing: {
14
+ xs: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
15
+ sm: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
16
+ md: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
17
+ lg: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
18
+ xl: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
19
+ '2xl': `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
20
+ };
21
+ fontSizes: {
22
+ xs: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
23
+ sm: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
24
+ base: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
25
+ lg: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
26
+ xl: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
27
+ '2xl': `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
28
+ '3xl': `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
29
+ };
30
+ radii: {
31
+ none: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
32
+ sm: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
33
+ md: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
34
+ lg: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
35
+ full: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
36
+ };
37
+ };
@@ -0,0 +1,38 @@
1
+ import { createTheme } from '@vanilla-extract/css';
2
+ export const [themeClass, theme] = createTheme({
3
+ colors: {
4
+ primary: '#3b82f6',
5
+ secondary: '#8b5cf6',
6
+ background: '#ffffff',
7
+ text: '#1f2937',
8
+ error: '#ef4444',
9
+ success: '#10b981',
10
+ warning: '#f59e0b',
11
+ hover: '#2563eb',
12
+ border: '#e5e7eb',
13
+ },
14
+ spacing: {
15
+ xs: '0.25rem',
16
+ sm: '0.5rem',
17
+ md: '1rem',
18
+ lg: '1.5rem',
19
+ xl: '2rem',
20
+ '2xl': '3rem',
21
+ },
22
+ fontSizes: {
23
+ xs: '0.75rem',
24
+ sm: '0.875rem',
25
+ base: '1rem',
26
+ lg: '1.125rem',
27
+ xl: '1.25rem',
28
+ '2xl': '1.5rem',
29
+ '3xl': '1.875rem',
30
+ },
31
+ radii: {
32
+ none: '0',
33
+ sm: '0.125rem',
34
+ md: '0.375rem',
35
+ lg: '0.5rem',
36
+ full: '9999px',
37
+ },
38
+ });
@@ -0,0 +1,75 @@
1
+ export declare const theFont: string;
2
+ export declare const spinster: void;
3
+ export declare const starter: string;
4
+ export declare const accordionContent: import("@vanilla-extract/recipes").RuntimeFn<{
5
+ isOpen: {
6
+ false: {
7
+ boxSizing: "inherit";
8
+ position: "relative";
9
+ right: "inherit";
10
+ display: "flex";
11
+ gap: "revert";
12
+ transform: "none";
13
+ margin: "11rem";
14
+ outline: "none";
15
+ border: "Background";
16
+ borderRight: "ActiveBorder";
17
+ borderLeft: "ActiveBorder";
18
+ borderRadius: "initial";
19
+ borderBottomLeftRadius: "initial";
20
+ borderBottomRightRadius: "initial";
21
+ boxShadow: "none";
22
+ backgroundColor: "initial";
23
+ cursor: "pointer";
24
+ width: "100%";
25
+ color: "red";
26
+ fontSize: "large";
27
+ };
28
+ true: {
29
+ boxSizing: "inherit";
30
+ position: "relative";
31
+ right: "inherit";
32
+ display: "flex";
33
+ gap: "revert";
34
+ transform: "none";
35
+ margin: "11rem";
36
+ outline: "none";
37
+ border: "Background";
38
+ borderRight: "ActiveBorder";
39
+ borderLeft: "ActiveBorder";
40
+ borderRadius: "initial";
41
+ borderBottomLeftRadius: "initial";
42
+ borderBottomRightRadius: "initial";
43
+ boxShadow: "none";
44
+ backgroundColor: "initial";
45
+ cursor: "pointer";
46
+ width: "100%";
47
+ color: "red";
48
+ fontSize: "large";
49
+ ':hover': {
50
+ boxSizing: "inherit";
51
+ position: "relative";
52
+ right: "inherit";
53
+ display: "flex";
54
+ gap: "revert";
55
+ transform: "none";
56
+ margin: "11rem";
57
+ outline: "none";
58
+ border: "Background";
59
+ borderRight: "ActiveBorder";
60
+ borderLeft: "ActiveBorder";
61
+ borderRadius: "initial";
62
+ borderBottomLeftRadius: "initial";
63
+ borderBottomRightRadius: "initial";
64
+ boxShadow: "none";
65
+ backgroundColor: "initial";
66
+ cursor: "pointer";
67
+ width: "100%";
68
+ color: "red";
69
+ fontSize: "large";
70
+ };
71
+ };
72
+ };
73
+ }>;
74
+ export declare const item: string;
75
+ export declare const selectButtonVariants: Record<"bordered" | "borderless", string>;