@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +48 -15
  3. package/configs/tailwind.js +17 -0
  4. package/configs/vue-recommended.js +3 -0
  5. package/configs/vue-strict.js +3 -0
  6. package/index.js +5 -0
  7. package/package.json +1 -1
  8. package/rules/deprecation-bento-dropdown-size-prop/README.md +25 -0
  9. package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +9 -0
  10. package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +26 -0
  11. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +33 -0
  12. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.js +78 -0
  13. package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +101 -0
  14. package/rules/deprecation-components-error-prop/README.md +43 -0
  15. package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +17 -0
  16. package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +26 -0
  17. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +37 -0
  18. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.js +79 -0
  19. package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +120 -0
  20. package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +1 -1
  21. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.js +19 -4
  22. package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +40 -0
  23. package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +1 -1
  24. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.js +24 -7
  25. package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +56 -0
  26. package/rules/deprecation-filter-bar-deprecated-props/README.md +64 -0
  27. package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +48 -0
  28. package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +25 -0
  29. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +22 -0
  30. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +187 -0
  31. package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +421 -0
  32. package/rules/tailwind-v3-to-bento/README.md +114 -0
  33. package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +24 -0
  34. package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +15 -0
  35. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +29 -0
  36. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.js +377 -0
  37. package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +403 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.9.0 (2026-04-22)
4
+
5
+ ### Features
6
+
7
+ - added deprecation rule for `bento-filter-bar` props ([7044b0346](https://github.com/Adyen/bento/commit/7044b0346))
8
+ - added deprecation rule for `size` for `bento-dropdown` ([11effcdff](https://github.com/Adyen/bento/commit/11effcdff))
9
+ - added deprecation rule for `error` property ([97327a416](https://github.com/Adyen/bento/commit/97327a416))
10
+ - added `autofix` option to ESLint deprecation rules and generator ([70f4b9890](https://github.com/Adyen/bento/commit/70f4b9890))
11
+
12
+ ### ❤️ Thank You
13
+
14
+ - daver
15
+ - gerald
16
+
17
+
18
+ ## 2.8.0 (2026-04-15)
19
+
20
+ ### Features
21
+
22
+ - added `tailwind-v3-to-bento` ESlint rule to help with the migration to Bento's Tailwind plugin ([d941b691a](https://github.com/Adyen/bento/commit/d941b691a))
23
+
24
+ ### ❤️ Thank You
25
+
26
+ - daver
27
+
28
+
3
29
  ## 2.7.7 (2026-04-08)
4
30
 
5
31
  This was a version bump only for eslint to align it with other projects, there were no code changes.
package/README.md CHANGED
@@ -51,6 +51,22 @@ module.exports = defineConfig([
51
51
  ]);
52
52
  ```
53
53
 
54
+ ### Flat config tailwind
55
+
56
+ For projects migrating from Tailwind CSS v3 to Bento design tokens:
57
+
58
+ ```javascript
59
+ const { defineConfig } = require('eslint/config');
60
+ const bento = require('@adyen/eslint-plugin-bento');
61
+
62
+ module.exports = defineConfig([
63
+ {
64
+ // Other configs
65
+ },
66
+ ...bento.configs['tailwind'],
67
+ ]);
68
+ ```
69
+
54
70
  ### Custom
55
71
 
56
72
  Without the recommended configs:
@@ -70,8 +86,9 @@ module.exports = defineConfig([
70
86
  },
71
87
  rules: {
72
88
  '@adyen/bento/vue-old-spacer-tokens': 'warn',
73
- '@adyen/bento/deprecation-currency-default-slot': 'warn'
74
- '@adyen/bento/deprecation-tag-default-slot': 'warn'
89
+ '@adyen/bento/deprecation-currency-default-slot': 'warn',
90
+ '@adyen/bento/deprecation-tag-default-slot': 'warn',
91
+ '@adyen/bento/tailwind-v3-to-bento': 'warn',
75
92
  },
76
93
  files: ['**/*.vue'],
77
94
  },
@@ -84,28 +101,44 @@ module.exports = defineConfig([
84
101
 
85
102
  Disallow the use of ADL space utility classes in favor of Bento _spacer_ utility classes.
86
103
 
87
- ### Recommended
104
+ ### `@adyen/bento/deprecation-currency-default-slot`
88
105
 
89
- The recommended configuration contains pre-configured rules and their severity
106
+ Disallow the use of the `default` slot in `bento-currency` instances.
90
107
 
91
- - `@adyen/bento/vue-old-spacer-tokens`: `warn`
108
+ ### `@adyen/bento/deprecation-tag-default-slot`
92
109
 
93
- ### `@adyen/bento/deprecation-currency-default-slot`
110
+ Disallow the use of the `default` slot in `bento-tag` instances.
94
111
 
95
- Disallow the use of the `default` slot in `bento-currency` instances
112
+ ### `@adyen/bento/tailwind-v3-to-bento`
96
113
 
97
- ### Recommended
114
+ Replace Tailwind CSS v3 utility classes with Bento design token equivalents. Covers spacing, border radius, border
115
+ width, box shadows, breakpoints, and colors (auto-fixable via `eslint --fix`). Typography classes are flagged with a
116
+ warning — use the `bento-typography` component instead.
98
117
 
99
- The recommended configuration contains pre-configured rules and their severity
118
+ ## Configurations
100
119
 
101
- - `@adyen/bento/deprecation-currency-default-slot`: `warn`
120
+ ### Recommended (`vue-recommended`)
102
121
 
103
- ### `@adyen/bento/deprecation-tag-default-slot`
122
+ | Rule | Severity |
123
+ | ------------------------------------------------ | -------- |
124
+ | `@adyen/bento/deprecation-components-input-emit` | `warn` |
125
+ | `@adyen/bento/deprecation-components-value-prop` | `warn` |
126
+ | `@adyen/bento/deprecation-currency-default-slot` | `warn` |
127
+ | `@adyen/bento/deprecation-tag-default-slot` | `warn` |
128
+ | `@adyen/bento/vue-old-spacer-tokens` | `warn` |
104
129
 
105
- Disallow the use of the `default` slot in `bento-tag` instances
130
+ ### Strict (`vue-strict`)
106
131
 
107
- ### Recommended
132
+ | Rule | Severity |
133
+ | ------------------------------------------------ | -------- |
134
+ | `@adyen/bento/deprecation-components-input-emit` | `error` |
135
+ | `@adyen/bento/deprecation-components-value-prop` | `error` |
136
+ | `@adyen/bento/deprecation-currency-default-slot` | `error` |
137
+ | `@adyen/bento/deprecation-tag-default-slot` | `error` |
138
+ | `@adyen/bento/vue-old-spacer-tokens` | `error` |
108
139
 
109
- The recommended configuration contains pre-configured rules and their severity
140
+ ### Tailwind (`tailwind`)
110
141
 
111
- - `@adyen/bento/deprecation-tag-default-slot`: `warn`
142
+ | Rule | Severity |
143
+ | ----------------------------------- | -------- |
144
+ | `@adyen/bento/tailwind-v3-to-bento` | `warn` |
@@ -0,0 +1,17 @@
1
+ module.exports = [
2
+ {
3
+ name: '@bento/adyen/tailwind',
4
+ files: ['*.vue', '**/*.vue'],
5
+ languageOptions: {
6
+ parser: require('vue-eslint-parser'),
7
+ },
8
+ plugins: {
9
+ get '@adyen/bento'() {
10
+ return require('../index');
11
+ },
12
+ },
13
+ rules: {
14
+ '@adyen/bento/tailwind-v3-to-bento': 'warn',
15
+ },
16
+ },
17
+ ];
@@ -11,6 +11,9 @@ module.exports = [
11
11
  },
12
12
  },
13
13
  rules: {
14
+ '@adyen/bento/deprecation-bento-dropdown-size-prop': 'warn',
15
+ '@adyen/bento/deprecation-components-error-prop': 'warn',
16
+ '@adyen/bento/deprecation-filter-bar-deprecated-props': 'warn',
14
17
  '@adyen/bento/deprecation-components-input-emit': 'warn',
15
18
  '@adyen/bento/deprecation-components-value-prop': 'warn',
16
19
  '@adyen/bento/deprecation-currency-default-slot': 'warn',
@@ -11,6 +11,9 @@ module.exports = [
11
11
  },
12
12
  },
13
13
  rules: {
14
+ '@adyen/bento/deprecation-bento-dropdown-size-prop': 'error',
15
+ '@adyen/bento/deprecation-components-error-prop': 'error',
16
+ '@adyen/bento/deprecation-filter-bar-deprecated-props': 'error',
14
17
  '@adyen/bento/deprecation-components-input-emit': 'error',
15
18
  '@adyen/bento/deprecation-components-value-prop': 'error',
16
19
  '@adyen/bento/deprecation-currency-default-slot': 'error',
package/index.js CHANGED
@@ -9,13 +9,18 @@ const plugin = {
9
9
  configs: {
10
10
  'vue-recommended': require('./configs/vue-recommended'),
11
11
  'vue-strict': require('./configs/vue-strict'),
12
+ tailwind: require('./configs/tailwind'),
12
13
  },
13
14
  rules: {
15
+ 'deprecation-bento-dropdown-size-prop': require('./rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop'),
16
+ 'deprecation-components-error-prop': require('./rules/deprecation-components-error-prop/deprecation-components-error-prop'),
17
+ 'deprecation-filter-bar-deprecated-props': require('./rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props'),
14
18
  'deprecation-components-input-emit': require('./rules/deprecation-components-input-emit/deprecation-components-input-emit'),
15
19
  'deprecation-components-value-prop': require('./rules/deprecation-components-value-prop/deprecation-components-value-prop'),
16
20
  'deprecation-currency-default-slot': require('./rules/deprecation-currency-default-slot/deprecation-currency-default-slot'),
17
21
  'deprecation-tag-default-slot': require('./rules/deprecation-tag-default-slot/deprecation-tag-default-slot'),
18
22
  'vue-old-spacer-tokens': require('./rules/vue-old-spacer-tokens/vue-old-spacer-tokens'),
23
+ 'tailwind-v3-to-bento': require('./rules/tailwind-v3-to-bento/tailwind-v3-to-bento'),
19
24
  },
20
25
  };
21
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/eslint-plugin-bento",
3
- "version": "2.7.7",
3
+ "version": "2.9.0",
4
4
  "description": "Adyen Bento ESLint rules",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,25 @@
1
+ # deprecation-bento-dropdown-size-prop
2
+
3
+ ## Description
4
+
5
+ The `size` prop in the following components is deprecated:
6
+
7
+ - `bento-dropdown`
8
+
9
+ Only the `default` size is supported. Remove the `size` prop entirely.
10
+
11
+ ## Rule Details
12
+
13
+ This rule reports usages of the deprecated `size` prop.
14
+
15
+ ### ❌ Incorrect
16
+
17
+ ```html
18
+ <bento-dropdown size="small" /> <bento-dropdown :size="BentoDropdownSize.SMALL" />
19
+ ```
20
+
21
+ ### ✅ Correct
22
+
23
+ ```html
24
+ <bento-dropdown />
25
+ ```
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div>
3
+ <bento-dropdown size="value" />
4
+ <bento-dropdown :size="value" />
5
+ <bento-dropdown :size="value" />
6
+ </div>
7
+ </template>
8
+
9
+ <script setup></script>
@@ -0,0 +1,26 @@
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-dropdown-size-prop': ['warn', { autofix: true }],
23
+ },
24
+ files: ['**/*.vue'],
25
+ },
26
+ ]);
@@ -0,0 +1,33 @@
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
+ });
@@ -0,0 +1,78 @@
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
+ /** @type {RuleModule} */
11
+ module.exports = {
12
+ meta: {
13
+ type: 'suggestion',
14
+ docs: {
15
+ description: 'Deprecates usage of size prop in bento-dropdown',
16
+ category: 'Deprecations',
17
+ url: 'https://github.com/Adyen/bento/blob/main/packages/eslint/rules/deprecation-bento-dropdown-size-prop/README.md',
18
+ recommended: true,
19
+ },
20
+ messages: {
21
+ deprecation: `The "size" prop is deprecated.`,
22
+ },
23
+ fixable: 'code',
24
+ schema: [
25
+ {
26
+ type: 'object',
27
+ properties: {
28
+ autofix: {
29
+ type: 'boolean',
30
+ default: false,
31
+ },
32
+ },
33
+ additionalProperties: false,
34
+ },
35
+ ],
36
+ },
37
+
38
+ /** @param {RuleContext} context */
39
+ create(context) {
40
+ const options = context.options[0] || {};
41
+ const autofix = options.autofix === true;
42
+
43
+ /* ------------------------------------------------ */
44
+ /* CASE 2: PROP DEPRECATION (Multiple Components) */
45
+ /* ------------------------------------------------ */
46
+ return VueUtils.defineTemplateBodyVisitor(context, {
47
+ // 1. STATIC: size="foo"
48
+ [`VElement:matches([name="bento-dropdown"], [name="BentoDropdown"]) > VStartTag > VAttribute[directive=false][key.name="size"]`](
49
+ node
50
+ ) {
51
+ context.report({
52
+ node,
53
+ messageId: 'deprecation',
54
+ ...(autofix && {
55
+ fix(fixer) {
56
+ return fixer.remove(node);
57
+ },
58
+ }),
59
+ });
60
+ },
61
+
62
+ // 2. DYNAMIC: :size="foo" or v-bind:size="foo"
63
+ [`VElement:matches([name="bento-dropdown"], [name="BentoDropdown"]) > VStartTag > VAttribute[directive=true][key.name.name="bind"][key.argument.name="size"]`](
64
+ node
65
+ ) {
66
+ context.report({
67
+ node,
68
+ messageId: 'deprecation',
69
+ ...(autofix && {
70
+ fix(fixer) {
71
+ return fixer.remove(node);
72
+ },
73
+ }),
74
+ });
75
+ },
76
+ });
77
+ },
78
+ };
@@ -0,0 +1,101 @@
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
+ });
@@ -0,0 +1,43 @@
1
+ # deprecation-components-error-prop
2
+
3
+ ## Description
4
+
5
+ The `error` prop in the following components is deprecated:
6
+
7
+ - `bento-dropdown`
8
+ - `bento-input-field`
9
+ - `bento-input-field-phone-number`
10
+
11
+ Please use `error-message` instead.
12
+
13
+ ## Rule Details
14
+
15
+ This rule reports usages of the deprecated item.
16
+
17
+ ### ❌ Incorrect
18
+
19
+ ```html
20
+ <bento-dropdown error="value" /> <bento-dropdown :error="value" />
21
+ ```
22
+
23
+ ```html
24
+ <bento-input-field error="value" /> <bento-input-field :error="value" />
25
+ ```
26
+
27
+ ```html
28
+ <bento-input-field-phone-number error="value" /> <bento-input-field-phone-number :error="value" />
29
+ ```
30
+
31
+ ### ✅ Correct
32
+
33
+ ```html
34
+ <bento-dropdown error-message="value" />
35
+ ```
36
+
37
+ ```html
38
+ <bento-input-field error-message="value" />
39
+ ```
40
+
41
+ ```html
42
+ <bento-input-field-phone-number error-message="value" />
43
+ ```
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div>
3
+ <bento-dropdown error="value" />
4
+ <bento-dropdown :error="value" />
5
+ <bento-dropdown :error="value" />
6
+
7
+ <bento-input-field error="value" />
8
+ <bento-input-field :error="value" />
9
+ <bento-input-field :error="value" />
10
+
11
+ <bento-input-field-phone-number error="value" />
12
+ <bento-input-field-phone-number :error="value" />
13
+ <bento-input-field-phone-number :error="value" />
14
+ </div>
15
+ </template>
16
+
17
+ <script setup></script>
@@ -0,0 +1,26 @@
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-error-prop': ['warn', { autofix: true }],
23
+ },
24
+ files: ['**/*.vue'],
25
+ },
26
+ ]);
@@ -0,0 +1,37 @@
1
+ import path from 'node:path';
2
+ import { execFileSyncEslintVueFiles } from '../../utils/exec-file-sync-eslint-vue-files';
3
+
4
+ describe('@adyen/bento/deprecation-components-error-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-error-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 = 3;
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-error-prop',
27
+ severity: 1,
28
+
29
+ messageId: 'deprecation',
30
+ message: `The "error" prop is deprecated. Please use "error-message" instead.`,
31
+
32
+ fix: expect.objectContaining({
33
+ text: expect.stringContaining('error-message'),
34
+ }),
35
+ });
36
+ });
37
+ });