@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.
- 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,53 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import testRuleForPropertyNameExtractor from './test-property-name-rule.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/property-name-extractor-tests',
|
|
6
|
-
rule: testRuleForPropertyNameExtractor,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Test for identifier and string literal keys (should return names)
|
|
16
|
-
`
|
|
17
|
-
import { style } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const myStyle = style({
|
|
20
|
-
color: 'blue',
|
|
21
|
-
'background-color': 'white',
|
|
22
|
-
fontSize: '16px'
|
|
23
|
-
});
|
|
24
|
-
`,
|
|
25
|
-
// Test for computed property with non-string literal (should return empty string)
|
|
26
|
-
`
|
|
27
|
-
import { style } from '@vanilla-extract/css';
|
|
28
|
-
|
|
29
|
-
const myStyle = style({
|
|
30
|
-
[42]: 'numeric key',
|
|
31
|
-
[true]: 'boolean key'
|
|
32
|
-
});
|
|
33
|
-
`,
|
|
34
|
-
// Test for computed property with complex expression
|
|
35
|
-
`
|
|
36
|
-
import { style } from '@vanilla-extract/css';
|
|
37
|
-
|
|
38
|
-
const myStyle = style({
|
|
39
|
-
[Math.random() > 0.5 ? 'dynamicKey' : 'otherKey']: 'dynamic value'
|
|
40
|
-
});
|
|
41
|
-
`,
|
|
42
|
-
// Test for property with template literal key
|
|
43
|
-
`
|
|
44
|
-
import { style } from '@vanilla-extract/css';
|
|
45
|
-
|
|
46
|
-
const prefix = 'webkit';
|
|
47
|
-
const myStyle = style({
|
|
48
|
-
[\`-\${prefix}-appearance\`]: 'none'
|
|
49
|
-
});
|
|
50
|
-
`,
|
|
51
|
-
],
|
|
52
|
-
invalid: [],
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../../alphabetical-order/rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/recipe-property-processor-tests',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Test for recipe with spread element (should trigger the early return)
|
|
16
|
-
`
|
|
17
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
18
|
-
import { style } from '@vanilla-extract/css';
|
|
19
|
-
|
|
20
|
-
const baseStyle = style({ backgroundColor: 'blue', color: 'white' });
|
|
21
|
-
|
|
22
|
-
const myRecipe = recipe({
|
|
23
|
-
base: baseStyle,
|
|
24
|
-
...{ someSpreadProperty: true },
|
|
25
|
-
variants: {
|
|
26
|
-
size: {
|
|
27
|
-
small: style({ fontSize: '1.2rem', padding: '4rem' }),
|
|
28
|
-
large: style({ fontSize: '1.8rem', padding: '12rem' })
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
`,
|
|
33
|
-
// Test for recipe with computed property (non-Identifier key)
|
|
34
|
-
`
|
|
35
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
36
|
-
import { style } from '@vanilla-extract/css';
|
|
37
|
-
|
|
38
|
-
const propName = 'dynamicProp';
|
|
39
|
-
const baseStyle = style({ backgroundColor: 'blue', color: 'white' });
|
|
40
|
-
|
|
41
|
-
const myRecipe = recipe({
|
|
42
|
-
base: baseStyle,
|
|
43
|
-
[propName]: style({ fontSize: '1.4rem' }),
|
|
44
|
-
variants: {
|
|
45
|
-
size: {
|
|
46
|
-
small: style({ fontSize: '1.2rem', padding: '4rem' }),
|
|
47
|
-
large: style({ fontSize: '1.8rem', padding: '12rem' })
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
`,
|
|
52
|
-
// Test for recipe with non-object values (should skip processing)
|
|
53
|
-
`
|
|
54
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
55
|
-
import { style } from '@vanilla-extract/css';
|
|
56
|
-
|
|
57
|
-
const baseStyle = style({ backgroundColor: 'blue', color: 'white' });
|
|
58
|
-
|
|
59
|
-
const myRecipe = recipe({
|
|
60
|
-
base: baseStyle,
|
|
61
|
-
nonObjectProp: 'string value',
|
|
62
|
-
numericProp: 42,
|
|
63
|
-
booleanProp: true,
|
|
64
|
-
nullProp: null,
|
|
65
|
-
variants: {
|
|
66
|
-
size: {
|
|
67
|
-
small: style({ fontSize: '1.2rem', padding: '4rem' }),
|
|
68
|
-
large: style({ fontSize: '1.8rem', padding: '12rem' })
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
`,
|
|
73
|
-
],
|
|
74
|
-
invalid: [
|
|
75
|
-
// Basic recipe with incorrect ordering in style calls
|
|
76
|
-
{
|
|
77
|
-
code: `
|
|
78
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
79
|
-
import { style } from '@vanilla-extract/css';
|
|
80
|
-
|
|
81
|
-
const baseStyle = style({ color: 'blue', backgroundColor: 'white' });
|
|
82
|
-
|
|
83
|
-
const myRecipe = recipe({
|
|
84
|
-
base: baseStyle,
|
|
85
|
-
variants: {
|
|
86
|
-
size: {
|
|
87
|
-
small: style({ padding: '4rem', fontSize: '1.2rem' }),
|
|
88
|
-
large: style({ padding: '12rem', fontSize: '1.8rem' })
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
`,
|
|
93
|
-
errors: [
|
|
94
|
-
{ messageId: 'alphabeticalOrder' },
|
|
95
|
-
{ messageId: 'alphabeticalOrder' },
|
|
96
|
-
{ messageId: 'alphabeticalOrder' },
|
|
97
|
-
],
|
|
98
|
-
output: `
|
|
99
|
-
import { recipe } from '@vanilla-extract/recipes';
|
|
100
|
-
import { style } from '@vanilla-extract/css';
|
|
101
|
-
|
|
102
|
-
const baseStyle = style({ backgroundColor: 'white', color: 'blue' });
|
|
103
|
-
|
|
104
|
-
const myRecipe = recipe({
|
|
105
|
-
base: baseStyle,
|
|
106
|
-
variants: {
|
|
107
|
-
size: {
|
|
108
|
-
small: style({ fontSize: '1.2rem', padding: '4rem' }),
|
|
109
|
-
large: style({ fontSize: '1.8rem', padding: '12rem' })
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
`,
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import tsParser from '@typescript-eslint/parser';
|
|
2
|
-
import { run } from 'eslint-vitest-rule-tester';
|
|
3
|
-
import alphabeticalOrderRule from '../../alphabetical-order/rule-definition.js';
|
|
4
|
-
run({
|
|
5
|
-
name: 'vanilla-extract/style-node-processor-tests',
|
|
6
|
-
rule: alphabeticalOrderRule,
|
|
7
|
-
languageOptions: {
|
|
8
|
-
parser: tsParser,
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 2022,
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
valid: [
|
|
15
|
-
// Test for empty array
|
|
16
|
-
`
|
|
17
|
-
import { style } from '@vanilla-extract/css';
|
|
18
|
-
|
|
19
|
-
const emptyStyle = style([]);
|
|
20
|
-
`,
|
|
21
|
-
// Test for null/undefined handling
|
|
22
|
-
`
|
|
23
|
-
import { style } from '@vanilla-extract/css';
|
|
24
|
-
|
|
25
|
-
const dynamicStyle = style(undefined);
|
|
26
|
-
const nullStyle = style(null);
|
|
27
|
-
`,
|
|
28
|
-
],
|
|
29
|
-
invalid: [
|
|
30
|
-
// Test for array with mixed content
|
|
31
|
-
{
|
|
32
|
-
code: `
|
|
33
|
-
import { style } from '@vanilla-extract/css';
|
|
34
|
-
|
|
35
|
-
const myStyle = style([
|
|
36
|
-
{ zIndex: 1, position: 'relative' },
|
|
37
|
-
null,
|
|
38
|
-
undefined,
|
|
39
|
-
{ display: 'flex', alignItems: 'center' }
|
|
40
|
-
]);
|
|
41
|
-
`,
|
|
42
|
-
errors: [{ messageId: 'alphabeticalOrder' }, { messageId: 'alphabeticalOrder' }],
|
|
43
|
-
output: `
|
|
44
|
-
import { style } from '@vanilla-extract/css';
|
|
45
|
-
|
|
46
|
-
const myStyle = style([
|
|
47
|
-
{ position: 'relative', zIndex: 1 },
|
|
48
|
-
null,
|
|
49
|
-
undefined,
|
|
50
|
-
{ alignItems: 'center', display: 'flex' }
|
|
51
|
-
]);
|
|
52
|
-
`,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getPropertyName } from '../property-separator.js';
|
|
2
|
-
const testRuleForPropertyNameExtractor = {
|
|
3
|
-
meta: {
|
|
4
|
-
type: 'suggestion',
|
|
5
|
-
docs: {
|
|
6
|
-
description: 'enforce test rule for property name extraction',
|
|
7
|
-
category: 'Stylistic Issues',
|
|
8
|
-
recommended: false,
|
|
9
|
-
},
|
|
10
|
-
fixable: undefined,
|
|
11
|
-
schema: [],
|
|
12
|
-
messages: {
|
|
13
|
-
emptyName: 'Property name extraction returned an empty string for this property',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
create() {
|
|
17
|
-
return {
|
|
18
|
-
ObjectExpression(node) {
|
|
19
|
-
// Extract property names without enforcing any order
|
|
20
|
-
node.properties.forEach((property) => {
|
|
21
|
-
if (property.type === 'Property') {
|
|
22
|
-
// Test the getPropertyName function
|
|
23
|
-
getPropertyName(property);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
export default testRuleForPropertyNameExtractor;
|