@adyen/eslint-plugin-bento 2.8.0 → 2.9.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 (29) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/configs/vue-recommended.js +3 -0
  3. package/configs/vue-strict.js +3 -0
  4. package/index.js +3 -0
  5. package/package.json +1 -1
  6. package/rules/deprecation-bento-dropdown-size-prop/README.md +25 -0
  7. package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +9 -0
  8. package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +26 -0
  9. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +33 -0
  10. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.js +78 -0
  11. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +101 -0
  12. package/rules/deprecation-components-error-prop/README.md +43 -0
  13. package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +17 -0
  14. package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +26 -0
  15. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +37 -0
  16. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.js +79 -0
  17. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +120 -0
  18. package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +1 -1
  19. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.js +19 -4
  20. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +40 -0
  21. package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +1 -1
  22. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.js +24 -7
  23. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +56 -0
  24. package/rules/deprecation-filter-bar-deprecated-props/README.md +64 -0
  25. package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +48 -0
  26. package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +25 -0
  27. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +22 -0
  28. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +187 -0
  29. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +421 -0
@@ -0,0 +1,25 @@
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
+ '@adyen/bento/deprecation-filter-bar-deprecated-props': 'warn',
22
+ },
23
+ files: ['**/*.vue'],
24
+ },
25
+ ]);
@@ -0,0 +1,22 @@
1
+ import path from 'node:path';
2
+ import { execFileSyncEslintVueFiles } from '../../utils/exec-file-sync-eslint-vue-files';
3
+
4
+ describe('@adyen/bento/deprecation-filter-bar-deprecated-props', () => {
5
+ it('should lint with warning', () => {
6
+ const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
7
+ const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-filter-bar-deprecated-props.vue');
8
+
9
+ const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
10
+
11
+ // 3 from direct value prop (static, dynamic, v-model)
12
+ // + 1 from configWithValue (value on config item)
13
+ // + 3 from configWithOptions (messages + 2 keys)
14
+ // + 1 from inline template (messages)
15
+ expect(result[0].warningCount).toBe(8);
16
+
17
+ expect(result[0].messages[0]).toMatchObject({
18
+ ruleId: '@adyen/bento/deprecation-filter-bar-deprecated-props',
19
+ severity: 1,
20
+ });
21
+ });
22
+ });
@@ -0,0 +1,187 @@
1
+ /**
2
+ * @typedef {import('eslint').Rule.RuleContext} RuleContext
3
+ */
4
+ /**
5
+ * @typedef {import('eslint-plugin-vue/lib/utils').RuleModule} RuleModule
6
+ */
7
+
8
+ const VueUtils = require('eslint-plugin-vue/lib/utils');
9
+
10
+ const DEPRECATED_OPTIONS_KEYS = new Set([
11
+ 'messages',
12
+ 'messagesPersistentButtonLabelPartiallySelectedKey',
13
+ 'messagesPersistentButtonLabelAllSelectedKey',
14
+ ]);
15
+
16
+ function getStaticPropertyName(prop) {
17
+ if (prop.type !== 'Property' || prop.computed) {
18
+ return null;
19
+ }
20
+ return prop.key.type === 'Identifier' ? prop.key.name : prop.key.type === 'Literal' ? String(prop.key.value) : null;
21
+ }
22
+
23
+ /** @type {RuleModule} */
24
+ module.exports = {
25
+ meta: {
26
+ type: 'suggestion',
27
+ docs: {
28
+ description:
29
+ 'Deprecates usage of value prop and messages-related options in bento-filter-bar and bento-data-grid filter configs',
30
+ category: 'Deprecations',
31
+ url: 'https://github.com/Adyen/bento/blob/main/packages/eslint/rules/deprecation-filter-bar-deprecated-props/README.md',
32
+ recommended: true,
33
+ },
34
+ messages: {
35
+ deprecationValue: `The "value" prop is deprecated. Please use "config" and "filter-values" instead.`,
36
+ deprecationConfigValue: `The "value" property in filter config items is deprecated. Please use "filter-values" instead.`,
37
+ deprecationOption:
38
+ 'The "{{ key }}" option in filter config is deprecated. The persistent filter label now uses a counter instead of custom strings.',
39
+ },
40
+ fixable: 'code',
41
+ schema: [
42
+ {
43
+ type: 'object',
44
+ properties: {
45
+ autofix: {
46
+ type: 'boolean',
47
+ default: false,
48
+ },
49
+ },
50
+ additionalProperties: false,
51
+ },
52
+ ],
53
+ },
54
+
55
+ /** @param {RuleContext} context */
56
+ create(context) {
57
+ const options = context.options[0] || {};
58
+ const autofix = options.autofix === true;
59
+
60
+ function removeProperty(fixer, objectNode, prop) {
61
+ const properties = objectNode.properties;
62
+ const index = properties.indexOf(prop);
63
+ const isLast = index === properties.length - 1;
64
+
65
+ if (properties.length === 1) {
66
+ return fixer.replaceText(objectNode, '{}');
67
+ }
68
+ if (isLast) {
69
+ const prev = properties[index - 1];
70
+ return fixer.removeRange([prev.range[1], prop.range[1]]);
71
+ }
72
+ const next = properties[index + 1];
73
+ return fixer.removeRange([prop.range[0], next.range[0]]);
74
+ }
75
+
76
+ function checkObjectExpression(node) {
77
+ const properties = node.properties;
78
+ const propertyMap = {};
79
+
80
+ for (const prop of properties) {
81
+ const name = getStaticPropertyName(prop);
82
+ if (name) {
83
+ propertyMap[name] = prop;
84
+ }
85
+ }
86
+
87
+ // Only check objects that look like filter config items (BentoFilterModel)
88
+ const isFilterConfig = propertyMap.field && propertyMap.type;
89
+ if (!isFilterConfig) {
90
+ return;
91
+ }
92
+
93
+ // Check for deprecated "value" on filter config items
94
+ if (propertyMap.value) {
95
+ context.report({
96
+ node: propertyMap.value.key,
97
+ messageId: 'deprecationConfigValue',
98
+ ...(autofix && {
99
+ fix(fixer) {
100
+ return removeProperty(fixer, node, propertyMap.value);
101
+ },
102
+ }),
103
+ });
104
+ }
105
+
106
+ // Check for deprecated options keys inside "options" object
107
+ if (
108
+ propertyMap.options &&
109
+ propertyMap.options.value &&
110
+ propertyMap.options.value.type === 'ObjectExpression'
111
+ ) {
112
+ const optionsNode = propertyMap.options.value;
113
+ for (const optionProp of optionsNode.properties) {
114
+ const optionName = getStaticPropertyName(optionProp);
115
+ if (optionName && DEPRECATED_OPTIONS_KEYS.has(optionName)) {
116
+ context.report({
117
+ node: optionProp.key,
118
+ messageId: 'deprecationOption',
119
+ data: { key: optionName },
120
+ ...(autofix && {
121
+ fix(fixer) {
122
+ return removeProperty(fixer, optionsNode, optionProp);
123
+ },
124
+ }),
125
+ });
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ const objectVisitor = {
132
+ ObjectExpression(node) {
133
+ checkObjectExpression(node);
134
+ },
135
+ };
136
+
137
+ return VueUtils.defineTemplateBodyVisitor(
138
+ context,
139
+ {
140
+ // Direct "value" prop on bento-filter-bar (static)
141
+ [`VElement[name="bento-filter-bar"] > VStartTag > VAttribute[directive=false][key.name="value"]`](
142
+ node
143
+ ) {
144
+ context.report({
145
+ node,
146
+ messageId: 'deprecationValue',
147
+ ...(autofix && {
148
+ fix(fixer) {
149
+ return fixer.remove(node);
150
+ },
151
+ }),
152
+ });
153
+ },
154
+ // Direct "value" prop on bento-filter-bar (dynamic)
155
+ [`VElement[name="bento-filter-bar"] > VStartTag > VAttribute[directive=true][key.name.name="bind"][key.argument.name="value"]`](
156
+ node
157
+ ) {
158
+ context.report({
159
+ node,
160
+ messageId: 'deprecationValue',
161
+ ...(autofix && {
162
+ fix(fixer) {
163
+ return fixer.remove(node);
164
+ },
165
+ }),
166
+ });
167
+ },
168
+ // v-model on bento-filter-bar (v-model binds to "value" in Vue 2)
169
+ [`VElement[name="bento-filter-bar"] > VStartTag > VAttribute[directive=true][key.name.name="model"]`](
170
+ node
171
+ ) {
172
+ context.report({
173
+ node,
174
+ messageId: 'deprecationValue',
175
+ ...(autofix && {
176
+ fix(fixer) {
177
+ return fixer.remove(node);
178
+ },
179
+ }),
180
+ });
181
+ },
182
+ ...objectVisitor,
183
+ },
184
+ objectVisitor
185
+ );
186
+ },
187
+ };
@@ -0,0 +1,421 @@
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: filter config item without deprecated value property',
31
+ filename: 'test.vue',
32
+ code: `
33
+ <script setup>
34
+ const config = [{ field: 'name', label: 'Name', type: 'BentoInputFilter' }];
35
+ </script>
36
+ <template><bento-filter-bar :config="config" /></template>
37
+ `,
38
+ },
39
+ {
40
+ name: 'Valid: filter config options without deprecated messages keys',
41
+ filename: 'test.vue',
42
+ code: `
43
+ <script setup>
44
+ const config = [{
45
+ field: 'status',
46
+ label: 'Status',
47
+ type: 'BentoSelectFilter',
48
+ options: { listboxItems: [] },
49
+ }];
50
+ </script>
51
+ <template><bento-filter-bar :config="config" /></template>
52
+ `,
53
+ },
54
+ {
55
+ name: 'Valid: computed property key matching deprecated name (no false positive)',
56
+ filename: 'test.vue',
57
+ code: `
58
+ <script setup>
59
+ const key = 'value';
60
+ const config = [{ field: 'x', type: 'BentoInputFilter', [key]: 'test' }];
61
+ </script>
62
+ <template><bento-filter-bar :config="config" /></template>
63
+ `,
64
+ },
65
+ {
66
+ name: 'Valid: spread in options (no crash)',
67
+ filename: 'test.vue',
68
+ code: `
69
+ <script setup>
70
+ const defaults = {};
71
+ const config = [{
72
+ field: 'x',
73
+ type: 'BentoSelectFilter',
74
+ options: { ...defaults, listboxItems: [] },
75
+ }];
76
+ </script>
77
+ <template><bento-filter-bar :config="config" /></template>
78
+ `,
79
+ },
80
+ {
81
+ name: 'Valid: bento-data-grid with filters without deprecated props',
82
+ filename: 'test.vue',
83
+ code: `
84
+ <script setup>
85
+ const filters = [{ field: 'x', label: 'X', type: 'BentoInputFilter' }];
86
+ </script>
87
+ <template><bento-data-grid :filters="filters" /></template>
88
+ `,
89
+ },
90
+ {
91
+ name: 'Valid: unrelated object with options.messages (no false positive)',
92
+ filename: 'test.vue',
93
+ code: `
94
+ <script setup>
95
+ const unrelated = { options: { messages: {} } };
96
+ </script>
97
+ <template><div /></template>
98
+ `,
99
+ },
100
+ {
101
+ name: 'Valid: unrelated object with value property (no false positive)',
102
+ filename: 'test.vue',
103
+ code: `
104
+ <script setup>
105
+ const obj = { value: 'test', options: { messages: {} } };
106
+ </script>
107
+ <template><div /></template>
108
+ `,
109
+ },
110
+ ],
111
+ invalid: [
112
+ // Direct "value" prop on bento-filter-bar
113
+ {
114
+ name: 'Invalid: static value prop on bento-filter-bar',
115
+ filename: 'test.vue',
116
+ code: `<template><bento-filter-bar value="val" /></template>`,
117
+ errors: [{ messageId: 'deprecationValue' }],
118
+ },
119
+ {
120
+ name: 'Invalid: dynamic value prop on bento-filter-bar',
121
+ filename: 'test.vue',
122
+ code: `<template><bento-filter-bar :value="filters" /></template>`,
123
+ errors: [{ messageId: 'deprecationValue' }],
124
+ },
125
+ {
126
+ name: 'Invalid: v-model on bento-filter-bar',
127
+ filename: 'test.vue',
128
+ code: `<template><bento-filter-bar v-model="filters" /></template>`,
129
+ errors: [{ messageId: 'deprecationValue' }],
130
+ },
131
+ // "value" inside filter config items (script)
132
+ {
133
+ name: 'Invalid: value property in filter config item (script)',
134
+ filename: 'test.vue',
135
+ code: `
136
+ <script setup>
137
+ const config = [{
138
+ field: 'name',
139
+ type: 'BentoInputFilter',
140
+ value: 'test',
141
+ }];
142
+ </script>
143
+ <template><bento-filter-bar :config="config" /></template>
144
+ `,
145
+ errors: [{ messageId: 'deprecationConfigValue' }],
146
+ },
147
+ // "value" inside filter config items (inline template)
148
+ {
149
+ name: 'Invalid: value property in filter config item (inline template)',
150
+ filename: 'test.vue',
151
+ code: `
152
+ <template>
153
+ <bento-filter-bar :config="[{ field: 'name', type: 'BentoInputFilter', value: 'test' }]" />
154
+ </template>
155
+ `,
156
+ errors: [{ messageId: 'deprecationConfigValue' }],
157
+ },
158
+ // Deprecated messages option
159
+ {
160
+ name: 'Invalid: messages option in filter config',
161
+ filename: 'test.vue',
162
+ code: `
163
+ <script setup>
164
+ const config = [{
165
+ field: 'status',
166
+ type: 'BentoSelectFilter',
167
+ options: { messages: { en: { persistentButtonLabelPartiallySelected: 'x' } }, listboxItems: [] },
168
+ }];
169
+ </script>
170
+ <template><bento-filter-bar :config="config" /></template>
171
+ `,
172
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
173
+ },
174
+ // Deprecated messagesPersistentButtonLabelPartiallySelectedKey
175
+ {
176
+ name: 'Invalid: messagesPersistentButtonLabelPartiallySelectedKey option',
177
+ filename: 'test.vue',
178
+ code: `
179
+ <script setup>
180
+ const config = [{
181
+ field: 'status',
182
+ type: 'BentoSelectFilter',
183
+ options: { messagesPersistentButtonLabelPartiallySelectedKey: 'customKey', listboxItems: [] },
184
+ }];
185
+ </script>
186
+ <template><bento-filter-bar :config="config" /></template>
187
+ `,
188
+ errors: [
189
+ {
190
+ messageId: 'deprecationOption',
191
+ data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
192
+ },
193
+ ],
194
+ },
195
+ // Deprecated messagesPersistentButtonLabelAllSelectedKey
196
+ {
197
+ name: 'Invalid: messagesPersistentButtonLabelAllSelectedKey option',
198
+ filename: 'test.vue',
199
+ code: `
200
+ <script setup>
201
+ const config = [{
202
+ field: 'status',
203
+ type: 'BentoSelectFilter',
204
+ options: { messagesPersistentButtonLabelAllSelectedKey: 'customKey', listboxItems: [] },
205
+ }];
206
+ </script>
207
+ <template><bento-filter-bar :config="config" /></template>
208
+ `,
209
+ errors: [
210
+ { messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
211
+ ],
212
+ },
213
+ // All 3 deprecated options together
214
+ {
215
+ name: 'Invalid: all deprecated options in one config',
216
+ filename: 'test.vue',
217
+ code: `
218
+ <script setup>
219
+ const config = [{
220
+ field: 'status',
221
+ type: 'BentoSelectFilter',
222
+ options: {
223
+ messages: {},
224
+ messagesPersistentButtonLabelPartiallySelectedKey: 'k1',
225
+ messagesPersistentButtonLabelAllSelectedKey: 'k2',
226
+ listboxItems: [],
227
+ },
228
+ }];
229
+ </script>
230
+ <template><bento-filter-bar :config="config" /></template>
231
+ `,
232
+ errors: [
233
+ { messageId: 'deprecationOption', data: { key: 'messages' } },
234
+ {
235
+ messageId: 'deprecationOption',
236
+ data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
237
+ },
238
+ { messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
239
+ ],
240
+ },
241
+ // String literal key (edge case)
242
+ {
243
+ name: 'Invalid: string literal key for deprecated option',
244
+ filename: 'test.vue',
245
+ code: `
246
+ <script setup>
247
+ const config = [{
248
+ field: 'status',
249
+ type: 'BentoSelectFilter',
250
+ options: { 'messages': {} },
251
+ }];
252
+ </script>
253
+ <template><bento-filter-bar :config="config" /></template>
254
+ `,
255
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
256
+ },
257
+ // bento-data-grid filters with deprecated value
258
+ {
259
+ name: 'Invalid: value in data-grid filter config item',
260
+ filename: 'test.vue',
261
+ code: `
262
+ <script setup>
263
+ const filters = [{
264
+ field: 'name',
265
+ type: 'BentoInputFilter',
266
+ value: 'test',
267
+ }];
268
+ </script>
269
+ <template><bento-data-grid :filters="filters" /></template>
270
+ `,
271
+ errors: [{ messageId: 'deprecationConfigValue' }],
272
+ },
273
+ // bento-data-grid filters with deprecated options
274
+ {
275
+ name: 'Invalid: deprecated options in data-grid filter config',
276
+ filename: 'test.vue',
277
+ code: `
278
+ <script setup>
279
+ const filters = [{
280
+ field: 'status',
281
+ type: 'BentoSelectFilter',
282
+ options: { messages: {}, listboxItems: [] },
283
+ }];
284
+ </script>
285
+ <template><bento-data-grid :filters="filters" /></template>
286
+ `,
287
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
288
+ },
289
+ // Inline template with deprecated options
290
+ {
291
+ name: 'Invalid: deprecated options in inline template config',
292
+ filename: 'test.vue',
293
+ code: `
294
+ <template>
295
+ <bento-filter-bar :config="[{
296
+ field: 'status',
297
+ type: 'BentoSelectFilter',
298
+ options: { messages: {}, listboxItems: [] },
299
+ }]" />
300
+ </template>
301
+ `,
302
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
303
+ },
304
+ // Spread + deprecated key combined
305
+ {
306
+ name: 'Invalid: spread + deprecated option combined',
307
+ filename: 'test.vue',
308
+ code: `
309
+ <script setup>
310
+ const defaults = {};
311
+ const config = [{
312
+ field: 'status',
313
+ type: 'BentoSelectFilter',
314
+ options: { ...defaults, messages: {} },
315
+ }];
316
+ </script>
317
+ <template><bento-filter-bar :config="config" /></template>
318
+ `,
319
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
320
+ },
321
+ ],
322
+ });
323
+
324
+ /* ------------------------------------------------ */
325
+ /* AUTOFIX TESTS */
326
+ /* ------------------------------------------------ */
327
+ ruleTester.run('deprecation-filter-bar-deprecated-props (autofix enabled)', deprecationFilterBarDeprecatedProps, {
328
+ valid: [
329
+ {
330
+ name: 'Valid: no deprecated props (autofix enabled)',
331
+ filename: 'test.vue',
332
+ options: [{ autofix: true }],
333
+ code: `<template><bento-filter-bar :config="config" /></template>`,
334
+ },
335
+ ],
336
+ invalid: [
337
+ {
338
+ name: 'Autofix: removes static value prop from bento-filter-bar',
339
+ filename: 'test.vue',
340
+ options: [{ autofix: true }],
341
+ code: `<template><bento-filter-bar value="val" /></template>`,
342
+ output: `<template><bento-filter-bar /></template>`,
343
+ errors: [{ messageId: 'deprecationValue' }],
344
+ },
345
+ {
346
+ name: 'Autofix: removes dynamic value prop from bento-filter-bar',
347
+ filename: 'test.vue',
348
+ options: [{ autofix: true }],
349
+ code: `<template><bento-filter-bar :value="filters" /></template>`,
350
+ output: `<template><bento-filter-bar /></template>`,
351
+ errors: [{ messageId: 'deprecationValue' }],
352
+ },
353
+ {
354
+ name: 'Autofix: removes v-model from bento-filter-bar',
355
+ filename: 'test.vue',
356
+ options: [{ autofix: true }],
357
+ code: `<template><bento-filter-bar v-model="filters" /></template>`,
358
+ output: `<template><bento-filter-bar /></template>`,
359
+ errors: [{ messageId: 'deprecationValue' }],
360
+ },
361
+ {
362
+ name: 'Autofix: removes value from filter config item',
363
+ filename: 'test.vue',
364
+ options: [{ autofix: true }],
365
+ code: `
366
+ <script setup>
367
+ const config = [{
368
+ field: 'name',
369
+ type: 'BentoInputFilter',
370
+ value: 'test',
371
+ }];
372
+ </script>
373
+ <template><bento-filter-bar :config="config" /></template>
374
+ `,
375
+ output: `
376
+ <script setup>
377
+ const config = [{
378
+ field: 'name',
379
+ type: 'BentoInputFilter',
380
+ }];
381
+ </script>
382
+ <template><bento-filter-bar :config="config" /></template>
383
+ `,
384
+ errors: [{ messageId: 'deprecationConfigValue' }],
385
+ },
386
+ {
387
+ name: 'Autofix: removes deprecated messages option from filter config',
388
+ filename: 'test.vue',
389
+ options: [{ autofix: true }],
390
+ code: `
391
+ <script setup>
392
+ const config = [{
393
+ field: 'status',
394
+ type: 'BentoSelectFilter',
395
+ options: { messages: {}, listboxItems: [] },
396
+ }];
397
+ </script>
398
+ <template><bento-filter-bar :config="config" /></template>
399
+ `,
400
+ output: `
401
+ <script setup>
402
+ const config = [{
403
+ field: 'status',
404
+ type: 'BentoSelectFilter',
405
+ options: { listboxItems: [] },
406
+ }];
407
+ </script>
408
+ <template><bento-filter-bar :config="config" /></template>
409
+ `,
410
+ errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
411
+ },
412
+ {
413
+ name: 'Autofix: does not fix when autofix is false',
414
+ filename: 'test.vue',
415
+ options: [{ autofix: false }],
416
+ code: `<template><bento-filter-bar value="val" other="x" /></template>`,
417
+ errors: [{ messageId: 'deprecationValue' }],
418
+ },
419
+ ],
420
+ });
421
+ });