@adyen/eslint-plugin-bento 2.22.0 → 2.24.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.
- package/CHANGELOG.md +33 -0
- package/README.md +31 -15
- package/configs/vue-recommended.js +16 -0
- package/configs/vue-strict.js +17 -1
- package/index.js +3 -0
- package/package.json +3 -3
- package/rules/deprecation-bento-tag-variant-enum/README.md +69 -0
- package/rules/deprecation-bento-tag-variant-enum/deprecation-bento-tag-variant-enum.js +167 -0
- package/rules/deprecation-filter-bar-deprecated-props/README.md +7 -0
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +14 -3
- package/rules/vue-no-redundant-dialog-v-if/README.md +55 -0
- package/rules/vue-no-redundant-dialog-v-if/vue-no-redundant-dialog-v-if.js +150 -0
- package/rules/vue-no-use-bento-translation-overrides/README.md +14 -0
- package/rules/vue-no-use-bento-translation-overrides/vue-no-use-bento-translation-overrides.js +93 -0
- package/utils/component-slot-migration.js +22 -4
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/deprecation-bento-data-grid-cell-action-menu-item-handler.vue +0 -63
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/deprecation-bento-data-grid-cell-action-menu-item-handler.integration.test.ts +0 -24
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/deprecation-bento-data-grid-cell-action-menu-item-handler.test.ts +0 -116
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -10
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/eslint.config.js +0 -29
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -11
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/eslint.config.js +0 -29
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.integration.test.ts +0 -47
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.test.ts +0 -176
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +0 -9
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +0 -33
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +0 -101
- package/rules/deprecation-bento-popover-modifiers-prop/__tests__/deprecation-bento-popover-modifiers-prop.vue +0 -9
- package/rules/deprecation-bento-popover-modifiers-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.integration.test.ts +0 -24
- package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.test.ts +0 -109
- package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/deprecation-bento-timeline-item-variant-prop.vue +0 -9
- package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.integration.test.ts +0 -35
- package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.test.ts +0 -141
- package/rules/deprecation-components-aria-label-prop/__tests__/deprecation-components-aria-label-prop.vue +0 -25
- package/rules/deprecation-components-aria-label-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.integration.test.ts +0 -36
- package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.test.ts +0 -194
- package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +0 -17
- package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +0 -41
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +0 -153
- package/rules/deprecation-components-has-error-prop/__tests__/deprecation-components-has-error-prop.vue +0 -13
- package/rules/deprecation-components-has-error-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.integration.test.ts +0 -37
- package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.test.ts +0 -122
- package/rules/deprecation-components-input-emit/__tests__/deprecation-components-input-emit.vue +0 -22
- package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.integration.test.ts +0 -43
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +0 -320
- package/rules/deprecation-components-value-prop/__tests__/deprecation-components-value-prop.vue +0 -69
- package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.integration.test.ts +0 -37
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +0 -480
- package/rules/deprecation-country-custom-usage/__tests__/deprecation-country-custom-usage.vue +0 -93
- package/rules/deprecation-country-custom-usage/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.integration.test.ts +0 -22
- package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.test.ts +0 -380
- package/rules/deprecation-currency-default-slot/__tests__/deprecation-currency-default-slot.vue +0 -7
- package/rules/deprecation-currency-default-slot/__tests__/eslint.config.js +0 -24
- package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.integration.test.ts +0 -29
- package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.test.ts +0 -136
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +0 -62
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +0 -22
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +0 -467
- package/rules/deprecation-input-filter-dropdown-options/__tests__/deprecation-input-filter-dropdown-options.vue +0 -46
- package/rules/deprecation-input-filter-dropdown-options/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.integration.test.ts +0 -27
- package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.test.ts +0 -392
- package/rules/deprecation-tag-default-slot/__tests__/deprecation-tag-default-slot.vue +0 -5
- package/rules/deprecation-tag-default-slot/__tests__/eslint.config.js +0 -24
- package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.integration.test.ts +0 -29
- package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.test.ts +0 -145
- package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +0 -24
- package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +0 -15
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +0 -29
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +0 -403
- package/rules/vue-old-spacer-tokens/__tests__/eslint.config.js +0 -24
- package/rules/vue-old-spacer-tokens/__tests__/vue-old-spacer-tokens.vue +0 -5
- package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.integration.test.ts +0 -29
- package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.test.ts +0 -77
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationInputFilterDropdownOptions from './deprecation-input-filter-dropdown-options';
|
|
5
|
-
|
|
6
|
-
const ruleTester = new RuleTester({
|
|
7
|
-
languageOptions: {
|
|
8
|
-
ecmaVersion: 'latest',
|
|
9
|
-
sourceType: 'module',
|
|
10
|
-
parser: vueParser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
parser: tsParser,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('@adyen/bento/deprecation-input-filter-dropdown-options', () => {
|
|
18
|
-
ruleTester.run('deprecation-input-filter-dropdown-options (no autofix)', deprecationInputFilterDropdownOptions, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid: INPUT filter without deprecated options',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<script setup>
|
|
25
|
-
const config = [{
|
|
26
|
-
field: 'name',
|
|
27
|
-
label: 'Name',
|
|
28
|
-
type: BentoFilterItemType.INPUT,
|
|
29
|
-
options: { placeholder: 'Search...' },
|
|
30
|
-
}];
|
|
31
|
-
</script>
|
|
32
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
33
|
-
`,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'Valid: INPUT_DROPDOWN filter with dropdown options',
|
|
37
|
-
filename: 'test.vue',
|
|
38
|
-
code: `
|
|
39
|
-
<script setup>
|
|
40
|
-
const config = [{
|
|
41
|
-
field: 'name',
|
|
42
|
-
label: 'Name',
|
|
43
|
-
type: BentoFilterItemType.INPUT_DROPDOWN,
|
|
44
|
-
options: { dropdown: { items: [] }, dropdownPosition: 'start' },
|
|
45
|
-
}];
|
|
46
|
-
</script>
|
|
47
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
48
|
-
`,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'Valid: SELECT filter with different options',
|
|
52
|
-
filename: 'test.vue',
|
|
53
|
-
code: `
|
|
54
|
-
<script setup>
|
|
55
|
-
const config = [{
|
|
56
|
-
field: 'status',
|
|
57
|
-
label: 'Status',
|
|
58
|
-
type: BentoFilterItemType.SELECT,
|
|
59
|
-
options: { listboxItems: [] },
|
|
60
|
-
}];
|
|
61
|
-
</script>
|
|
62
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
63
|
-
`,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'Valid: INPUT filter without deprecated options in bento-data-grid',
|
|
67
|
-
filename: 'test.vue',
|
|
68
|
-
code: `
|
|
69
|
-
<script setup>
|
|
70
|
-
const filters = [{
|
|
71
|
-
field: 'name',
|
|
72
|
-
label: 'Name',
|
|
73
|
-
type: BentoFilterItemType.INPUT,
|
|
74
|
-
options: { placeholder: 'Search...' },
|
|
75
|
-
}];
|
|
76
|
-
</script>
|
|
77
|
-
<template><bento-data-grid :filters="filters" /></template>
|
|
78
|
-
`,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'Valid: INPUT filter with computed property key in options (not a static key)',
|
|
82
|
-
filename: 'test.vue',
|
|
83
|
-
code: `
|
|
84
|
-
<script setup>
|
|
85
|
-
const key = 'dropdown';
|
|
86
|
-
const config = [{
|
|
87
|
-
type: BentoFilterItemType.INPUT,
|
|
88
|
-
options: { [key]: { items: [] } },
|
|
89
|
-
}];
|
|
90
|
-
</script>
|
|
91
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
92
|
-
`,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'Valid: config object with spread properties',
|
|
96
|
-
filename: 'test.vue',
|
|
97
|
-
code: `
|
|
98
|
-
<script setup>
|
|
99
|
-
const base = { field: 'name' };
|
|
100
|
-
const config = [{
|
|
101
|
-
...base,
|
|
102
|
-
type: BentoFilterItemType.INPUT,
|
|
103
|
-
options: { placeholder: 'Search...' },
|
|
104
|
-
}];
|
|
105
|
-
</script>
|
|
106
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
107
|
-
`,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'Valid: config object with string literal keys and non-INPUT type',
|
|
111
|
-
filename: 'test.vue',
|
|
112
|
-
code: `
|
|
113
|
-
<script setup>
|
|
114
|
-
const config = [{
|
|
115
|
-
'type': BentoFilterItemType.SELECT,
|
|
116
|
-
'options': { dropdown: true },
|
|
117
|
-
}];
|
|
118
|
-
</script>
|
|
119
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
120
|
-
`,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
invalid: [
|
|
124
|
-
{
|
|
125
|
-
name: 'Invalid: INPUT filter with dropdown option',
|
|
126
|
-
filename: 'test.vue',
|
|
127
|
-
code: `
|
|
128
|
-
<script setup>
|
|
129
|
-
const config = [{
|
|
130
|
-
field: 'name',
|
|
131
|
-
label: 'Name',
|
|
132
|
-
type: BentoFilterItemType.INPUT,
|
|
133
|
-
options: { dropdown: { items: [] } },
|
|
134
|
-
}];
|
|
135
|
-
</script>
|
|
136
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
137
|
-
`,
|
|
138
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: 'Invalid: INPUT filter with dropdownPosition option',
|
|
142
|
-
filename: 'test.vue',
|
|
143
|
-
code: `
|
|
144
|
-
<script setup>
|
|
145
|
-
const config = [{
|
|
146
|
-
field: 'name',
|
|
147
|
-
label: 'Name',
|
|
148
|
-
type: BentoFilterItemType.INPUT,
|
|
149
|
-
options: { dropdownPosition: 'end' },
|
|
150
|
-
}];
|
|
151
|
-
</script>
|
|
152
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
153
|
-
`,
|
|
154
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdownPosition' } }],
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: 'Invalid: INPUT filter with variant option',
|
|
158
|
-
filename: 'test.vue',
|
|
159
|
-
code: `
|
|
160
|
-
<script setup>
|
|
161
|
-
const config = [{
|
|
162
|
-
field: 'name',
|
|
163
|
-
label: 'Name',
|
|
164
|
-
type: BentoFilterItemType.INPUT,
|
|
165
|
-
options: { variant: 'dropdown' },
|
|
166
|
-
}];
|
|
167
|
-
</script>
|
|
168
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
169
|
-
`,
|
|
170
|
-
errors: [{ messageId: 'deprecation', data: { key: 'variant' } }],
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: 'Invalid: INPUT filter with all three deprecated options',
|
|
174
|
-
filename: 'test.vue',
|
|
175
|
-
code: `
|
|
176
|
-
<script setup>
|
|
177
|
-
const config = [{
|
|
178
|
-
field: 'name',
|
|
179
|
-
label: 'Name',
|
|
180
|
-
type: BentoFilterItemType.INPUT,
|
|
181
|
-
options: { dropdown: { items: [] }, dropdownPosition: 'end', variant: 'dropdown' },
|
|
182
|
-
}];
|
|
183
|
-
</script>
|
|
184
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
185
|
-
`,
|
|
186
|
-
errors: [
|
|
187
|
-
{ messageId: 'deprecation', data: { key: 'dropdown' } },
|
|
188
|
-
{ messageId: 'deprecation', data: { key: 'dropdownPosition' } },
|
|
189
|
-
{ messageId: 'deprecation', data: { key: 'variant' } },
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: 'Invalid: INPUT filter using string literal type',
|
|
194
|
-
filename: 'test.vue',
|
|
195
|
-
code: `
|
|
196
|
-
<script setup>
|
|
197
|
-
const config = [{
|
|
198
|
-
field: 'name',
|
|
199
|
-
label: 'Name',
|
|
200
|
-
type: 'BentoInputFilter',
|
|
201
|
-
options: { dropdown: { items: [] } },
|
|
202
|
-
}];
|
|
203
|
-
</script>
|
|
204
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
205
|
-
`,
|
|
206
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'Invalid: INPUT filter with deprecated options defined inline in template',
|
|
210
|
-
filename: 'test.vue',
|
|
211
|
-
code: `
|
|
212
|
-
<template>
|
|
213
|
-
<bento-filter-bar :config="[{
|
|
214
|
-
field: 'name',
|
|
215
|
-
label: 'Name',
|
|
216
|
-
type: BentoFilterItemType.INPUT,
|
|
217
|
-
options: { dropdown: { items: [] }, variant: 'dropdown' },
|
|
218
|
-
}]" />
|
|
219
|
-
</template>
|
|
220
|
-
`,
|
|
221
|
-
errors: [
|
|
222
|
-
{ messageId: 'deprecation', data: { key: 'dropdown' } },
|
|
223
|
-
{ messageId: 'deprecation', data: { key: 'variant' } },
|
|
224
|
-
],
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: 'Invalid: INPUT filter with string literal keys',
|
|
228
|
-
filename: 'test.vue',
|
|
229
|
-
code: `
|
|
230
|
-
<script setup>
|
|
231
|
-
const config = [{
|
|
232
|
-
'type': 'BentoInputFilter',
|
|
233
|
-
'options': { 'dropdown': { items: [] } },
|
|
234
|
-
}];
|
|
235
|
-
</script>
|
|
236
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
237
|
-
`,
|
|
238
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: 'Invalid: INPUT filter with spread and deprecated options',
|
|
242
|
-
filename: 'test.vue',
|
|
243
|
-
code: `
|
|
244
|
-
<script setup>
|
|
245
|
-
const base = { field: 'name' };
|
|
246
|
-
const config = [{
|
|
247
|
-
...base,
|
|
248
|
-
type: BentoFilterItemType.INPUT,
|
|
249
|
-
options: { ...base, dropdown: { items: [] } },
|
|
250
|
-
}];
|
|
251
|
-
</script>
|
|
252
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
253
|
-
`,
|
|
254
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'Invalid: INPUT filter with dropdown option in bento-data-grid filters',
|
|
258
|
-
filename: 'test.vue',
|
|
259
|
-
code: `
|
|
260
|
-
<script setup>
|
|
261
|
-
const filters = [{
|
|
262
|
-
field: 'name',
|
|
263
|
-
label: 'Name',
|
|
264
|
-
type: BentoFilterItemType.INPUT,
|
|
265
|
-
options: { dropdown: { items: [] }, variant: 'dropdown' },
|
|
266
|
-
}];
|
|
267
|
-
</script>
|
|
268
|
-
<template><bento-data-grid :filters="filters" /></template>
|
|
269
|
-
`,
|
|
270
|
-
errors: [
|
|
271
|
-
{ messageId: 'deprecation', data: { key: 'dropdown' } },
|
|
272
|
-
{ messageId: 'deprecation', data: { key: 'variant' } },
|
|
273
|
-
],
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
ruleTester.run(
|
|
279
|
-
'deprecation-input-filter-dropdown-options (autofix enabled)',
|
|
280
|
-
deprecationInputFilterDropdownOptions,
|
|
281
|
-
{
|
|
282
|
-
valid: [
|
|
283
|
-
{
|
|
284
|
-
name: 'Valid: INPUT filter without deprecated options (autofix enabled)',
|
|
285
|
-
filename: 'test.vue',
|
|
286
|
-
options: [{ autofix: true }],
|
|
287
|
-
code: `
|
|
288
|
-
<script setup>
|
|
289
|
-
const config = [{
|
|
290
|
-
type: BentoFilterItemType.INPUT,
|
|
291
|
-
options: { placeholder: 'Search...' },
|
|
292
|
-
}];
|
|
293
|
-
</script>
|
|
294
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
295
|
-
`,
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
invalid: [
|
|
299
|
-
{
|
|
300
|
-
name: 'Autofix: changes BentoFilterItemType.INPUT to INPUT_DROPDOWN',
|
|
301
|
-
filename: 'test.vue',
|
|
302
|
-
options: [{ autofix: true }],
|
|
303
|
-
code: `
|
|
304
|
-
<script setup>
|
|
305
|
-
const config = [{
|
|
306
|
-
type: BentoFilterItemType.INPUT,
|
|
307
|
-
options: { dropdown: { items: [] } },
|
|
308
|
-
}];
|
|
309
|
-
</script>
|
|
310
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
311
|
-
`,
|
|
312
|
-
output: `
|
|
313
|
-
<script setup>
|
|
314
|
-
const config = [{
|
|
315
|
-
type: BentoFilterItemType.INPUT_DROPDOWN,
|
|
316
|
-
options: { dropdown: { items: [] } },
|
|
317
|
-
}];
|
|
318
|
-
</script>
|
|
319
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
320
|
-
`,
|
|
321
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
name: 'Autofix: changes string literal type to BentoInputWithDropdownFilter',
|
|
325
|
-
filename: 'test.vue',
|
|
326
|
-
options: [{ autofix: true }],
|
|
327
|
-
code: `
|
|
328
|
-
<script setup>
|
|
329
|
-
const config = [{
|
|
330
|
-
type: 'BentoInputFilter',
|
|
331
|
-
options: { dropdown: { items: [] } },
|
|
332
|
-
}];
|
|
333
|
-
</script>
|
|
334
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
335
|
-
`,
|
|
336
|
-
output: `
|
|
337
|
-
<script setup>
|
|
338
|
-
const config = [{
|
|
339
|
-
type: 'BentoInputWithDropdownFilter',
|
|
340
|
-
options: { dropdown: { items: [] } },
|
|
341
|
-
}];
|
|
342
|
-
</script>
|
|
343
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
344
|
-
`,
|
|
345
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
name: 'Autofix: fixes type with multiple deprecated options',
|
|
349
|
-
filename: 'test.vue',
|
|
350
|
-
options: [{ autofix: true }],
|
|
351
|
-
code: `
|
|
352
|
-
<script setup>
|
|
353
|
-
const config = [{
|
|
354
|
-
type: BentoFilterItemType.INPUT,
|
|
355
|
-
options: { dropdown: { items: [] }, variant: 'dropdown' },
|
|
356
|
-
}];
|
|
357
|
-
</script>
|
|
358
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
359
|
-
`,
|
|
360
|
-
output: `
|
|
361
|
-
<script setup>
|
|
362
|
-
const config = [{
|
|
363
|
-
type: BentoFilterItemType.INPUT_DROPDOWN,
|
|
364
|
-
options: { dropdown: { items: [] }, variant: 'dropdown' },
|
|
365
|
-
}];
|
|
366
|
-
</script>
|
|
367
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
368
|
-
`,
|
|
369
|
-
errors: [
|
|
370
|
-
{ messageId: 'deprecation', data: { key: 'dropdown' } },
|
|
371
|
-
{ messageId: 'deprecation', data: { key: 'variant' } },
|
|
372
|
-
],
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: 'Autofix: does not apply fix when autofix is false',
|
|
376
|
-
filename: 'test.vue',
|
|
377
|
-
options: [{ autofix: false }],
|
|
378
|
-
code: `
|
|
379
|
-
<script setup>
|
|
380
|
-
const config = [{
|
|
381
|
-
type: BentoFilterItemType.INPUT,
|
|
382
|
-
options: { dropdown: { items: [] } },
|
|
383
|
-
}];
|
|
384
|
-
</script>
|
|
385
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
386
|
-
`,
|
|
387
|
-
errors: [{ messageId: 'deprecation', data: { key: 'dropdown' } }],
|
|
388
|
-
},
|
|
389
|
-
],
|
|
390
|
-
}
|
|
391
|
-
);
|
|
392
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('eslint/config');
|
|
2
|
-
const vueParser = require('vue-eslint-parser');
|
|
3
|
-
const tsParser = require('@typescript-eslint/parser');
|
|
4
|
-
const adyenBento = require('@adyen/eslint-plugin-bento');
|
|
5
|
-
|
|
6
|
-
module.exports = defineConfig([
|
|
7
|
-
{
|
|
8
|
-
languageOptions: {
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
sourceType: 'module',
|
|
11
|
-
parser: vueParser,
|
|
12
|
-
parserOptions: {
|
|
13
|
-
parser: tsParser,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
plugins: {
|
|
17
|
-
'@adyen/bento': adyenBento,
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
'@adyen/bento/deprecation-tag-default-slot': 'warn',
|
|
21
|
-
},
|
|
22
|
-
files: ['**/*.vue'],
|
|
23
|
-
},
|
|
24
|
-
]);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { execFileSyncEslintVueFiles } from '../../utils/exec-file-sync-eslint-vue-files';
|
|
3
|
-
|
|
4
|
-
describe('@adyen/bento/deprecation-tag-default-slot', () => {
|
|
5
|
-
it('should lint with warning', () => {
|
|
6
|
-
// Load .eslintrc
|
|
7
|
-
const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
|
|
8
|
-
// Load the test file
|
|
9
|
-
const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-tag-default-slot.vue');
|
|
10
|
-
|
|
11
|
-
// Execute the linter
|
|
12
|
-
const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
|
|
13
|
-
|
|
14
|
-
// Expects a warning with a suggestion/fix and an error message
|
|
15
|
-
expect(result[0].warningCount).toBe(1);
|
|
16
|
-
expect(result[0].messages[0]).toStrictEqual({
|
|
17
|
-
ruleId: '@adyen/bento/deprecation-tag-default-slot',
|
|
18
|
-
severity: 1,
|
|
19
|
-
message: '"default" slot is deprecated in favor of the "label" property',
|
|
20
|
-
messageId: 'migrateDefaultSlot',
|
|
21
|
-
line: 2,
|
|
22
|
-
column: 5,
|
|
23
|
-
nodeType: 'VElement',
|
|
24
|
-
endLine: 2,
|
|
25
|
-
endColumn: 53,
|
|
26
|
-
fix: { range: [25, 63], text: ' :label="`Value: ${thisIsAValue}`" />' },
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationTagDefaultSlot from './deprecation-tag-default-slot';
|
|
5
|
-
|
|
6
|
-
const ruleTester = new RuleTester({
|
|
7
|
-
languageOptions: {
|
|
8
|
-
ecmaVersion: 'latest',
|
|
9
|
-
sourceType: 'module',
|
|
10
|
-
parser: vueParser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
parser: tsParser,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('@adyen/bento/deprecation-tag-default-slot should suggest the usage of "label" property instead of "default" slot', () => {
|
|
18
|
-
ruleTester.run('deprecation-tag-default-slot', deprecationTagDefaultSlot, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'BentoTag with "label" property',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-tag label="Label text" variant="blue" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'BentoTag with closing tag but no children',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-tag label="Label text" variant="blue" />
|
|
35
|
-
`,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'BentoTag with expression as value for "label" property',
|
|
39
|
-
filename: 'test.vue',
|
|
40
|
-
code: `
|
|
41
|
-
<template>
|
|
42
|
-
<bento-tag :label="thisIsMyVariableWithText" variant="blue" />
|
|
43
|
-
`,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
invalid: [
|
|
47
|
-
{
|
|
48
|
-
name: 'BentoTag with VText child',
|
|
49
|
-
code: `
|
|
50
|
-
<template>
|
|
51
|
-
<bento-tag variant="blue">
|
|
52
|
-
Label text
|
|
53
|
-
</bento-tag>
|
|
54
|
-
</template>
|
|
55
|
-
`,
|
|
56
|
-
output: `
|
|
57
|
-
<template>
|
|
58
|
-
<bento-tag variant="blue" label="Label text" />
|
|
59
|
-
</template>
|
|
60
|
-
`,
|
|
61
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'BentoTag with VText child and no attributes',
|
|
65
|
-
code: `
|
|
66
|
-
<template>
|
|
67
|
-
<bento-tag>
|
|
68
|
-
Label text
|
|
69
|
-
</bento-tag>
|
|
70
|
-
</template>
|
|
71
|
-
`,
|
|
72
|
-
output: `
|
|
73
|
-
<template>
|
|
74
|
-
<bento-tag label="Label text" />
|
|
75
|
-
</template>
|
|
76
|
-
`,
|
|
77
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'BentoTag with property as child',
|
|
81
|
-
code: `
|
|
82
|
-
<template>
|
|
83
|
-
<bento-tag>
|
|
84
|
-
{{ thisIsMyVariableWithText }}
|
|
85
|
-
</bento-tag>
|
|
86
|
-
</template>
|
|
87
|
-
`,
|
|
88
|
-
output: `
|
|
89
|
-
<template>
|
|
90
|
-
<bento-tag :label="thisIsMyVariableWithText" />
|
|
91
|
-
</template>
|
|
92
|
-
`,
|
|
93
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: 'BentoTag with text and property as child',
|
|
97
|
-
code: `
|
|
98
|
-
<template>
|
|
99
|
-
<bento-tag>
|
|
100
|
-
Value: {{ thisIsAValue }}
|
|
101
|
-
</bento-tag>
|
|
102
|
-
</template>
|
|
103
|
-
`,
|
|
104
|
-
output: `
|
|
105
|
-
<template>
|
|
106
|
-
<bento-tag :label="\`Value: \${thisIsAValue}\`" />
|
|
107
|
-
</template>
|
|
108
|
-
`,
|
|
109
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'BentoTag with text and expression with a call',
|
|
113
|
-
code: `
|
|
114
|
-
<template>
|
|
115
|
-
<bento-tag>
|
|
116
|
-
Value: {{ thisIsAValue() }}
|
|
117
|
-
</bento-tag>
|
|
118
|
-
</template>
|
|
119
|
-
`,
|
|
120
|
-
output: `
|
|
121
|
-
<template>
|
|
122
|
-
<bento-tag :label="\`Value: \${thisIsAValue()}\`" />
|
|
123
|
-
</template>
|
|
124
|
-
`,
|
|
125
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'BentoTag with multiple expressions',
|
|
129
|
-
code: `
|
|
130
|
-
<template>
|
|
131
|
-
<bento-tag>
|
|
132
|
-
{{ expression }} {{ thisIsAValue() }}
|
|
133
|
-
</bento-tag>
|
|
134
|
-
</template>
|
|
135
|
-
`,
|
|
136
|
-
output: `
|
|
137
|
-
<template>
|
|
138
|
-
<bento-tag :label="\`\${expression} \${thisIsAValue()}\`" />
|
|
139
|
-
</template>
|
|
140
|
-
`,
|
|
141
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "label" property' }],
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
});
|
|
145
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('eslint/config');
|
|
2
|
-
const vueParser = require('vue-eslint-parser');
|
|
3
|
-
const tsParser = require('@typescript-eslint/parser');
|
|
4
|
-
const adyenBento = require('@adyen/eslint-plugin-bento');
|
|
5
|
-
|
|
6
|
-
module.exports = defineConfig([
|
|
7
|
-
{
|
|
8
|
-
languageOptions: {
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
sourceType: 'module',
|
|
11
|
-
parser: vueParser,
|
|
12
|
-
parserOptions: {
|
|
13
|
-
parser: tsParser,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
plugins: {
|
|
17
|
-
'@adyen/bento': adyenBento,
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
'@adyen/bento/tailwind-v3-to-bento': 'warn',
|
|
21
|
-
},
|
|
22
|
-
files: ['**/*.vue'],
|
|
23
|
-
},
|
|
24
|
-
]);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="p-4 m-2 gap-8"></div>
|
|
4
|
-
<div class="rounded rounded-md rounded-lg"></div>
|
|
5
|
-
<div class="border border-2 border-4"></div>
|
|
6
|
-
<div class="shadow shadow-sm shadow-lg"></div>
|
|
7
|
-
<div class="sm:p-4 lg:p-8 2xl:m-2"></div>
|
|
8
|
-
<div class="text-red-500 bg-gray-100 border-gray-300"></div>
|
|
9
|
-
<div class="text-sm font-bold leading-tight tracking-wide"></div>
|
|
10
|
-
<div class="p-4 rounded-md shadow-lg sm:p-8 text-red-500"></div>
|
|
11
|
-
<div class="flex items-center justify-between"></div>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup></script>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { execFileSyncEslintVueFiles } from '../../utils/exec-file-sync-eslint-vue-files';
|
|
3
|
-
|
|
4
|
-
describe('@adyen/bento/tailwind-v3-to-bento', () => {
|
|
5
|
-
it('should lint with warning', () => {
|
|
6
|
-
const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
|
|
7
|
-
const vueFile = path.resolve(__dirname, '__tests__', 'tailwind-v3-to-bento.vue');
|
|
8
|
-
|
|
9
|
-
const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
|
|
10
|
-
|
|
11
|
-
// 7 fixable warnings + 4 typography warnings = 8 total messages (typography classes are per-class)
|
|
12
|
-
expect(result[0].warningCount).toBeGreaterThan(0);
|
|
13
|
-
|
|
14
|
-
// Verify spacing replacement
|
|
15
|
-
const spacingMessage = result[0].messages.find(
|
|
16
|
-
(m: { ruleId: string; line: number }) => m.ruleId === '@adyen/bento/tailwind-v3-to-bento' && m.line === 3
|
|
17
|
-
);
|
|
18
|
-
expect(spacingMessage).toBeDefined();
|
|
19
|
-
expect(spacingMessage.messageId).toBe('updateTailwindClass');
|
|
20
|
-
|
|
21
|
-
// Verify typography warning includes suggested bento-typography usage
|
|
22
|
-
const typographyMessage = result[0].messages.find(
|
|
23
|
-
(m: { messageId: string }) => m.messageId === 'removeTailwindTypography'
|
|
24
|
-
);
|
|
25
|
-
expect(typographyMessage).toBeDefined();
|
|
26
|
-
expect(typographyMessage.message).toContain('<bento-typography');
|
|
27
|
-
expect(typographyMessage.message).toContain('variant=');
|
|
28
|
-
});
|
|
29
|
-
});
|