@adyen/eslint-plugin-bento 2.23.0 → 2.24.1

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 (82) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +31 -15
  3. package/configs/vue-recommended.js +15 -0
  4. package/configs/vue-strict.js +15 -0
  5. package/index.js +3 -0
  6. package/package.json +1 -1
  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/vue-no-redundant-dialog-v-if/README.md +55 -0
  10. package/rules/vue-no-redundant-dialog-v-if/vue-no-redundant-dialog-v-if.js +150 -0
  11. package/rules/vue-no-use-bento-translation-overrides/README.md +14 -0
  12. package/rules/vue-no-use-bento-translation-overrides/vue-no-use-bento-translation-overrides.js +93 -0
  13. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/deprecation-bento-data-grid-cell-action-menu-item-handler.vue +0 -63
  14. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/eslint.config.js +0 -26
  15. 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
  16. package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/deprecation-bento-data-grid-cell-action-menu-item-handler.test.ts +0 -116
  17. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -10
  18. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/eslint.config.js +0 -29
  19. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -11
  20. package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/eslint.config.js +0 -29
  21. package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.integration.test.ts +0 -47
  22. package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.test.ts +0 -176
  23. package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +0 -9
  24. package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +0 -26
  25. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +0 -33
  26. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +0 -101
  27. package/rules/deprecation-bento-popover-modifiers-prop/__tests__/deprecation-bento-popover-modifiers-prop.vue +0 -9
  28. package/rules/deprecation-bento-popover-modifiers-prop/__tests__/eslint.config.js +0 -26
  29. package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.integration.test.ts +0 -24
  30. package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.test.ts +0 -109
  31. package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/deprecation-bento-timeline-item-variant-prop.vue +0 -9
  32. package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/eslint.config.js +0 -26
  33. package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.integration.test.ts +0 -35
  34. package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.test.ts +0 -141
  35. package/rules/deprecation-components-aria-label-prop/__tests__/deprecation-components-aria-label-prop.vue +0 -25
  36. package/rules/deprecation-components-aria-label-prop/__tests__/eslint.config.js +0 -26
  37. package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.integration.test.ts +0 -36
  38. package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.test.ts +0 -194
  39. package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +0 -17
  40. package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +0 -26
  41. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +0 -41
  42. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +0 -153
  43. package/rules/deprecation-components-has-error-prop/__tests__/deprecation-components-has-error-prop.vue +0 -13
  44. package/rules/deprecation-components-has-error-prop/__tests__/eslint.config.js +0 -26
  45. package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.integration.test.ts +0 -37
  46. package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.test.ts +0 -122
  47. package/rules/deprecation-components-input-emit/__tests__/deprecation-components-input-emit.vue +0 -22
  48. package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +0 -25
  49. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.integration.test.ts +0 -43
  50. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +0 -320
  51. package/rules/deprecation-components-value-prop/__tests__/deprecation-components-value-prop.vue +0 -69
  52. package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +0 -25
  53. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.integration.test.ts +0 -37
  54. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +0 -480
  55. package/rules/deprecation-country-custom-usage/__tests__/deprecation-country-custom-usage.vue +0 -93
  56. package/rules/deprecation-country-custom-usage/__tests__/eslint.config.js +0 -25
  57. package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.integration.test.ts +0 -22
  58. package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.test.ts +0 -380
  59. package/rules/deprecation-currency-default-slot/__tests__/deprecation-currency-default-slot.vue +0 -7
  60. package/rules/deprecation-currency-default-slot/__tests__/eslint.config.js +0 -24
  61. package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.integration.test.ts +0 -29
  62. package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.test.ts +0 -136
  63. package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +0 -62
  64. package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +0 -25
  65. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +0 -22
  66. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +0 -492
  67. package/rules/deprecation-input-filter-dropdown-options/__tests__/deprecation-input-filter-dropdown-options.vue +0 -46
  68. package/rules/deprecation-input-filter-dropdown-options/__tests__/eslint.config.js +0 -26
  69. package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.integration.test.ts +0 -27
  70. package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.test.ts +0 -392
  71. package/rules/deprecation-tag-default-slot/__tests__/deprecation-tag-default-slot.vue +0 -5
  72. package/rules/deprecation-tag-default-slot/__tests__/eslint.config.js +0 -24
  73. package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.integration.test.ts +0 -29
  74. package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.test.ts +0 -163
  75. package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +0 -24
  76. package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +0 -15
  77. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +0 -29
  78. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +0 -403
  79. package/rules/vue-old-spacer-tokens/__tests__/eslint.config.js +0 -24
  80. package/rules/vue-old-spacer-tokens/__tests__/vue-old-spacer-tokens.vue +0 -5
  81. package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.integration.test.ts +0 -29
  82. package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.test.ts +0 -77
@@ -1,33 +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-bento-dropdown-size-prop', () => {
5
- it('should lint with warning', () => {
6
- // Load .eslintrc
7
- const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
8
- // Load the test file generated alongside this one
9
- const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-bento-dropdown-size-prop.vue');
10
-
11
- // Execute the linter
12
- const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
13
-
14
- /* ------------------------------------------------ */
15
- /* CASE 2: SINGLE REPLACEMENT */
16
- /* ------------------------------------------------ */
17
-
18
- // For props, we generate 3 examples (static, shorthand, longhand) FOR EACH component.
19
- // Total = (Number of Components) * 3
20
- const numberOfComponents = 1;
21
- expect(result[0].warningCount).toBe(numberOfComponents * 3);
22
-
23
- // Verify the message structure on the first error found.
24
- // Since the rule is the same for all components, checking the first one confirms the message is correct.
25
- expect(result[0].messages[0]).toMatchObject({
26
- ruleId: '@adyen/bento/deprecation-bento-dropdown-size-prop',
27
- severity: 1,
28
-
29
- messageId: 'deprecation',
30
- message: `The "size" prop is deprecated.`,
31
- });
32
- });
33
- });
@@ -1,101 +0,0 @@
1
- import { RuleTester } from 'eslint';
2
- import vueParser from 'vue-eslint-parser';
3
- import tsParser from '@typescript-eslint/parser';
4
- import deprecationBentoDropdownSizeProp from './deprecation-bento-dropdown-size-prop';
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-bento-dropdown-size-prop', () => {
18
- ruleTester.run('deprecation-bento-dropdown-size-prop', deprecationBentoDropdownSizeProp, {
19
- valid: [
20
- {
21
- name: 'Valid usage for bento-dropdown',
22
- filename: 'test.vue',
23
- code: `
24
- <template>
25
- <bento-dropdown other-prop="val" />
26
- </template>
27
- `,
28
- },
29
- ],
30
- invalid: [
31
- // bento-dropdown: Static
32
- {
33
- name: 'Invalid: Static prop on bento-dropdown',
34
- filename: 'test.vue',
35
- code: `<template><bento-dropdown size="small" /></template>`,
36
- errors: [{ messageId: 'deprecation' }],
37
- },
38
- // bento-dropdown: Shorthand
39
- {
40
- name: 'Invalid: Dynamic prop on bento-dropdown',
41
- filename: 'test.vue',
42
- code: `<template><bento-dropdown :size="dropdownSize" /></template>`,
43
- errors: [{ messageId: 'deprecation' }],
44
- },
45
- // bento-dropdown: v-bind longhand
46
- {
47
- name: 'Invalid: v-bind longhand prop on bento-dropdown',
48
- filename: 'test.vue',
49
- code: `<template><bento-dropdown v-bind:size="dropdownSize" /></template>`,
50
- errors: [{ messageId: 'deprecation' }],
51
- },
52
- ],
53
- });
54
-
55
- /* ------------------------------------------------ */
56
- /* AUTOFIX TESTS */
57
- /* ------------------------------------------------ */
58
- ruleTester.run('deprecation-bento-dropdown-size-prop (autofix enabled)', deprecationBentoDropdownSizeProp, {
59
- valid: [
60
- {
61
- name: 'Valid: no size prop (autofix enabled)',
62
- filename: 'test.vue',
63
- options: [{ autofix: true }],
64
- code: `<template><bento-dropdown :items="items" /></template>`,
65
- },
66
- ],
67
- invalid: [
68
- {
69
- name: 'Autofix: removes static size prop',
70
- filename: 'test.vue',
71
- options: [{ autofix: true }],
72
- code: `<template><bento-dropdown size="small" /></template>`,
73
- output: `<template><bento-dropdown /></template>`,
74
- errors: [{ messageId: 'deprecation' }],
75
- },
76
- {
77
- name: 'Autofix: removes dynamic size prop',
78
- filename: 'test.vue',
79
- options: [{ autofix: true }],
80
- code: `<template><bento-dropdown :size="dropdownSize" /></template>`,
81
- output: `<template><bento-dropdown /></template>`,
82
- errors: [{ messageId: 'deprecation' }],
83
- },
84
- {
85
- name: 'Autofix: removes v-bind longhand size prop',
86
- filename: 'test.vue',
87
- options: [{ autofix: true }],
88
- code: `<template><bento-dropdown v-bind:size="dropdownSize" /></template>`,
89
- output: `<template><bento-dropdown /></template>`,
90
- errors: [{ messageId: 'deprecation' }],
91
- },
92
- {
93
- name: 'Autofix: does not fix when autofix is false',
94
- filename: 'test.vue',
95
- options: [{ autofix: false }],
96
- code: `<template><bento-dropdown size="small" other="x" /></template>`,
97
- errors: [{ messageId: 'deprecation' }],
98
- },
99
- ],
100
- });
101
- });
@@ -1,9 +0,0 @@
1
- <template>
2
- <div>
3
- <bento-popover modifiers="value" />
4
- <bento-popover :modifiers="value" />
5
- <bento-popover :modifiers="value" />
6
- </div>
7
- </template>
8
-
9
- <script setup></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-bento-popover-modifiers-prop': ['warn', { autofix: true }],
23
- },
24
- files: ['**/*.vue'],
25
- },
26
- ]);
@@ -1,24 +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-bento-popover-modifiers-prop', () => {
5
- it('should lint with warning', () => {
6
- // Load .eslintrc
7
- const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
8
- // Load the test file generated alongside this one
9
- const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-bento-popover-modifiers-prop.vue');
10
-
11
- // Execute the linter
12
- const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
13
-
14
- // 3 examples: static, shorthand, longhand
15
- expect(result[0].warningCount).toBe(3);
16
- expect(result[0].messages[0]).toMatchObject({
17
- ruleId: '@adyen/bento/deprecation-bento-popover-modifiers-prop',
18
- severity: 1,
19
-
20
- messageId: 'deprecation',
21
- message: `The "modifiers" prop is deprecated.`,
22
- });
23
- });
24
- });
@@ -1,109 +0,0 @@
1
- import { RuleTester } from 'eslint';
2
- import vueParser from 'vue-eslint-parser';
3
- import tsParser from '@typescript-eslint/parser';
4
- import deprecationBentoPopoverModifiersProp from './deprecation-bento-popover-modifiers-prop';
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-bento-popover-modifiers-prop', () => {
18
- ruleTester.run('deprecation-bento-popover-modifiers-prop', deprecationBentoPopoverModifiersProp, {
19
- valid: [
20
- {
21
- name: 'Valid usage for bento-popover',
22
- filename: 'test.vue',
23
- code: `
24
- <template>
25
- <bento-popover other-prop="val" />
26
- </template>
27
- `,
28
- },
29
- ],
30
- invalid: [
31
- {
32
- name: 'Invalid: autofix disabled (explicit false)',
33
- filename: 'test.vue',
34
- code: `<template><bento-popover modifiers="val" /></template>`,
35
- output: null,
36
- options: [{ autofix: false }],
37
- errors: [{ messageId: 'deprecation' }],
38
- },
39
- {
40
- name: 'Invalid: autofix disabled (no options)',
41
- filename: 'test.vue',
42
- code: `<template><bento-popover :modifiers="val" /></template>`,
43
- output: null,
44
- errors: [{ messageId: 'deprecation' }],
45
- },
46
- // bento-popover: Static
47
- {
48
- name: 'Invalid: Static prop on bento-popover',
49
- filename: 'test.vue',
50
- code: `<template><bento-popover modifiers="val" /></template>`,
51
- errors: [{ messageId: 'deprecation' }],
52
- },
53
- // bento-popover: v-bind longhand
54
- {
55
- name: 'Invalid: v-bind longhand prop on bento-popover',
56
- filename: 'test.vue',
57
- code: `<template><bento-popover v-bind:modifiers="val" /></template>`,
58
- errors: [{ messageId: 'deprecation' }],
59
- },
60
- ],
61
- });
62
-
63
- /* ------------------------------------------------ */
64
- /* AUTOFIX TESTS */
65
- /* ------------------------------------------------ */
66
- ruleTester.run('deprecation-bento-popover-modifiers-prop (autofix enabled)', deprecationBentoPopoverModifiersProp, {
67
- valid: [
68
- {
69
- name: 'Valid: no modifiers prop (autofix enabled)',
70
- filename: 'test.vue',
71
- options: [{ autofix: true }],
72
- code: `<template><bento-popover position="top" /></template>`,
73
- },
74
- ],
75
- invalid: [
76
- {
77
- name: 'Autofix: removes static modifiers prop',
78
- filename: 'test.vue',
79
- options: [{ autofix: true }],
80
- code: `<template><bento-popover modifiers="val" /></template>`,
81
- output: `<template><bento-popover /></template>`,
82
- errors: [{ messageId: 'deprecation' }],
83
- },
84
- {
85
- name: 'Autofix: removes dynamic modifiers prop',
86
- filename: 'test.vue',
87
- options: [{ autofix: true }],
88
- code: `<template><bento-popover :modifiers="val" /></template>`,
89
- output: `<template><bento-popover /></template>`,
90
- errors: [{ messageId: 'deprecation' }],
91
- },
92
- {
93
- name: 'Autofix: removes v-bind longhand modifiers prop',
94
- filename: 'test.vue',
95
- options: [{ autofix: true }],
96
- code: `<template><bento-popover v-bind:modifiers="val" /></template>`,
97
- output: `<template><bento-popover /></template>`,
98
- errors: [{ messageId: 'deprecation' }],
99
- },
100
- {
101
- name: 'Autofix: does not fix when autofix is false',
102
- filename: 'test.vue',
103
- options: [{ autofix: false }],
104
- code: `<template><bento-popover modifiers="val" other="x" /></template>`,
105
- errors: [{ messageId: 'deprecation' }],
106
- },
107
- ],
108
- });
109
- });
@@ -1,9 +0,0 @@
1
- <template>
2
- <div>
3
- <bento-timeline-item variant="CheckedCircleIcon" />
4
- <bento-timeline-item :variant="BentoTimelineItemVariant.CRITICAL" />
5
- <bento-timeline-item :variant="BentoTimelineItemVariant.DEFAULT" />
6
- </div>
7
- </template>
8
-
9
- <script setup></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-bento-timeline-item-variant-prop': ['warn', { autofix: true }],
23
- },
24
- files: ['**/*.vue'],
25
- },
26
- ]);
@@ -1,35 +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-bento-timeline-item-variant-prop', () => {
5
- it('should lint with warning', () => {
6
- // Load .eslintrc
7
- const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
8
- // Load the test file generated alongside this one
9
- const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-bento-timeline-item-variant-prop.vue');
10
-
11
- // Strip any non-JSON preamble (e.g. pnpm warnings)
12
- const rawOutput = execFileSyncEslintVueFiles(eslintrc, vueFile);
13
- const jsonStart = rawOutput.indexOf('[');
14
-
15
- // Execute the linter
16
- const result = JSON.parse(jsonStart >= 0 ? rawOutput.slice(jsonStart) : rawOutput);
17
-
18
- // 3 examples: static, shorthand, longhand
19
- expect(result[0].warningCount).toBe(3);
20
-
21
- // Verify the message structure on the first error found.
22
- // Since the rule is the same for all components, checking the first one confirms the message is correct.
23
- expect(result[0].messages[0]).toMatchObject({
24
- ruleId: '@adyen/bento/deprecation-bento-timeline-item-variant-prop',
25
- severity: 1,
26
-
27
- messageId: 'deprecation',
28
- message: `The "variant" prop is deprecated. Please use "status" instead.`,
29
-
30
- fix: expect.objectContaining({
31
- text: expect.stringContaining('status='),
32
- }),
33
- });
34
- });
35
- });
@@ -1,141 +0,0 @@
1
- import { RuleTester } from 'eslint';
2
- import vueParser from 'vue-eslint-parser';
3
- import tsParser from '@typescript-eslint/parser';
4
- import deprecationBentoTimelineItemVariantProp from './deprecation-bento-timeline-item-variant-prop';
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-bento-timeline-item-variant-prop', () => {
18
- ruleTester.run('deprecation-bento-timeline-item-variant-prop', deprecationBentoTimelineItemVariantProp, {
19
- valid: [
20
- {
21
- name: 'Valid usage with status prop',
22
- filename: 'test.vue',
23
- code: `
24
- <template>
25
- <bento-timeline-item status="green" />
26
- </template>
27
- `,
28
- },
29
- ],
30
- invalid: [
31
- // No autofix when disabled
32
- {
33
- name: 'Invalid: autofix disabled (explicit false)',
34
- filename: 'test.vue',
35
- code: `<template><bento-timeline-item variant="CheckedCircleIcon" /></template>`,
36
- output: null,
37
- options: [{ autofix: false }],
38
- errors: [{ messageId: 'deprecation' }],
39
- },
40
- {
41
- name: 'Invalid: autofix disabled (no options)',
42
- filename: 'test.vue',
43
- code: `<template><bento-timeline-item :variant="BentoTimelineItemVariant.SUCCESS" /></template>`,
44
- output: null,
45
- errors: [{ messageId: 'deprecation' }],
46
- },
47
-
48
- // Static values — remaps enum value strings to colors
49
- {
50
- name: 'Invalid: Static variant="SquareSmallIcon" → status="black"',
51
- filename: 'test.vue',
52
- code: `<template><bento-timeline-item variant="SquareSmallIcon" /></template>`,
53
- output: `<template><bento-timeline-item status="black" /></template>`,
54
- options: [{ autofix: true }],
55
- errors: [{ messageId: 'deprecation' }],
56
- },
57
- {
58
- name: 'Invalid: Static variant="CheckedCircleIcon" → status="green"',
59
- filename: 'test.vue',
60
- code: `<template><bento-timeline-item variant="CheckedCircleIcon" /></template>`,
61
- output: `<template><bento-timeline-item status="green" /></template>`,
62
- options: [{ autofix: true }],
63
- errors: [{ messageId: 'deprecation' }],
64
- },
65
- {
66
- name: 'Invalid: Static variant="CrossCircleIcon" → status="red"',
67
- filename: 'test.vue',
68
- code: `<template><bento-timeline-item variant="CrossCircleIcon" /></template>`,
69
- output: `<template><bento-timeline-item status="red" /></template>`,
70
- options: [{ autofix: true }],
71
- errors: [{ messageId: 'deprecation' }],
72
- },
73
-
74
- // Static with unknown value — no fix applied
75
- {
76
- name: 'Invalid: Static variant with unknown value does not autofix',
77
- filename: 'test.vue',
78
- code: `<template><bento-timeline-item variant="unknownValue" /></template>`,
79
- output: null,
80
- options: [{ autofix: true }],
81
- errors: [{ messageId: 'deprecation' }],
82
- },
83
-
84
- // Dynamic with enum member expression — remaps enum key to color
85
- {
86
- name: 'Invalid: Dynamic :variant="BentoTimelineItemVariant.DEFAULT" → status="black"',
87
- filename: 'test.vue',
88
- code: `<template><bento-timeline-item :variant="BentoTimelineItemVariant.DEFAULT" /></template>`,
89
- output: `<template><bento-timeline-item status="black" /></template>`,
90
- options: [{ autofix: true }],
91
- errors: [{ messageId: 'deprecation' }],
92
- },
93
- {
94
- name: 'Invalid: Dynamic :variant="BentoTimelineItemVariant.SUCCESS" → status="green"',
95
- filename: 'test.vue',
96
- code: `<template><bento-timeline-item :variant="BentoTimelineItemVariant.SUCCESS" /></template>`,
97
- output: `<template><bento-timeline-item status="green" /></template>`,
98
- options: [{ autofix: true }],
99
- errors: [{ messageId: 'deprecation' }],
100
- },
101
- {
102
- name: 'Invalid: Dynamic :variant="BentoTimelineItemVariant.CRITICAL" → status="red"',
103
- filename: 'test.vue',
104
- code: `<template><bento-timeline-item :variant="BentoTimelineItemVariant.CRITICAL" /></template>`,
105
- output: `<template><bento-timeline-item status="red" /></template>`,
106
- options: [{ autofix: true }],
107
- errors: [{ messageId: 'deprecation' }],
108
- },
109
-
110
- // Dynamic with string literal — remaps value to color
111
- {
112
- name: 'Invalid: Dynamic :variant="\'CheckedCircleIcon\'" → status="green"',
113
- filename: 'test.vue',
114
- code: `<template><bento-timeline-item :variant="'CheckedCircleIcon'" /></template>`,
115
- output: `<template><bento-timeline-item status="green" /></template>`,
116
- options: [{ autofix: true }],
117
- errors: [{ messageId: 'deprecation' }],
118
- },
119
-
120
- // Dynamic with unknown expression — no fix applied
121
- {
122
- name: 'Invalid: Dynamic :variant with unknown expression does not autofix',
123
- filename: 'test.vue',
124
- code: `<template><bento-timeline-item :variant="computedVariant" /></template>`,
125
- output: null,
126
- options: [{ autofix: true }],
127
- errors: [{ messageId: 'deprecation' }],
128
- },
129
-
130
- // Dynamic with non-BentoTimelineItemVariant enum — no fix applied
131
- {
132
- name: 'Invalid: Dynamic :variant with unrelated enum does not autofix',
133
- filename: 'test.vue',
134
- code: `<template><bento-timeline-item :variant="customStatus.SUCCESS" /></template>`,
135
- output: null,
136
- options: [{ autofix: true }],
137
- errors: [{ messageId: 'deprecation' }],
138
- },
139
- ],
140
- });
141
- });
@@ -1,25 +0,0 @@
1
- <template>
2
- <div>
3
- <bento-dropdown ariaLabel="value" />
4
- <bento-dropdown :ariaLabel="value" />
5
- <bento-dropdown v-bind:ariaLabel="value" />
6
-
7
- <bento-input-field ariaLabel="value" />
8
- <bento-input-field :ariaLabel="value" />
9
- <bento-input-field v-bind:ariaLabel="value" />
10
-
11
- <bento-pagination ariaLabel="value" />
12
- <bento-pagination :ariaLabel="value" />
13
- <bento-pagination v-bind:ariaLabel="value" />
14
-
15
- <bento-popover ariaLabel="value" />
16
- <bento-popover :ariaLabel="value" />
17
- <bento-popover v-bind:ariaLabel="value" />
18
-
19
- <bento-segmented-control ariaLabel="value" />
20
- <bento-segmented-control :ariaLabel="value" />
21
- <bento-segmented-control v-bind:ariaLabel="value" />
22
- </div>
23
- </template>
24
-
25
- <script setup></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-components-aria-label-prop': 'warn',
23
- },
24
- files: ['**/*.vue'],
25
- },
26
- ]);
@@ -1,36 +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-components-aria-label-prop', () => {
5
- it('should lint with warning', () => {
6
- // Load .eslintrc
7
- const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
8
- // Load the test file generated alongside this one
9
- const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-components-aria-label-prop.vue');
10
-
11
- // Execute the linter
12
- const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
13
-
14
- /* ------------------------------------------------ */
15
- /* CASE 2: SINGLE REPLACEMENT */
16
- /* ------------------------------------------------ */
17
-
18
- // For props, we generate 3 examples (static, shorthand, longhand) FOR EACH component.
19
- // Total = (Number of Components) * 3
20
- const numberOfComponents = 5;
21
- expect(result[0].warningCount).toBe(numberOfComponents * 3);
22
-
23
- // Verify the message structure on the first error found.
24
- // Since the rule is the same for all components, checking the first one confirms the message is correct.
25
- expect(result[0].messages[0]).toMatchObject({
26
- ruleId: '@adyen/bento/deprecation-components-aria-label-prop',
27
- severity: 1,
28
-
29
- messageId: 'deprecation',
30
- message: `The "ariaLabel" prop is deprecated. Please use "aria-label" instead.`,
31
- });
32
-
33
- // Without autofix option, no fix should be present
34
- expect(result[0].messages[0].fix).toBeUndefined();
35
- });
36
- });