@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.
- package/CHANGELOG.md +23 -0
- package/README.md +31 -15
- package/configs/vue-recommended.js +15 -0
- package/configs/vue-strict.js +15 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/rules/deprecation-bento-tag-variant-enum/README.md +69 -0
- package/rules/deprecation-bento-tag-variant-enum/deprecation-bento-tag-variant-enum.js +167 -0
- package/rules/vue-no-redundant-dialog-v-if/README.md +55 -0
- package/rules/vue-no-redundant-dialog-v-if/vue-no-redundant-dialog-v-if.js +150 -0
- package/rules/vue-no-use-bento-translation-overrides/README.md +14 -0
- package/rules/vue-no-use-bento-translation-overrides/vue-no-use-bento-translation-overrides.js +93 -0
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/deprecation-bento-data-grid-cell-action-menu-item-handler.vue +0 -63
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/__tests__/eslint.config.js +0 -26
- 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
- package/rules/deprecation-bento-data-grid-cell-action-menu-item-handler/deprecation-bento-data-grid-cell-action-menu-item-handler.test.ts +0 -116
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -10
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/eslint.config.js +0 -29
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/deprecation-bento-date-range-picker-has-actions-prop.vue +0 -11
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/__tests__/remove/eslint.config.js +0 -29
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.integration.test.ts +0 -47
- package/rules/deprecation-bento-date-range-picker-has-actions-prop/deprecation-bento-date-range-picker-has-actions-prop.test.ts +0 -176
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/deprecation-bento-dropdown-size-prop.vue +0 -9
- package/rules/deprecation-bento-dropdown-size-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.integration.test.ts +0 -33
- package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts +0 -101
- package/rules/deprecation-bento-popover-modifiers-prop/__tests__/deprecation-bento-popover-modifiers-prop.vue +0 -9
- package/rules/deprecation-bento-popover-modifiers-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.integration.test.ts +0 -24
- package/rules/deprecation-bento-popover-modifiers-prop/deprecation-bento-popover-modifiers-prop.test.ts +0 -109
- package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/deprecation-bento-timeline-item-variant-prop.vue +0 -9
- package/rules/deprecation-bento-timeline-item-variant-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.integration.test.ts +0 -35
- package/rules/deprecation-bento-timeline-item-variant-prop/deprecation-bento-timeline-item-variant-prop.test.ts +0 -141
- package/rules/deprecation-components-aria-label-prop/__tests__/deprecation-components-aria-label-prop.vue +0 -25
- package/rules/deprecation-components-aria-label-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.integration.test.ts +0 -36
- package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.test.ts +0 -194
- package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue +0 -17
- package/rules/deprecation-components-error-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.integration.test.ts +0 -41
- package/rules/deprecation-components-error-prop/deprecation-components-error-prop.test.ts +0 -153
- package/rules/deprecation-components-has-error-prop/__tests__/deprecation-components-has-error-prop.vue +0 -13
- package/rules/deprecation-components-has-error-prop/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.integration.test.ts +0 -37
- package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.test.ts +0 -122
- package/rules/deprecation-components-input-emit/__tests__/deprecation-components-input-emit.vue +0 -22
- package/rules/deprecation-components-input-emit/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.integration.test.ts +0 -43
- package/rules/deprecation-components-input-emit/deprecation-components-input-emit.test.ts +0 -320
- package/rules/deprecation-components-value-prop/__tests__/deprecation-components-value-prop.vue +0 -69
- package/rules/deprecation-components-value-prop/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.integration.test.ts +0 -37
- package/rules/deprecation-components-value-prop/deprecation-components-value-prop.test.ts +0 -480
- package/rules/deprecation-country-custom-usage/__tests__/deprecation-country-custom-usage.vue +0 -93
- package/rules/deprecation-country-custom-usage/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.integration.test.ts +0 -22
- package/rules/deprecation-country-custom-usage/deprecation-country-custom-usage.test.ts +0 -380
- package/rules/deprecation-currency-default-slot/__tests__/deprecation-currency-default-slot.vue +0 -7
- package/rules/deprecation-currency-default-slot/__tests__/eslint.config.js +0 -24
- package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.integration.test.ts +0 -29
- package/rules/deprecation-currency-default-slot/deprecation-currency-default-slot.test.ts +0 -136
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/deprecation-filter-bar-deprecated-props.vue +0 -62
- package/rules/deprecation-filter-bar-deprecated-props/__tests__/eslint.config.js +0 -25
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.integration.test.ts +0 -22
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.test.ts +0 -492
- package/rules/deprecation-input-filter-dropdown-options/__tests__/deprecation-input-filter-dropdown-options.vue +0 -46
- package/rules/deprecation-input-filter-dropdown-options/__tests__/eslint.config.js +0 -26
- package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.integration.test.ts +0 -27
- package/rules/deprecation-input-filter-dropdown-options/deprecation-input-filter-dropdown-options.test.ts +0 -392
- package/rules/deprecation-tag-default-slot/__tests__/deprecation-tag-default-slot.vue +0 -5
- package/rules/deprecation-tag-default-slot/__tests__/eslint.config.js +0 -24
- package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.integration.test.ts +0 -29
- package/rules/deprecation-tag-default-slot/deprecation-tag-default-slot.test.ts +0 -163
- package/rules/tailwind-v3-to-bento/__tests__/eslint.config.js +0 -24
- package/rules/tailwind-v3-to-bento/__tests__/tailwind-v3-to-bento.vue +0 -15
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.integration.test.ts +0 -29
- package/rules/tailwind-v3-to-bento/tailwind-v3-to-bento.test.ts +0 -403
- package/rules/vue-old-spacer-tokens/__tests__/eslint.config.js +0 -24
- package/rules/vue-old-spacer-tokens/__tests__/vue-old-spacer-tokens.vue +0 -5
- package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.integration.test.ts +0 -29
- package/rules/vue-old-spacer-tokens/vue-old-spacer-tokens.test.ts +0 -77
package/rules/deprecation-components-aria-label-prop/deprecation-components-aria-label-prop.test.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationComponentsAriaLabelProp from './deprecation-components-aria-label-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-components-aria-label-prop', () => {
|
|
18
|
-
ruleTester.run('deprecation-components-aria-label-prop', deprecationComponentsAriaLabelProp, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid usage for bento-dropdown',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-dropdown aria-label="val" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid usage for bento-input-field',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-input-field aria-label="val" />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Valid usage for bento-pagination',
|
|
40
|
-
filename: 'test.vue',
|
|
41
|
-
code: `
|
|
42
|
-
<template>
|
|
43
|
-
<bento-pagination aria-label="val" />
|
|
44
|
-
</template>
|
|
45
|
-
`,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'Valid usage for bento-popover',
|
|
49
|
-
filename: 'test.vue',
|
|
50
|
-
code: `
|
|
51
|
-
<template>
|
|
52
|
-
<bento-popover aria-label="val" />
|
|
53
|
-
</template>
|
|
54
|
-
`,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'Valid usage for bento-segmented-control',
|
|
58
|
-
filename: 'test.vue',
|
|
59
|
-
code: `
|
|
60
|
-
<template>
|
|
61
|
-
<bento-segmented-control aria-label="val" />
|
|
62
|
-
</template>
|
|
63
|
-
`,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
invalid: [
|
|
67
|
-
// bento-dropdown: Static
|
|
68
|
-
{
|
|
69
|
-
name: 'Invalid: Static prop on bento-dropdown',
|
|
70
|
-
filename: 'test.vue',
|
|
71
|
-
code: `<template><bento-dropdown ariaLabel="val" /></template>`,
|
|
72
|
-
errors: [{ messageId: 'deprecation' }],
|
|
73
|
-
},
|
|
74
|
-
// bento-dropdown: Shorthand
|
|
75
|
-
{
|
|
76
|
-
name: 'Invalid: Dynamic prop on bento-dropdown',
|
|
77
|
-
filename: 'test.vue',
|
|
78
|
-
code: `<template><bento-dropdown :ariaLabel="val" /></template>`,
|
|
79
|
-
errors: [{ messageId: 'deprecation' }],
|
|
80
|
-
},
|
|
81
|
-
// bento-input-field: Static
|
|
82
|
-
{
|
|
83
|
-
name: 'Invalid: Static prop on bento-input-field',
|
|
84
|
-
filename: 'test.vue',
|
|
85
|
-
code: `<template><bento-input-field ariaLabel="val" /></template>`,
|
|
86
|
-
errors: [{ messageId: 'deprecation' }],
|
|
87
|
-
},
|
|
88
|
-
// bento-input-field: Shorthand
|
|
89
|
-
{
|
|
90
|
-
name: 'Invalid: Dynamic prop on bento-input-field',
|
|
91
|
-
filename: 'test.vue',
|
|
92
|
-
code: `<template><bento-input-field :ariaLabel="val" /></template>`,
|
|
93
|
-
errors: [{ messageId: 'deprecation' }],
|
|
94
|
-
},
|
|
95
|
-
// bento-pagination: Static
|
|
96
|
-
{
|
|
97
|
-
name: 'Invalid: Static prop on bento-pagination',
|
|
98
|
-
filename: 'test.vue',
|
|
99
|
-
code: `<template><bento-pagination ariaLabel="val" /></template>`,
|
|
100
|
-
errors: [{ messageId: 'deprecation' }],
|
|
101
|
-
},
|
|
102
|
-
// bento-pagination: Shorthand
|
|
103
|
-
{
|
|
104
|
-
name: 'Invalid: Dynamic prop on bento-pagination',
|
|
105
|
-
filename: 'test.vue',
|
|
106
|
-
code: `<template><bento-pagination :ariaLabel="val" /></template>`,
|
|
107
|
-
errors: [{ messageId: 'deprecation' }],
|
|
108
|
-
},
|
|
109
|
-
// bento-popover: Static
|
|
110
|
-
{
|
|
111
|
-
name: 'Invalid: Static prop on bento-popover',
|
|
112
|
-
filename: 'test.vue',
|
|
113
|
-
code: `<template><bento-popover ariaLabel="val" /></template>`,
|
|
114
|
-
errors: [{ messageId: 'deprecation' }],
|
|
115
|
-
},
|
|
116
|
-
// bento-popover: Shorthand
|
|
117
|
-
{
|
|
118
|
-
name: 'Invalid: Dynamic prop on bento-popover',
|
|
119
|
-
filename: 'test.vue',
|
|
120
|
-
code: `<template><bento-popover :ariaLabel="val" /></template>`,
|
|
121
|
-
errors: [{ messageId: 'deprecation' }],
|
|
122
|
-
},
|
|
123
|
-
// bento-segmented-control: Static
|
|
124
|
-
{
|
|
125
|
-
name: 'Invalid: Static prop on bento-segmented-control',
|
|
126
|
-
filename: 'test.vue',
|
|
127
|
-
code: `<template><bento-segmented-control ariaLabel="val" /></template>`,
|
|
128
|
-
errors: [{ messageId: 'deprecation' }],
|
|
129
|
-
},
|
|
130
|
-
// bento-segmented-control: Shorthand
|
|
131
|
-
{
|
|
132
|
-
name: 'Invalid: Dynamic prop on bento-segmented-control',
|
|
133
|
-
filename: 'test.vue',
|
|
134
|
-
code: `<template><bento-segmented-control :ariaLabel="val" /></template>`,
|
|
135
|
-
errors: [{ messageId: 'deprecation' }],
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
/* ------------------------------------------------ */
|
|
141
|
-
/* AUTOFIX TESTS */
|
|
142
|
-
/* ------------------------------------------------ */
|
|
143
|
-
ruleTester.run('deprecation-components-aria-label-prop (autofix enabled)', deprecationComponentsAriaLabelProp, {
|
|
144
|
-
valid: [
|
|
145
|
-
{
|
|
146
|
-
name: 'Valid: aria-label (kebab-case) on bento-dropdown (autofix enabled)',
|
|
147
|
-
filename: 'test.vue',
|
|
148
|
-
options: [{ autofix: true }],
|
|
149
|
-
code: `<template><bento-dropdown aria-label="val" /></template>`,
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
invalid: [
|
|
153
|
-
{
|
|
154
|
-
name: 'Autofix: static prop on bento-dropdown',
|
|
155
|
-
filename: 'test.vue',
|
|
156
|
-
options: [{ autofix: true }],
|
|
157
|
-
code: `<template><bento-dropdown ariaLabel="val" /></template>`,
|
|
158
|
-
output: `<template><bento-dropdown aria-label="val" /></template>`,
|
|
159
|
-
errors: [{ messageId: 'deprecation' }],
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'Autofix: dynamic prop on bento-dropdown',
|
|
163
|
-
filename: 'test.vue',
|
|
164
|
-
options: [{ autofix: true }],
|
|
165
|
-
code: `<template><bento-dropdown :ariaLabel="val" /></template>`,
|
|
166
|
-
output: `<template><bento-dropdown :aria-label="val" /></template>`,
|
|
167
|
-
errors: [{ messageId: 'deprecation' }],
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: 'Autofix: static prop on bento-segmented-control',
|
|
171
|
-
filename: 'test.vue',
|
|
172
|
-
options: [{ autofix: true }],
|
|
173
|
-
code: `<template><bento-segmented-control ariaLabel="val" /></template>`,
|
|
174
|
-
output: `<template><bento-segmented-control aria-label="val" /></template>`,
|
|
175
|
-
errors: [{ messageId: 'deprecation' }],
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: 'Autofix: v-bind longhand on bento-popover',
|
|
179
|
-
filename: 'test.vue',
|
|
180
|
-
options: [{ autofix: true }],
|
|
181
|
-
code: `<template><bento-popover v-bind:ariaLabel="val" /></template>`,
|
|
182
|
-
output: `<template><bento-popover v-bind:aria-label="val" /></template>`,
|
|
183
|
-
errors: [{ messageId: 'deprecation' }],
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: 'Autofix: does not fix when autofix is false',
|
|
187
|
-
filename: 'test.vue',
|
|
188
|
-
options: [{ autofix: false }],
|
|
189
|
-
code: `<template><bento-dropdown ariaLabel="val" /></template>`,
|
|
190
|
-
errors: [{ messageId: 'deprecation' }],
|
|
191
|
-
},
|
|
192
|
-
],
|
|
193
|
-
});
|
|
194
|
-
});
|
package/rules/deprecation-components-error-prop/__tests__/deprecation-components-error-prop.vue
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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>
|
|
@@ -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-error-prop': 'warn',
|
|
23
|
-
},
|
|
24
|
-
files: ['**/*.vue'],
|
|
25
|
-
},
|
|
26
|
-
]);
|
|
@@ -1,41 +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-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 — strip any non-JSON preamble (e.g. pnpm warnings)
|
|
12
|
-
const rawOutput = execFileSyncEslintVueFiles(eslintrc, vueFile);
|
|
13
|
-
const jsonStart = rawOutput.indexOf('[{"');
|
|
14
|
-
const result = JSON.parse(jsonStart >= 0 ? rawOutput.slice(jsonStart) : rawOutput);
|
|
15
|
-
|
|
16
|
-
/* ------------------------------------------------ */
|
|
17
|
-
/* CASE 2: SINGLE REPLACEMENT */
|
|
18
|
-
/* ------------------------------------------------ */
|
|
19
|
-
|
|
20
|
-
// For props, we generate 3 examples (static, shorthand, longhand) FOR EACH component.
|
|
21
|
-
// Total = (Number of Components) * 3
|
|
22
|
-
const numberOfComponents = 3;
|
|
23
|
-
expect(result[0].warningCount).toBe(numberOfComponents * 3);
|
|
24
|
-
|
|
25
|
-
// Verify the message structure on the first warning found.
|
|
26
|
-
expect(result[0].messages[0]).toMatchObject({
|
|
27
|
-
ruleId: '@adyen/bento/deprecation-components-error-prop',
|
|
28
|
-
severity: 1,
|
|
29
|
-
messageId: 'deprecation',
|
|
30
|
-
message: `The "error" prop is deprecated. Use "error-message" instead. Note that "error" accepted a boolean, but "error-message" expects a string, so update the value to an error message.`,
|
|
31
|
-
suggestions: expect.arrayContaining([
|
|
32
|
-
expect.objectContaining({
|
|
33
|
-
messageId: 'suggestReplace',
|
|
34
|
-
fix: expect.objectContaining({
|
|
35
|
-
text: expect.stringContaining('error-message'),
|
|
36
|
-
}),
|
|
37
|
-
}),
|
|
38
|
-
]),
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationComponentsErrorProp from './deprecation-components-error-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-components-error-prop', () => {
|
|
18
|
-
ruleTester.run('deprecation-components-error-prop', deprecationComponentsErrorProp, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid usage for bento-dropdown',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-dropdown error-message="val" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid usage for bento-input-field',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-input-field error-message="val" />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Valid usage for bento-input-field-phone-number',
|
|
40
|
-
filename: 'test.vue',
|
|
41
|
-
code: `
|
|
42
|
-
<template>
|
|
43
|
-
<bento-input-field-phone-number error-message="val" />
|
|
44
|
-
</template>
|
|
45
|
-
`,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
invalid: [
|
|
49
|
-
// bento-dropdown: Static
|
|
50
|
-
{
|
|
51
|
-
name: 'Invalid: Static prop on bento-dropdown',
|
|
52
|
-
filename: 'test.vue',
|
|
53
|
-
code: `<template><bento-dropdown error="val" /></template>`,
|
|
54
|
-
errors: [
|
|
55
|
-
{
|
|
56
|
-
messageId: 'deprecation',
|
|
57
|
-
suggestions: [
|
|
58
|
-
{
|
|
59
|
-
messageId: 'suggestReplace',
|
|
60
|
-
output: `<template><bento-dropdown error-message="val" /></template>`,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
// bento-dropdown: Dynamic
|
|
67
|
-
{
|
|
68
|
-
name: 'Invalid: Dynamic prop on bento-dropdown',
|
|
69
|
-
filename: 'test.vue',
|
|
70
|
-
code: `<template><bento-dropdown :error="val" /></template>`,
|
|
71
|
-
errors: [
|
|
72
|
-
{
|
|
73
|
-
messageId: 'deprecation',
|
|
74
|
-
suggestions: [
|
|
75
|
-
{
|
|
76
|
-
messageId: 'suggestReplace',
|
|
77
|
-
output: `<template><bento-dropdown :error-message="val" /></template>`,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
// bento-input-field: Static
|
|
84
|
-
{
|
|
85
|
-
name: 'Invalid: Static prop on bento-input-field',
|
|
86
|
-
filename: 'test.vue',
|
|
87
|
-
code: `<template><bento-input-field error="val" /></template>`,
|
|
88
|
-
errors: [
|
|
89
|
-
{
|
|
90
|
-
messageId: 'deprecation',
|
|
91
|
-
suggestions: [
|
|
92
|
-
{
|
|
93
|
-
messageId: 'suggestReplace',
|
|
94
|
-
output: `<template><bento-input-field error-message="val" /></template>`,
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
// bento-input-field: Dynamic
|
|
101
|
-
{
|
|
102
|
-
name: 'Invalid: Dynamic prop on bento-input-field',
|
|
103
|
-
filename: 'test.vue',
|
|
104
|
-
code: `<template><bento-input-field :error="val" /></template>`,
|
|
105
|
-
errors: [
|
|
106
|
-
{
|
|
107
|
-
messageId: 'deprecation',
|
|
108
|
-
suggestions: [
|
|
109
|
-
{
|
|
110
|
-
messageId: 'suggestReplace',
|
|
111
|
-
output: `<template><bento-input-field :error-message="val" /></template>`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
// bento-input-field-phone-number: Static
|
|
118
|
-
{
|
|
119
|
-
name: 'Invalid: Static prop on bento-input-field-phone-number',
|
|
120
|
-
filename: 'test.vue',
|
|
121
|
-
code: `<template><bento-input-field-phone-number error="val" /></template>`,
|
|
122
|
-
errors: [
|
|
123
|
-
{
|
|
124
|
-
messageId: 'deprecation',
|
|
125
|
-
suggestions: [
|
|
126
|
-
{
|
|
127
|
-
messageId: 'suggestReplace',
|
|
128
|
-
output: `<template><bento-input-field-phone-number error-message="val" /></template>`,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
},
|
|
134
|
-
// bento-input-field-phone-number: Dynamic
|
|
135
|
-
{
|
|
136
|
-
name: 'Invalid: Dynamic prop on bento-input-field-phone-number',
|
|
137
|
-
filename: 'test.vue',
|
|
138
|
-
code: `<template><bento-input-field-phone-number :error="val" /></template>`,
|
|
139
|
-
errors: [
|
|
140
|
-
{
|
|
141
|
-
messageId: 'deprecation',
|
|
142
|
-
suggestions: [
|
|
143
|
-
{
|
|
144
|
-
messageId: 'suggestReplace',
|
|
145
|
-
output: `<template><bento-input-field-phone-number :error-message="val" /></template>`,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
});
|
|
153
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<bento-checkbox-group has-error="value" />
|
|
4
|
-
<bento-checkbox-group :has-error="value" />
|
|
5
|
-
<bento-checkbox-group :has-error="value" />
|
|
6
|
-
|
|
7
|
-
<bento-radio-group has-error="value" />
|
|
8
|
-
<bento-radio-group :has-error="value" />
|
|
9
|
-
<bento-radio-group :has-error="value" />
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<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-has-error-prop': 'warn',
|
|
23
|
-
},
|
|
24
|
-
files: ['**/*.vue'],
|
|
25
|
-
},
|
|
26
|
-
]);
|
|
@@ -1,37 +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-has-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-has-error-prop.vue');
|
|
10
|
-
|
|
11
|
-
// Execute the linter
|
|
12
|
-
const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
|
|
13
|
-
|
|
14
|
-
// 3 examples (static, shorthand, longhand) FOR EACH component.
|
|
15
|
-
// Total = 2 components * 3 = 6
|
|
16
|
-
expect(result[0].warningCount).toBe(6);
|
|
17
|
-
|
|
18
|
-
expect(result[0].messages[0]).toMatchObject({
|
|
19
|
-
ruleId: '@adyen/bento/deprecation-components-has-error-prop',
|
|
20
|
-
severity: 1,
|
|
21
|
-
|
|
22
|
-
messageId: 'deprecation',
|
|
23
|
-
message: `The "has-error" prop is deprecated. Use "error-message" instead. Note that "has-error" accepted a boolean, but "error-message" expects a string, so update the value to an error message.`,
|
|
24
|
-
suggestions: expect.arrayContaining([
|
|
25
|
-
expect.objectContaining({
|
|
26
|
-
messageId: 'suggestReplace',
|
|
27
|
-
fix: expect.objectContaining({
|
|
28
|
-
text: expect.stringContaining('error-message'),
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
]),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// The rule should provide a suggestion, not an autofix, because the replacement changes the expected value type.
|
|
35
|
-
expect(result[0].messages[0].fix).toBeUndefined();
|
|
36
|
-
});
|
|
37
|
-
});
|
package/rules/deprecation-components-has-error-prop/deprecation-components-has-error-prop.test.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationComponentsHasErrorProp from './deprecation-components-has-error-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-components-has-error-prop', () => {
|
|
18
|
-
ruleTester.run('deprecation-components-has-error-prop', deprecationComponentsHasErrorProp, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid usage for bento-checkbox-group',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-checkbox-group errorMessage="val" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid usage for bento-radio-group',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-radio-group errorMessage="val" />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
invalid: [
|
|
40
|
-
{
|
|
41
|
-
name: 'Invalid: Static prop on bento-checkbox-group',
|
|
42
|
-
filename: 'test.vue',
|
|
43
|
-
code: `<template><bento-checkbox-group has-error="val" /></template>`,
|
|
44
|
-
errors: [
|
|
45
|
-
{
|
|
46
|
-
messageId: 'deprecation',
|
|
47
|
-
suggestions: [
|
|
48
|
-
{
|
|
49
|
-
messageId: 'suggestReplace',
|
|
50
|
-
output: `<template><bento-checkbox-group error-message="val" /></template>`,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'Invalid: Dynamic shorthand prop on bento-checkbox-group',
|
|
58
|
-
filename: 'test.vue',
|
|
59
|
-
code: `<template><bento-checkbox-group :has-error="val" /></template>`,
|
|
60
|
-
errors: [
|
|
61
|
-
{
|
|
62
|
-
messageId: 'deprecation',
|
|
63
|
-
suggestions: [
|
|
64
|
-
{
|
|
65
|
-
messageId: 'suggestReplace',
|
|
66
|
-
output: `<template><bento-checkbox-group :error-message="val" /></template>`,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'Invalid: Static prop on bento-radio-group',
|
|
74
|
-
filename: 'test.vue',
|
|
75
|
-
code: `<template><bento-radio-group has-error="val" /></template>`,
|
|
76
|
-
errors: [
|
|
77
|
-
{
|
|
78
|
-
messageId: 'deprecation',
|
|
79
|
-
suggestions: [
|
|
80
|
-
{
|
|
81
|
-
messageId: 'suggestReplace',
|
|
82
|
-
output: `<template><bento-radio-group error-message="val" /></template>`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'Invalid: Dynamic shorthand prop on bento-radio-group',
|
|
90
|
-
filename: 'test.vue',
|
|
91
|
-
code: `<template><bento-radio-group :has-error="val" /></template>`,
|
|
92
|
-
errors: [
|
|
93
|
-
{
|
|
94
|
-
messageId: 'deprecation',
|
|
95
|
-
suggestions: [
|
|
96
|
-
{
|
|
97
|
-
messageId: 'suggestReplace',
|
|
98
|
-
output: `<template><bento-radio-group :error-message="val" /></template>`,
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'Invalid: Dynamic longhand prop on bento-radio-group',
|
|
106
|
-
filename: 'test.vue',
|
|
107
|
-
code: `<template><bento-radio-group v-bind:has-error="val" /></template>`,
|
|
108
|
-
errors: [
|
|
109
|
-
{
|
|
110
|
-
messageId: 'deprecation',
|
|
111
|
-
suggestions: [
|
|
112
|
-
{
|
|
113
|
-
messageId: 'suggestReplace',
|
|
114
|
-
output: `<template><bento-radio-group v-bind:error-message="val" /></template>`,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
});
|
package/rules/deprecation-components-input-emit/__tests__/deprecation-components-input-emit.vue
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<bento-date-picker @input="handler" />
|
|
4
|
-
<bento-date-range-picker @input="handler" />
|
|
5
|
-
<bento-dropdown @input="handler" />
|
|
6
|
-
<bento-dropdown-avatar @input="handler" />
|
|
7
|
-
<bento-dropdown-country @input="handler" />
|
|
8
|
-
<bento-dropdown-currency @input="handler" />
|
|
9
|
-
<bento-dropdown-payment-method @input="handler" />
|
|
10
|
-
<bento-dropdown-tag @input="handler" />
|
|
11
|
-
<bento-file-uploader @input="handler" />
|
|
12
|
-
<bento-input-field @input="handler" />
|
|
13
|
-
<bento-input-field-password @input="handler" />
|
|
14
|
-
<bento-input-field-phone-number @input="handler" />
|
|
15
|
-
<bento-checkbox-group @input="handler" />
|
|
16
|
-
<bento-radio-group @input="handler" />
|
|
17
|
-
<bento-selection-card-group @input="handler" />
|
|
18
|
-
<bento-textarea @input="handler" />
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup></script>
|