@adyen/eslint-plugin-bento 2.7.7 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +48 -15
- package/configs/tailwind.js +17 -0
- package/configs/vue-recommended.js +3 -0
- package/configs/vue-strict.js +3 -0
- package/index.js +5 -0
- package/package.json +1 -1
- package/rules/deprecation-bento-dropdown-size-prop/README.md +25 -0
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +9 -0
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +26 -0
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +33 -0
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.js +78 -0
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +101 -0
- package/rules/deprecation-components-error-prop/README.md +43 -0
- package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +17 -0
- package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +26 -0
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +37 -0
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.js +79 -0
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +120 -0
- package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +1 -1
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.js +19 -4
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +40 -0
- package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +1 -1
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.js +24 -7
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +56 -0
- package/rules/deprecation-filter-bar-deprecated-props/README.md +64 -0
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +48 -0
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +25 -0
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +22 -0
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +187 -0
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +421 -0
- package/rules/tailwind-v3-to-bento/README.md +114 -0
- package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +24 -0
- package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +15 -0
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +29 -0
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.js +377 -0
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +403 -0
|
@@ -163,12 +163,37 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
163
163
|
},
|
|
164
164
|
],
|
|
165
165
|
invalid: [
|
|
166
|
+
/* autofix: false */
|
|
167
|
+
{
|
|
168
|
+
name: 'Invalid: Static prop with autofix disabled (explicit false)',
|
|
169
|
+
filename: 'test.vue',
|
|
170
|
+
code: `<template><bento-input-field value="val" /></template>`,
|
|
171
|
+
output: null,
|
|
172
|
+
options: [{ autofix: false }],
|
|
173
|
+
errors: [{ messageId: 'deprecation' }],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'Invalid: Dynamic prop with autofix disabled (no options)',
|
|
177
|
+
filename: 'test.vue',
|
|
178
|
+
code: `<template><bento-dropdown :value="val" /></template>`,
|
|
179
|
+
output: null,
|
|
180
|
+
errors: [{ messageId: 'deprecation' }],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'Invalid: Static prop with autofix disabled (no options)',
|
|
184
|
+
filename: 'test.vue',
|
|
185
|
+
code: `<template><bento-textarea value="val" /></template>`,
|
|
186
|
+
output: null,
|
|
187
|
+
errors: [{ messageId: 'deprecation' }],
|
|
188
|
+
},
|
|
189
|
+
/* autofix: true */
|
|
166
190
|
// bento-date-picker: Static
|
|
167
191
|
{
|
|
168
192
|
name: 'Invalid: Static prop on bento-date-picker',
|
|
169
193
|
filename: 'test.vue',
|
|
170
194
|
code: `<template><bento-date-picker value="val" /></template>`,
|
|
171
195
|
output: `<template><bento-date-picker model-value="val" /></template>`,
|
|
196
|
+
options: [{ autofix: true }],
|
|
172
197
|
errors: [{ messageId: 'deprecation' }],
|
|
173
198
|
},
|
|
174
199
|
// bento-date-picker: Shorthand
|
|
@@ -177,6 +202,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
177
202
|
filename: 'test.vue',
|
|
178
203
|
code: `<template><bento-date-picker :value="val" /></template>`,
|
|
179
204
|
output: `<template><bento-date-picker :model-value="val" /></template>`,
|
|
205
|
+
options: [{ autofix: true }],
|
|
180
206
|
errors: [{ messageId: 'deprecation' }],
|
|
181
207
|
},
|
|
182
208
|
// bento-date-range-picker: Static
|
|
@@ -185,6 +211,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
185
211
|
filename: 'test.vue',
|
|
186
212
|
code: `<template><bento-date-range-picker value="val" /></template>`,
|
|
187
213
|
output: `<template><bento-date-range-picker model-value="val" /></template>`,
|
|
214
|
+
options: [{ autofix: true }],
|
|
188
215
|
errors: [{ messageId: 'deprecation' }],
|
|
189
216
|
},
|
|
190
217
|
// bento-date-range-picker: Shorthand
|
|
@@ -193,6 +220,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
193
220
|
filename: 'test.vue',
|
|
194
221
|
code: `<template><bento-date-range-picker :value="val" /></template>`,
|
|
195
222
|
output: `<template><bento-date-range-picker :model-value="val" /></template>`,
|
|
223
|
+
options: [{ autofix: true }],
|
|
196
224
|
errors: [{ messageId: 'deprecation' }],
|
|
197
225
|
},
|
|
198
226
|
// bento-dropdown: Static
|
|
@@ -201,6 +229,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
201
229
|
filename: 'test.vue',
|
|
202
230
|
code: `<template><bento-dropdown value="val" /></template>`,
|
|
203
231
|
output: `<template><bento-dropdown model-value="val" /></template>`,
|
|
232
|
+
options: [{ autofix: true }],
|
|
204
233
|
errors: [{ messageId: 'deprecation' }],
|
|
205
234
|
},
|
|
206
235
|
// bento-dropdown: Shorthand
|
|
@@ -209,6 +238,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
209
238
|
filename: 'test.vue',
|
|
210
239
|
code: `<template><bento-dropdown :value="val" /></template>`,
|
|
211
240
|
output: `<template><bento-dropdown :model-value="val" /></template>`,
|
|
241
|
+
options: [{ autofix: true }],
|
|
212
242
|
errors: [{ messageId: 'deprecation' }],
|
|
213
243
|
},
|
|
214
244
|
// bento-dropdown-avatar: Static
|
|
@@ -217,6 +247,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
217
247
|
filename: 'test.vue',
|
|
218
248
|
code: `<template><bento-dropdown-avatar value="val" /></template>`,
|
|
219
249
|
output: `<template><bento-dropdown-avatar model-value="val" /></template>`,
|
|
250
|
+
options: [{ autofix: true }],
|
|
220
251
|
errors: [{ messageId: 'deprecation' }],
|
|
221
252
|
},
|
|
222
253
|
// bento-dropdown-avatar: Shorthand
|
|
@@ -225,6 +256,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
225
256
|
filename: 'test.vue',
|
|
226
257
|
code: `<template><bento-dropdown-avatar :value="val" /></template>`,
|
|
227
258
|
output: `<template><bento-dropdown-avatar :model-value="val" /></template>`,
|
|
259
|
+
options: [{ autofix: true }],
|
|
228
260
|
errors: [{ messageId: 'deprecation' }],
|
|
229
261
|
},
|
|
230
262
|
// bento-dropdown-country: Static
|
|
@@ -233,6 +265,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
233
265
|
filename: 'test.vue',
|
|
234
266
|
code: `<template><bento-dropdown-country value="val" /></template>`,
|
|
235
267
|
output: `<template><bento-dropdown-country model-value="val" /></template>`,
|
|
268
|
+
options: [{ autofix: true }],
|
|
236
269
|
errors: [{ messageId: 'deprecation' }],
|
|
237
270
|
},
|
|
238
271
|
// bento-dropdown-country: Shorthand
|
|
@@ -241,6 +274,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
241
274
|
filename: 'test.vue',
|
|
242
275
|
code: `<template><bento-dropdown-country :value="val" /></template>`,
|
|
243
276
|
output: `<template><bento-dropdown-country :model-value="val" /></template>`,
|
|
277
|
+
options: [{ autofix: true }],
|
|
244
278
|
errors: [{ messageId: 'deprecation' }],
|
|
245
279
|
},
|
|
246
280
|
// bento-dropdown-currency: Static
|
|
@@ -249,6 +283,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
249
283
|
filename: 'test.vue',
|
|
250
284
|
code: `<template><bento-dropdown-currency value="val" /></template>`,
|
|
251
285
|
output: `<template><bento-dropdown-currency model-value="val" /></template>`,
|
|
286
|
+
options: [{ autofix: true }],
|
|
252
287
|
errors: [{ messageId: 'deprecation' }],
|
|
253
288
|
},
|
|
254
289
|
// bento-dropdown-currency: Shorthand
|
|
@@ -257,6 +292,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
257
292
|
filename: 'test.vue',
|
|
258
293
|
code: `<template><bento-dropdown-currency :value="val" /></template>`,
|
|
259
294
|
output: `<template><bento-dropdown-currency :model-value="val" /></template>`,
|
|
295
|
+
options: [{ autofix: true }],
|
|
260
296
|
errors: [{ messageId: 'deprecation' }],
|
|
261
297
|
},
|
|
262
298
|
// bento-dropdown-payment-method: Static
|
|
@@ -265,6 +301,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
265
301
|
filename: 'test.vue',
|
|
266
302
|
code: `<template><bento-dropdown-payment-method value="val" /></template>`,
|
|
267
303
|
output: `<template><bento-dropdown-payment-method model-value="val" /></template>`,
|
|
304
|
+
options: [{ autofix: true }],
|
|
268
305
|
errors: [{ messageId: 'deprecation' }],
|
|
269
306
|
},
|
|
270
307
|
// bento-dropdown-payment-method: Shorthand
|
|
@@ -273,6 +310,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
273
310
|
filename: 'test.vue',
|
|
274
311
|
code: `<template><bento-dropdown-payment-method :value="val" /></template>`,
|
|
275
312
|
output: `<template><bento-dropdown-payment-method :model-value="val" /></template>`,
|
|
313
|
+
options: [{ autofix: true }],
|
|
276
314
|
errors: [{ messageId: 'deprecation' }],
|
|
277
315
|
},
|
|
278
316
|
// bento-dropdown-tag: Static
|
|
@@ -281,6 +319,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
281
319
|
filename: 'test.vue',
|
|
282
320
|
code: `<template><bento-dropdown-tag value="val" /></template>`,
|
|
283
321
|
output: `<template><bento-dropdown-tag model-value="val" /></template>`,
|
|
322
|
+
options: [{ autofix: true }],
|
|
284
323
|
errors: [{ messageId: 'deprecation' }],
|
|
285
324
|
},
|
|
286
325
|
// bento-dropdown-tag: Shorthand
|
|
@@ -289,6 +328,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
289
328
|
filename: 'test.vue',
|
|
290
329
|
code: `<template><bento-dropdown-tag :value="val" /></template>`,
|
|
291
330
|
output: `<template><bento-dropdown-tag :model-value="val" /></template>`,
|
|
331
|
+
options: [{ autofix: true }],
|
|
292
332
|
errors: [{ messageId: 'deprecation' }],
|
|
293
333
|
},
|
|
294
334
|
// bento-file-uploader: Static
|
|
@@ -297,6 +337,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
297
337
|
filename: 'test.vue',
|
|
298
338
|
code: `<template><bento-file-uploader value="val" /></template>`,
|
|
299
339
|
output: `<template><bento-file-uploader model-value="val" /></template>`,
|
|
340
|
+
options: [{ autofix: true }],
|
|
300
341
|
errors: [{ messageId: 'deprecation' }],
|
|
301
342
|
},
|
|
302
343
|
// bento-file-uploader: Shorthand
|
|
@@ -305,6 +346,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
305
346
|
filename: 'test.vue',
|
|
306
347
|
code: `<template><bento-file-uploader :value="val" /></template>`,
|
|
307
348
|
output: `<template><bento-file-uploader :model-value="val" /></template>`,
|
|
349
|
+
options: [{ autofix: true }],
|
|
308
350
|
errors: [{ messageId: 'deprecation' }],
|
|
309
351
|
},
|
|
310
352
|
// bento-input-field: Static
|
|
@@ -313,6 +355,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
313
355
|
filename: 'test.vue',
|
|
314
356
|
code: `<template><bento-input-field value="val" /></template>`,
|
|
315
357
|
output: `<template><bento-input-field model-value="val" /></template>`,
|
|
358
|
+
options: [{ autofix: true }],
|
|
316
359
|
errors: [{ messageId: 'deprecation' }],
|
|
317
360
|
},
|
|
318
361
|
// bento-input-field: Shorthand
|
|
@@ -321,6 +364,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
321
364
|
filename: 'test.vue',
|
|
322
365
|
code: `<template><bento-input-field :value="val" /></template>`,
|
|
323
366
|
output: `<template><bento-input-field :model-value="val" /></template>`,
|
|
367
|
+
options: [{ autofix: true }],
|
|
324
368
|
errors: [{ messageId: 'deprecation' }],
|
|
325
369
|
},
|
|
326
370
|
// bento-input-field-password: Static
|
|
@@ -329,6 +373,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
329
373
|
filename: 'test.vue',
|
|
330
374
|
code: `<template><bento-input-field-password value="val" /></template>`,
|
|
331
375
|
output: `<template><bento-input-field-password model-value="val" /></template>`,
|
|
376
|
+
options: [{ autofix: true }],
|
|
332
377
|
errors: [{ messageId: 'deprecation' }],
|
|
333
378
|
},
|
|
334
379
|
// bento-input-field-password: Shorthand
|
|
@@ -337,6 +382,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
337
382
|
filename: 'test.vue',
|
|
338
383
|
code: `<template><bento-input-field-password :value="val" /></template>`,
|
|
339
384
|
output: `<template><bento-input-field-password :model-value="val" /></template>`,
|
|
385
|
+
options: [{ autofix: true }],
|
|
340
386
|
errors: [{ messageId: 'deprecation' }],
|
|
341
387
|
},
|
|
342
388
|
// bento-input-field-phone-number: Static
|
|
@@ -345,6 +391,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
345
391
|
filename: 'test.vue',
|
|
346
392
|
code: `<template><bento-input-field-phone-number value="val" /></template>`,
|
|
347
393
|
output: `<template><bento-input-field-phone-number model-value="val" /></template>`,
|
|
394
|
+
options: [{ autofix: true }],
|
|
348
395
|
errors: [{ messageId: 'deprecation' }],
|
|
349
396
|
},
|
|
350
397
|
// bento-input-field-phone-number: Shorthand
|
|
@@ -353,6 +400,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
353
400
|
filename: 'test.vue',
|
|
354
401
|
code: `<template><bento-input-field-phone-number :value="val" /></template>`,
|
|
355
402
|
output: `<template><bento-input-field-phone-number :model-value="val" /></template>`,
|
|
403
|
+
options: [{ autofix: true }],
|
|
356
404
|
errors: [{ messageId: 'deprecation' }],
|
|
357
405
|
},
|
|
358
406
|
// bento-checkbox-group: Static
|
|
@@ -361,6 +409,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
361
409
|
filename: 'test.vue',
|
|
362
410
|
code: `<template><bento-checkbox-group value="val" /></template>`,
|
|
363
411
|
output: `<template><bento-checkbox-group model-value="val" /></template>`,
|
|
412
|
+
options: [{ autofix: true }],
|
|
364
413
|
errors: [{ messageId: 'deprecation' }],
|
|
365
414
|
},
|
|
366
415
|
// bento-checkbox-group: Shorthand
|
|
@@ -369,6 +418,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
369
418
|
filename: 'test.vue',
|
|
370
419
|
code: `<template><bento-checkbox-group :value="val" /></template>`,
|
|
371
420
|
output: `<template><bento-checkbox-group :model-value="val" /></template>`,
|
|
421
|
+
options: [{ autofix: true }],
|
|
372
422
|
errors: [{ messageId: 'deprecation' }],
|
|
373
423
|
},
|
|
374
424
|
// bento-radio-group: Static
|
|
@@ -377,6 +427,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
377
427
|
filename: 'test.vue',
|
|
378
428
|
code: `<template><bento-radio-group value="val" /></template>`,
|
|
379
429
|
output: `<template><bento-radio-group model-value="val" /></template>`,
|
|
430
|
+
options: [{ autofix: true }],
|
|
380
431
|
errors: [{ messageId: 'deprecation' }],
|
|
381
432
|
},
|
|
382
433
|
// bento-radio-group: Shorthand
|
|
@@ -385,6 +436,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
385
436
|
filename: 'test.vue',
|
|
386
437
|
code: `<template><bento-radio-group :value="val" /></template>`,
|
|
387
438
|
output: `<template><bento-radio-group :model-value="val" /></template>`,
|
|
439
|
+
options: [{ autofix: true }],
|
|
388
440
|
errors: [{ messageId: 'deprecation' }],
|
|
389
441
|
},
|
|
390
442
|
// bento-selection-card-group: Static
|
|
@@ -393,6 +445,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
393
445
|
filename: 'test.vue',
|
|
394
446
|
code: `<template><bento-selection-card-group value="val" /></template>`,
|
|
395
447
|
output: `<template><bento-selection-card-group model-value="val" /></template>`,
|
|
448
|
+
options: [{ autofix: true }],
|
|
396
449
|
errors: [{ messageId: 'deprecation' }],
|
|
397
450
|
},
|
|
398
451
|
// bento-selection-card-group: Shorthand
|
|
@@ -401,6 +454,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
401
454
|
filename: 'test.vue',
|
|
402
455
|
code: `<template><bento-selection-card-group :value="val" /></template>`,
|
|
403
456
|
output: `<template><bento-selection-card-group :model-value="val" /></template>`,
|
|
457
|
+
options: [{ autofix: true }],
|
|
404
458
|
errors: [{ messageId: 'deprecation' }],
|
|
405
459
|
},
|
|
406
460
|
// bento-textarea: Static
|
|
@@ -409,6 +463,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
409
463
|
filename: 'test.vue',
|
|
410
464
|
code: `<template><bento-textarea value="val" /></template>`,
|
|
411
465
|
output: `<template><bento-textarea model-value="val" /></template>`,
|
|
466
|
+
options: [{ autofix: true }],
|
|
412
467
|
errors: [{ messageId: 'deprecation' }],
|
|
413
468
|
},
|
|
414
469
|
// bento-textarea: Shorthand
|
|
@@ -417,6 +472,7 @@ describe('@adyen/bento/deprecation-components-value-prop', () => {
|
|
|
417
472
|
filename: 'test.vue',
|
|
418
473
|
code: `<template><bento-textarea :value="val" /></template>`,
|
|
419
474
|
output: `<template><bento-textarea :model-value="val" /></template>`,
|
|
475
|
+
options: [{ autofix: true }],
|
|
420
476
|
errors: [{ messageId: 'deprecation' }],
|
|
421
477
|
},
|
|
422
478
|
],
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# deprecation-filter-bar-deprecated-props
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Deprecates the following props and options in `bento-filter-bar` and `bento-data-grid` filter configs:
|
|
6
|
+
|
|
7
|
+
### Direct prop on `bento-filter-bar`
|
|
8
|
+
|
|
9
|
+
| Deprecated | Replacement |
|
|
10
|
+
| ---------- | ---------------------------- |
|
|
11
|
+
| `value` | `config` and `filter-values` |
|
|
12
|
+
|
|
13
|
+
### Nested options in filter config items (`BentoSelectFilterOptions`)
|
|
14
|
+
|
|
15
|
+
| Deprecated | Replacement |
|
|
16
|
+
| --------------------------------------------------- | ------------------------------------------------- |
|
|
17
|
+
| `messages` | None (persistent filter label now uses a counter) |
|
|
18
|
+
| `messagesPersistentButtonLabelPartiallySelectedKey` | None |
|
|
19
|
+
| `messagesPersistentButtonLabelAllSelectedKey` | None |
|
|
20
|
+
|
|
21
|
+
### `value` on filter config items (`BentoFilterModel`)
|
|
22
|
+
|
|
23
|
+
| Deprecated | Replacement |
|
|
24
|
+
| ---------- | --------------- |
|
|
25
|
+
| `value` | `filter-values` |
|
|
26
|
+
|
|
27
|
+
## Rule Details
|
|
28
|
+
|
|
29
|
+
### ❌ Incorrect
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<bento-filter-bar :value="filters" /> <bento-filter-bar v-model="filters" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const config = [
|
|
37
|
+
{
|
|
38
|
+
field: 'status',
|
|
39
|
+
type: 'BentoSelectFilter',
|
|
40
|
+
value: 'active',
|
|
41
|
+
options: {
|
|
42
|
+
messages: { en: { persistentButtonLabelPartiallySelected: 'x' } },
|
|
43
|
+
messagesPersistentButtonLabelPartiallySelectedKey: 'customKey',
|
|
44
|
+
messagesPersistentButtonLabelAllSelectedKey: 'customKey',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### ✅ Correct
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<bento-filter-bar :config="config" :filter-values="values" />
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const config = [
|
|
58
|
+
{
|
|
59
|
+
field: 'status',
|
|
60
|
+
type: 'BentoSelectFilter',
|
|
61
|
+
options: { listboxItems: [] },
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- Direct value prop on bento-filter-bar: 3 warnings -->
|
|
4
|
+
<bento-filter-bar value="val" />
|
|
5
|
+
<bento-filter-bar :value="filters" />
|
|
6
|
+
<bento-filter-bar v-model="filters" />
|
|
7
|
+
|
|
8
|
+
<!-- Script-defined config with deprecated value + options: used below -->
|
|
9
|
+
<bento-filter-bar :config="configWithValue" />
|
|
10
|
+
<bento-data-grid :filters="configWithOptions" />
|
|
11
|
+
|
|
12
|
+
<!-- Inline template config with deprecated options: 1 warning -->
|
|
13
|
+
<bento-filter-bar
|
|
14
|
+
:config="[
|
|
15
|
+
{
|
|
16
|
+
field: 'inline',
|
|
17
|
+
type: 'BentoSelectFilter',
|
|
18
|
+
options: { messages: {} },
|
|
19
|
+
},
|
|
20
|
+
]"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
26
|
+
// 1 warning (value on config item)
|
|
27
|
+
const configWithValue = [
|
|
28
|
+
{
|
|
29
|
+
field: 'name',
|
|
30
|
+
type: 'BentoInputFilter',
|
|
31
|
+
value: 'test',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
// 3 warnings (messages + 2 keys)
|
|
36
|
+
const configWithOptions = [
|
|
37
|
+
{
|
|
38
|
+
field: 'status',
|
|
39
|
+
type: 'BentoSelectFilter',
|
|
40
|
+
options: {
|
|
41
|
+
messages: {},
|
|
42
|
+
messagesPersistentButtonLabelPartiallySelectedKey: 'k1',
|
|
43
|
+
messagesPersistentButtonLabelAllSelectedKey: 'k2',
|
|
44
|
+
listboxItems: [],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
</script>
|
|
@@ -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
|
+
});
|
package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js
ADDED
|
@@ -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
|
+
};
|