@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.
Files changed (85) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +31 -15
  3. package/configs/vue-recommended.js +16 -0
  4. package/configs/vue-strict.js +17 -1
  5. package/index.js +3 -0
  6. package/package.json +3 -3
  7. package/rules/deprecation-bento-tag-variant-enum/README.md +69 -0
  8. package/rules/deprecation-bento-tag-variant-enum/deprecation-bento-tag-variant-enum.js +167 -0
  9. package/rules/deprecation-filter-bar-deprecated-props/README.md +7 -0
  10. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +14 -3
  11. package/rules/vue-no-redundant-dialog-v-if/README.md +55 -0
  12. package/rules/vue-no-redundant-dialog-v-if/vue-no-redundant-dialog-v-if.js +150 -0
  13. package/rules/vue-no-use-bento-translation-overrides/README.md +14 -0
  14. package/rules/vue-no-use-bento-translation-overrides/vue-no-use-bento-translation-overrides.js +93 -0
  15. package/utils/component-slot-migration.js +22 -4
  16. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/deprecation-bento-data-grid-cell-action-menu-item-handler.vue +0 -63
  17. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/eslint.config.js +0 -26
  18. 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
  19. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/deprecation-bento-data-grid-cell-action-menu-item-handler.test.ts +0 -116
  20. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -10
  21. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/eslint.config.js +0 -29
  22. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -11
  23. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/eslint.config.js +0 -29
  24. package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.integration.test.ts +0 -47
  25. package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.test.ts +0 -176
  26. package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +0 -9
  27. package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +0 -26
  28. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +0 -33
  29. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +0 -101
  30. package/rules/deprecation-bento-popover-modifiers-prop/__tests__/deprecation-bento-popover-modifiers-prop.vue +0 -9
  31. package/rules/deprecation-bento-popover-modifiers-prop/__tests__/eslint.config.js +0 -26
  32. package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.integration.test.ts +0 -24
  33. package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.test.ts +0 -109
  34. package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/deprecation-bento-timeline-item-variant-prop.vue +0 -9
  35. package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/eslint.config.js +0 -26
  36. package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.integration.test.ts +0 -35
  37. package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.test.ts +0 -141
  38. package/rules/deprecation-components-aria-label-prop/__tests__/deprecation-components-aria-label-prop.vue +0 -25
  39. package/rules/deprecation-components-aria-label-prop/__tests__/eslint.config.js +0 -26
  40. package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.integration.test.ts +0 -36
  41. package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.test.ts +0 -194
  42. package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +0 -17
  43. package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +0 -26
  44. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +0 -41
  45. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +0 -153
  46. package/rules/deprecation-components-has-error-prop/__tests__/deprecation-components-has-error-prop.vue +0 -13
  47. package/rules/deprecation-components-has-error-prop/__tests__/eslint.config.js +0 -26
  48. package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.integration.test.ts +0 -37
  49. package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.test.ts +0 -122
  50. package/rules/deprecation-components-input-emit/__tests__/deprecation-components-input-emit.vue +0 -22
  51. package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +0 -25
  52. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.integration.test.ts +0 -43
  53. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +0 -320
  54. package/rules/deprecation-components-value-prop/__tests__/deprecation-components-value-prop.vue +0 -69
  55. package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +0 -25
  56. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.integration.test.ts +0 -37
  57. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +0 -480
  58. package/rules/deprecation-country-custom-usage/__tests__/deprecation-country-custom-usage.vue +0 -93
  59. package/rules/deprecation-country-custom-usage/__tests__/eslint.config.js +0 -25
  60. package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.integration.test.ts +0 -22
  61. package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.test.ts +0 -380
  62. package/rules/deprecation-currency-default-slot/__tests__/deprecation-currency-default-slot.vue +0 -7
  63. package/rules/deprecation-currency-default-slot/__tests__/eslint.config.js +0 -24
  64. package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.integration.test.ts +0 -29
  65. package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.test.ts +0 -136
  66. package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +0 -62
  67. package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +0 -25
  68. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +0 -22
  69. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +0 -467
  70. package/rules/deprecation-input-filter-dropdown-options/__tests__/deprecation-input-filter-dropdown-options.vue +0 -46
  71. package/rules/deprecation-input-filter-dropdown-options/__tests__/eslint.config.js +0 -26
  72. package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.integration.test.ts +0 -27
  73. package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.test.ts +0 -392
  74. package/rules/deprecation-tag-default-slot/__tests__/deprecation-tag-default-slot.vue +0 -5
  75. package/rules/deprecation-tag-default-slot/__tests__/eslint.config.js +0 -24
  76. package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.integration.test.ts +0 -29
  77. package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.test.ts +0 -145
  78. package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +0 -24
  79. package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +0 -15
  80. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +0 -29
  81. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +0 -403
  82. package/rules/vue-old-spacer-tokens/__tests__/eslint.config.js +0 -24
  83. package/rules/vue-old-spacer-tokens/__tests__/vue-old-spacer-tokens.vue +0 -5
  84. package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.integration.test.ts +0 -29
  85. package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.test.ts +0 -77
@@ -1,467 +0,0 @@
1
- import { RuleTester } from 'eslint';
2
- import vueParser from 'vue-eslint-parser';
3
- import tsParser from '@typescript-eslint/parser';
4
- import deprecationFilterBarDeprecatedProps from './deprecation-filter-bar-deprecated-props';
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-filter-bar-deprecated-props', () => {
18
- ruleTester.run('deprecation-filter-bar-deprecated-props', deprecationFilterBarDeprecatedProps, {
19
- valid: [
20
- {
21
- name: 'Valid: bento-filter-bar with config prop (no value)',
22
- filename: 'test.vue',
23
- code: `
24
- <template>
25
- <bento-filter-bar :config="config" :filter-values="values" />
26
- </template>
27
- `,
28
- },
29
- {
30
- name: 'Valid: Vue 3 filter-values v-model on bento-filter-bar',
31
- filename: 'test.vue',
32
- code: `
33
- <template>
34
- <bento-filter-bar :config="config" v-model:filter-values="filterValues" />
35
- </template>
36
- `,
37
- },
38
- {
39
- name: 'Valid: filter config item without deprecated value property',
40
- filename: 'test.vue',
41
- code: `
42
- <script setup>
43
- const config = [{ field: 'name', label: 'Name', type: 'BentoInputFilter' }];
44
- </script>
45
- <template><bento-filter-bar :config="config" /></template>
46
- `,
47
- },
48
- {
49
- name: 'Valid: filter config options without deprecated messages keys',
50
- filename: 'test.vue',
51
- code: `
52
- <script setup>
53
- const config = [{
54
- field: 'status',
55
- label: 'Status',
56
- type: 'BentoSelectFilter',
57
- options: { listboxItems: [] },
58
- }];
59
- </script>
60
- <template><bento-filter-bar :config="config" /></template>
61
- `,
62
- },
63
- {
64
- name: 'Valid: computed property key matching deprecated name (no false positive)',
65
- filename: 'test.vue',
66
- code: `
67
- <script setup>
68
- const key = 'value';
69
- const config = [{ field: 'x', type: 'BentoInputFilter', [key]: 'test' }];
70
- </script>
71
- <template><bento-filter-bar :config="config" /></template>
72
- `,
73
- },
74
- {
75
- name: 'Valid: spread in options (no crash)',
76
- filename: 'test.vue',
77
- code: `
78
- <script setup>
79
- const defaults = {};
80
- const config = [{
81
- field: 'x',
82
- type: 'BentoSelectFilter',
83
- options: { ...defaults, listboxItems: [] },
84
- }];
85
- </script>
86
- <template><bento-filter-bar :config="config" /></template>
87
- `,
88
- },
89
- {
90
- name: 'Valid: bento-data-grid with filters without deprecated props',
91
- filename: 'test.vue',
92
- code: `
93
- <script setup>
94
- const filters = [{ field: 'x', label: 'X', type: 'BentoInputFilter' }];
95
- </script>
96
- <template><bento-data-grid :filters="filters" /></template>
97
- `,
98
- },
99
- {
100
- name: 'Valid: unrelated object with options.messages (no false positive)',
101
- filename: 'test.vue',
102
- code: `
103
- <script setup>
104
- const unrelated = { options: { messages: {} } };
105
- </script>
106
- <template><div /></template>
107
- `,
108
- },
109
- {
110
- name: 'Valid: unrelated binary operation object with field, type, and value properties',
111
- filename: 'test.vue',
112
- code: `
113
- <script>
114
- export const parseBinaryOperation = operation => ({
115
- field: operation.left.name,
116
- operator: operation.type,
117
- category: operation.left.type,
118
- type: parseOperationValueType(operation.right.type),
119
- value: parseOperationValue(operation),
120
- key: getUniqueId(),
121
- });
122
- </script>
123
- <template><div /></template>
124
- `,
125
- },
126
- {
127
- name: 'Valid: unrelated object with a non-filter string type',
128
- filename: 'test.vue',
129
- code: `
130
- <script setup>
131
- const operation = { field: 'name', type: 'BinaryOperation', value: 'test' };
132
- </script>
133
- <template><div /></template>
134
- `,
135
- },
136
- {
137
- name: 'Valid: unrelated object with value property (no false positive)',
138
- filename: 'test.vue',
139
- code: `
140
- <script setup>
141
- const obj = { value: 'test', options: { messages: {} } };
142
- </script>
143
- <template><div /></template>
144
- `,
145
- },
146
- ],
147
- invalid: [
148
- // Direct "value" prop on bento-filter-bar
149
- {
150
- name: 'Invalid: static value prop on bento-filter-bar',
151
- filename: 'test.vue',
152
- code: `<template><bento-filter-bar value="val" /></template>`,
153
- errors: [{ messageId: 'deprecationValue' }],
154
- },
155
- {
156
- name: 'Invalid: dynamic value prop on bento-filter-bar',
157
- filename: 'test.vue',
158
- code: `<template><bento-filter-bar :value="filters" /></template>`,
159
- errors: [{ messageId: 'deprecationValue' }],
160
- },
161
- {
162
- name: 'Invalid: v-model on bento-filter-bar',
163
- filename: 'test.vue',
164
- code: `<template><bento-filter-bar v-model="filters" /></template>`,
165
- errors: [{ messageId: 'deprecationValue' }],
166
- },
167
- {
168
- name: 'Invalid: Vue 3 value v-model on bento-filter-bar',
169
- filename: 'test.vue',
170
- code: `<template><bento-filter-bar v-model:value="filters" /></template>`,
171
- errors: [{ messageId: 'deprecationValue' }],
172
- },
173
- // "value" inside filter config items (script)
174
- {
175
- name: 'Invalid: value property in filter config item without a label',
176
- filename: 'test.vue',
177
- code: `
178
- <script setup>
179
- const config = [{
180
- field: 'name',
181
- type: 'BentoInputFilter',
182
- value: 'test',
183
- }];
184
- </script>
185
- <template><bento-filter-bar :config="config" /></template>
186
- `,
187
- errors: [{ messageId: 'deprecationConfigValue' }],
188
- },
189
- // "value" inside filter config items (inline template)
190
- {
191
- name: 'Invalid: value property in filter config item (inline template)',
192
- filename: 'test.vue',
193
- code: `
194
- <template>
195
- <bento-filter-bar :config="[{ field: 'name', label: 'Name', type: 'BentoInputFilter', value: 'test' }]" />
196
- </template>
197
- `,
198
- errors: [{ messageId: 'deprecationConfigValue' }],
199
- },
200
- // Deprecated messages option
201
- {
202
- name: 'Invalid: messages option in filter config',
203
- filename: 'test.vue',
204
- code: `
205
- <script setup>
206
- const config = [{
207
- field: 'status',
208
- label: 'Status',
209
- type: 'BentoSelectFilter',
210
- options: { messages: { en: { persistentButtonLabelPartiallySelected: 'x' } }, listboxItems: [] },
211
- }];
212
- </script>
213
- <template><bento-filter-bar :config="config" /></template>
214
- `,
215
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
216
- },
217
- // Deprecated messagesPersistentButtonLabelPartiallySelectedKey
218
- {
219
- name: 'Invalid: messagesPersistentButtonLabelPartiallySelectedKey option',
220
- filename: 'test.vue',
221
- code: `
222
- <script setup>
223
- const config = [{
224
- field: 'status',
225
- label: 'Status',
226
- type: 'BentoSelectFilter',
227
- options: { messagesPersistentButtonLabelPartiallySelectedKey: 'customKey', listboxItems: [] },
228
- }];
229
- </script>
230
- <template><bento-filter-bar :config="config" /></template>
231
- `,
232
- errors: [
233
- {
234
- messageId: 'deprecationOption',
235
- data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
236
- },
237
- ],
238
- },
239
- // Deprecated messagesPersistentButtonLabelAllSelectedKey
240
- {
241
- name: 'Invalid: messagesPersistentButtonLabelAllSelectedKey option',
242
- filename: 'test.vue',
243
- code: `
244
- <script setup>
245
- const config = [{
246
- field: 'status',
247
- label: 'Status',
248
- type: 'BentoSelectFilter',
249
- options: { messagesPersistentButtonLabelAllSelectedKey: 'customKey', listboxItems: [] },
250
- }];
251
- </script>
252
- <template><bento-filter-bar :config="config" /></template>
253
- `,
254
- errors: [
255
- { messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
256
- ],
257
- },
258
- // All 3 deprecated options together
259
- {
260
- name: 'Invalid: all deprecated options in one config',
261
- filename: 'test.vue',
262
- code: `
263
- <script setup>
264
- const config = [{
265
- field: 'status',
266
- label: 'Status',
267
- type: 'BentoSelectFilter',
268
- options: {
269
- messages: {},
270
- messagesPersistentButtonLabelPartiallySelectedKey: 'k1',
271
- messagesPersistentButtonLabelAllSelectedKey: 'k2',
272
- listboxItems: [],
273
- },
274
- }];
275
- </script>
276
- <template><bento-filter-bar :config="config" /></template>
277
- `,
278
- errors: [
279
- { messageId: 'deprecationOption', data: { key: 'messages' } },
280
- {
281
- messageId: 'deprecationOption',
282
- data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
283
- },
284
- { messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
285
- ],
286
- },
287
- // String literal key (edge case)
288
- {
289
- name: 'Invalid: string literal key for deprecated option',
290
- filename: 'test.vue',
291
- code: `
292
- <script setup>
293
- const config = [{
294
- field: 'status',
295
- label: 'Status',
296
- type: 'BentoSelectFilter',
297
- options: { 'messages': {} },
298
- }];
299
- </script>
300
- <template><bento-filter-bar :config="config" /></template>
301
- `,
302
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
303
- },
304
- // bento-data-grid filters with deprecated value
305
- {
306
- name: 'Invalid: value in data-grid filter config item',
307
- filename: 'test.vue',
308
- code: `
309
- <script setup>
310
- const filters = [{
311
- field: 'name',
312
- label: 'Name',
313
- type: 'BentoInputFilter',
314
- value: 'test',
315
- }];
316
- </script>
317
- <template><bento-data-grid :filters="filters" /></template>
318
- `,
319
- errors: [{ messageId: 'deprecationConfigValue' }],
320
- },
321
- // bento-data-grid filters with deprecated options
322
- {
323
- name: 'Invalid: deprecated options in data-grid filter config',
324
- filename: 'test.vue',
325
- code: `
326
- <script setup>
327
- const filters = [{
328
- field: 'status',
329
- label: 'Status',
330
- type: 'BentoSelectFilter',
331
- options: { messages: {}, listboxItems: [] },
332
- }];
333
- </script>
334
- <template><bento-data-grid :filters="filters" /></template>
335
- `,
336
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
337
- },
338
- // Inline template with deprecated options
339
- {
340
- name: 'Invalid: deprecated options in inline template config',
341
- filename: 'test.vue',
342
- code: `
343
- <template>
344
- <bento-filter-bar :config="[{
345
- field: 'status',
346
- label: 'Status',
347
- type: 'BentoSelectFilter',
348
- options: { messages: {}, listboxItems: [] },
349
- }]" />
350
- </template>
351
- `,
352
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
353
- },
354
- // Spread + deprecated key combined
355
- {
356
- name: 'Invalid: spread + deprecated option combined',
357
- filename: 'test.vue',
358
- code: `
359
- <script setup>
360
- const defaults = {};
361
- const config = [{
362
- field: 'status',
363
- label: 'Status',
364
- type: 'BentoSelectFilter',
365
- options: { ...defaults, messages: {} },
366
- }];
367
- </script>
368
- <template><bento-filter-bar :config="config" /></template>
369
- `,
370
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
371
- },
372
- ],
373
- });
374
-
375
- /* ------------------------------------------------ */
376
- /* AUTOFIX TESTS */
377
- /* ------------------------------------------------ */
378
- ruleTester.run('deprecation-filter-bar-deprecated-props (autofix enabled)', deprecationFilterBarDeprecatedProps, {
379
- valid: [
380
- {
381
- name: 'Valid: no deprecated props (autofix enabled)',
382
- filename: 'test.vue',
383
- options: [{ autofix: true }],
384
- code: `<template><bento-filter-bar :config="config" /></template>`,
385
- },
386
- ],
387
- invalid: [
388
- {
389
- name: 'Autofix: preserves static value prop on bento-filter-bar',
390
- filename: 'test.vue',
391
- options: [{ autofix: true }],
392
- code: `<template><bento-filter-bar value="val" /></template>`,
393
- output: null,
394
- errors: [{ messageId: 'deprecationValue' }],
395
- },
396
- {
397
- name: 'Autofix: preserves dynamic value prop on bento-filter-bar',
398
- filename: 'test.vue',
399
- options: [{ autofix: true }],
400
- code: `<template><bento-filter-bar :value="filters" /></template>`,
401
- output: null,
402
- errors: [{ messageId: 'deprecationValue' }],
403
- },
404
- {
405
- name: 'Autofix: preserves v-model on bento-filter-bar',
406
- filename: 'test.vue',
407
- options: [{ autofix: true }],
408
- code: `<template><bento-filter-bar v-model="filters" /></template>`,
409
- output: null,
410
- errors: [{ messageId: 'deprecationValue' }],
411
- },
412
- {
413
- name: 'Autofix: preserves value on filter config item',
414
- filename: 'test.vue',
415
- options: [{ autofix: true }],
416
- code: `
417
- <script setup>
418
- const config = [{
419
- field: 'name',
420
- label: 'Name',
421
- type: 'BentoInputFilter',
422
- value: 'test',
423
- }];
424
- </script>
425
- <template><bento-filter-bar :config="config" /></template>
426
- `,
427
- output: null,
428
- errors: [{ messageId: 'deprecationConfigValue' }],
429
- },
430
- {
431
- name: 'Autofix: removes deprecated messages option from filter config',
432
- filename: 'test.vue',
433
- options: [{ autofix: true }],
434
- code: `
435
- <script setup>
436
- const config = [{
437
- field: 'status',
438
- label: 'Status',
439
- type: 'BentoSelectFilter',
440
- options: { messages: {}, listboxItems: [] },
441
- }];
442
- </script>
443
- <template><bento-filter-bar :config="config" /></template>
444
- `,
445
- output: `
446
- <script setup>
447
- const config = [{
448
- field: 'status',
449
- label: 'Status',
450
- type: 'BentoSelectFilter',
451
- options: { listboxItems: [] },
452
- }];
453
- </script>
454
- <template><bento-filter-bar :config="config" /></template>
455
- `,
456
- errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
457
- },
458
- {
459
- name: 'Autofix: does not fix when autofix is false',
460
- filename: 'test.vue',
461
- options: [{ autofix: false }],
462
- code: `<template><bento-filter-bar value="val" other="x" /></template>`,
463
- errors: [{ messageId: 'deprecationValue' }],
464
- },
465
- ],
466
- });
467
- });
@@ -1,46 +0,0 @@
1
- <template>
2
- <div>
3
- <bento-filter-bar :config="filterBarConfig" />
4
- <bento-data-grid :filters="dataGridFilters" />
5
- <bento-filter-bar
6
- :config="[
7
- {
8
- field: 'inline',
9
- label: 'Inline',
10
- type: BentoFilterItemType.INPUT,
11
- options: { dropdown: { items: [] } },
12
- },
13
- ]"
14
- />
15
- <bento-data-grid
16
- :filters="[
17
- {
18
- field: 'inlineGrid',
19
- label: 'Inline Grid',
20
- type: BentoFilterItemType.INPUT,
21
- options: { variant: 'dropdown' },
22
- },
23
- ]"
24
- />
25
- </div>
26
- </template>
27
-
28
- <script setup>
29
- const filterBarConfig = [
30
- {
31
- field: 'name',
32
- label: 'Name',
33
- type: BentoFilterItemType.INPUT,
34
- options: { dropdown: { items: [] }, dropdownPosition: 'end', variant: 'dropdown' },
35
- },
36
- ];
37
-
38
- const dataGridFilters = [
39
- {
40
- field: 'status',
41
- label: 'Status',
42
- type: BentoFilterItemType.INPUT,
43
- options: { dropdown: { items: [] } },
44
- },
45
- ];
46
- </script>
@@ -1,26 +0,0 @@
1
- // eslint.config.js
2
- const { defineConfig } = require('eslint/config');
3
- const vueParser = require('vue-eslint-parser');
4
- const tsParser = require('@typescript-eslint/parser');
5
- const adyenBento = require('@adyen/eslint-plugin-bento');
6
-
7
- module.exports = defineConfig([
8
- {
9
- languageOptions: {
10
- ecmaVersion: 'latest',
11
- sourceType: 'module',
12
- parser: vueParser,
13
- parserOptions: {
14
- parser: tsParser,
15
- },
16
- },
17
- plugins: {
18
- '@adyen/bento': adyenBento,
19
- },
20
- rules: {
21
- // Register the specific rule we are testing
22
- '@adyen/bento/deprecation-input-filter-dropdown-options': 'warn',
23
- },
24
- files: ['**/*.vue'],
25
- },
26
- ]);
@@ -1,27 +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-input-filter-dropdown-options', () => {
5
- it('should lint with warning', () => {
6
- const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
7
- const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-input-filter-dropdown-options.vue');
8
-
9
- const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
10
-
11
- // 3 from filterBarConfig (dropdown, dropdownPosition, variant)
12
- // + 1 from dataGridFilters (dropdown)
13
- // + 1 from inline bento-filter-bar (dropdown)
14
- // + 1 from inline bento-data-grid (variant)
15
- expect(result[0].warningCount).toBe(6);
16
-
17
- expect(result[0].messages).toEqual(
18
- expect.arrayContaining([
19
- expect.objectContaining({
20
- ruleId: '@adyen/bento/deprecation-input-filter-dropdown-options',
21
- severity: 1,
22
- messageId: 'deprecation',
23
- }),
24
- ])
25
- );
26
- });
27
- });