@adyen/eslint-plugin-bento 2.22.0 → 2.24.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 +33 -0
- package/README.md +31 -15
- package/configs/vue-recommended.js +16 -0
- package/configs/vue-strict.js +17 -1
- package/index.js +3 -0
- package/package.json +3 -3
- 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/deprecation-filter-bar-deprecated-props/README.md +7 -0
- package/rules/deprecation-filter-bar-deprecated-props/deprecation-filter-bar-deprecated-props.js +14 -3
- 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/utils/component-slot-migration.js +22 -4
- 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 -467
- 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 -145
- 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
|
@@ -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>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('eslint/config');
|
|
2
|
-
const vueParser = require('vue-eslint-parser');
|
|
3
|
-
const tsParser = require('@typescript-eslint/parser');
|
|
4
|
-
const adyenBento = require('@adyen/eslint-plugin-bento');
|
|
5
|
-
|
|
6
|
-
module.exports = defineConfig([
|
|
7
|
-
{
|
|
8
|
-
languageOptions: {
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
sourceType: 'module',
|
|
11
|
-
parser: vueParser,
|
|
12
|
-
parserOptions: {
|
|
13
|
-
parser: tsParser,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
plugins: {
|
|
17
|
-
'@adyen/bento': adyenBento,
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
// Register the specific rule we are testing
|
|
21
|
-
'@adyen/bento/deprecation-components-input-emit': ['warn', { autofix: true }],
|
|
22
|
-
},
|
|
23
|
-
files: ['**/*.vue'],
|
|
24
|
-
},
|
|
25
|
-
]);
|
|
@@ -1,43 +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-input-emit', () => {
|
|
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-input-emit.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 emits/slots, we generate 1 example FOR EACH component.
|
|
19
|
-
expect(result[0].warningCount).toBe(16);
|
|
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-components-input-emit',
|
|
25
|
-
severity: 1,
|
|
26
|
-
|
|
27
|
-
messageId: 'deprecation',
|
|
28
|
-
message: `The \`input\` emit is deprecated. Please use \`update:model-value\` instead.
|
|
29
|
-
|
|
30
|
-
Be wary of undesired side effects and race conditions if \`v-model\` is used in conjunction with \`@input\`.
|
|
31
|
-
|
|
32
|
-
Incorrect:
|
|
33
|
-
<bento-component v-model="text" @input="onInput" />
|
|
34
|
-
|
|
35
|
-
Correct:
|
|
36
|
-
<bento-component :model-value="text" @update:model-value="onInput" />`,
|
|
37
|
-
|
|
38
|
-
fix: expect.objectContaining({
|
|
39
|
-
text: expect.stringContaining('update:model-value'),
|
|
40
|
-
}),
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationComponentsInputEmit from './deprecation-components-input-emit';
|
|
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-input-emit', () => {
|
|
18
|
-
ruleTester.run('deprecation-components-input-emit', deprecationComponentsInputEmit, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid usage for bento-date-picker',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-date-picker @update:model-value="val" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid usage for bento-date-range-picker',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-date-range-picker @update:model-value="val" />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Valid usage for bento-dropdown',
|
|
40
|
-
filename: 'test.vue',
|
|
41
|
-
code: `
|
|
42
|
-
<template>
|
|
43
|
-
<bento-dropdown @update:model-value="val" />
|
|
44
|
-
</template>
|
|
45
|
-
`,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'Valid usage for bento-dropdown-avatar',
|
|
49
|
-
filename: 'test.vue',
|
|
50
|
-
code: `
|
|
51
|
-
<template>
|
|
52
|
-
<bento-dropdown-avatar @update:model-value="val" />
|
|
53
|
-
</template>
|
|
54
|
-
`,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'Valid usage for bento-dropdown-country',
|
|
58
|
-
filename: 'test.vue',
|
|
59
|
-
code: `
|
|
60
|
-
<template>
|
|
61
|
-
<bento-dropdown-country @update:model-value="val" />
|
|
62
|
-
</template>
|
|
63
|
-
`,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'Valid usage for bento-dropdown-currency',
|
|
67
|
-
filename: 'test.vue',
|
|
68
|
-
code: `
|
|
69
|
-
<template>
|
|
70
|
-
<bento-dropdown-currency @update:model-value="val" />
|
|
71
|
-
</template>
|
|
72
|
-
`,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'Valid usage for bento-dropdown-payment-method',
|
|
76
|
-
filename: 'test.vue',
|
|
77
|
-
code: `
|
|
78
|
-
<template>
|
|
79
|
-
<bento-dropdown-payment-method @update:model-value="val" />
|
|
80
|
-
</template>
|
|
81
|
-
`,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'Valid usage for bento-dropdown-tag',
|
|
85
|
-
filename: 'test.vue',
|
|
86
|
-
code: `
|
|
87
|
-
<template>
|
|
88
|
-
<bento-dropdown-tag @update:model-value="val" />
|
|
89
|
-
</template>
|
|
90
|
-
`,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'Valid usage for bento-file-uploader',
|
|
94
|
-
filename: 'test.vue',
|
|
95
|
-
code: `
|
|
96
|
-
<template>
|
|
97
|
-
<bento-file-uploader @update:model-value="val" />
|
|
98
|
-
</template>
|
|
99
|
-
`,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: 'Valid usage for bento-input-field',
|
|
103
|
-
filename: 'test.vue',
|
|
104
|
-
code: `
|
|
105
|
-
<template>
|
|
106
|
-
<bento-input-field @update:model-value="val" />
|
|
107
|
-
</template>
|
|
108
|
-
`,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: 'Valid usage for bento-input-field-password',
|
|
112
|
-
filename: 'test.vue',
|
|
113
|
-
code: `
|
|
114
|
-
<template>
|
|
115
|
-
<bento-input-field-password @update:model-value="val" />
|
|
116
|
-
</template>
|
|
117
|
-
`,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'Valid usage for bento-input-field-phone-number',
|
|
121
|
-
filename: 'test.vue',
|
|
122
|
-
code: `
|
|
123
|
-
<template>
|
|
124
|
-
<bento-input-field-phone-number @update:model-value="val" />
|
|
125
|
-
</template>
|
|
126
|
-
`,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: 'Valid usage for bento-checkbox-group',
|
|
130
|
-
filename: 'test.vue',
|
|
131
|
-
code: `
|
|
132
|
-
<template>
|
|
133
|
-
<bento-checkbox-group @update:model-value="val" />
|
|
134
|
-
</template>
|
|
135
|
-
`,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'Valid usage for bento-radio-group',
|
|
139
|
-
filename: 'test.vue',
|
|
140
|
-
code: `
|
|
141
|
-
<template>
|
|
142
|
-
<bento-radio-group @update:model-value="val" />
|
|
143
|
-
</template>
|
|
144
|
-
`,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: 'Valid usage for bento-selection-card-group',
|
|
148
|
-
filename: 'test.vue',
|
|
149
|
-
code: `
|
|
150
|
-
<template>
|
|
151
|
-
<bento-selection-card-group @update:model-value="val" />
|
|
152
|
-
</template>
|
|
153
|
-
`,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'Valid usage for bento-textarea',
|
|
157
|
-
filename: 'test.vue',
|
|
158
|
-
code: `
|
|
159
|
-
<template>
|
|
160
|
-
<bento-textarea @update:model-value="val" />
|
|
161
|
-
</template>
|
|
162
|
-
`,
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
invalid: [
|
|
166
|
-
/* autofix: false */
|
|
167
|
-
{
|
|
168
|
-
name: 'Invalid: Emit event with autofix disabled (explicit false)',
|
|
169
|
-
filename: 'test.vue',
|
|
170
|
-
code: `<template><bento-input-field @input="val" /></template>`,
|
|
171
|
-
output: null,
|
|
172
|
-
options: [{ autofix: false }],
|
|
173
|
-
errors: [{ messageId: 'deprecation' }],
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
name: 'Invalid: Emit event with autofix disabled (no options)',
|
|
177
|
-
filename: 'test.vue',
|
|
178
|
-
code: `<template><bento-dropdown @input="handleInput" /></template>`,
|
|
179
|
-
output: null,
|
|
180
|
-
errors: [{ messageId: 'deprecation' }],
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: 'Invalid: Emit event with v-on directive and autofix disabled',
|
|
184
|
-
filename: 'test.vue',
|
|
185
|
-
code: `<template><bento-textarea v-on:input="val" /></template>`,
|
|
186
|
-
output: null,
|
|
187
|
-
errors: [{ messageId: 'deprecation' }],
|
|
188
|
-
},
|
|
189
|
-
/* autofix: true */
|
|
190
|
-
{
|
|
191
|
-
name: 'Invalid: Emit event on bento-date-picker',
|
|
192
|
-
filename: 'test.vue',
|
|
193
|
-
code: `<template><bento-date-picker @input="val" /></template>`,
|
|
194
|
-
output: `<template><bento-date-picker @update:model-value="val" /></template>`,
|
|
195
|
-
options: [{ autofix: true }],
|
|
196
|
-
errors: [{ messageId: 'deprecation' }],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: 'Invalid: Emit event on bento-date-range-picker',
|
|
200
|
-
filename: 'test.vue',
|
|
201
|
-
code: `<template><bento-date-range-picker @input="val" /></template>`,
|
|
202
|
-
output: `<template><bento-date-range-picker @update:model-value="val" /></template>`,
|
|
203
|
-
options: [{ autofix: true }],
|
|
204
|
-
errors: [{ messageId: 'deprecation' }],
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: 'Invalid: Emit event on bento-dropdown',
|
|
208
|
-
filename: 'test.vue',
|
|
209
|
-
code: `<template><bento-dropdown @input="val" /></template>`,
|
|
210
|
-
output: `<template><bento-dropdown @update:model-value="val" /></template>`,
|
|
211
|
-
options: [{ autofix: true }],
|
|
212
|
-
errors: [{ messageId: 'deprecation' }],
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: 'Invalid: Emit event on bento-dropdown-avatar',
|
|
216
|
-
filename: 'test.vue',
|
|
217
|
-
code: `<template><bento-dropdown-avatar @input="val" /></template>`,
|
|
218
|
-
output: `<template><bento-dropdown-avatar @update:model-value="val" /></template>`,
|
|
219
|
-
options: [{ autofix: true }],
|
|
220
|
-
errors: [{ messageId: 'deprecation' }],
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: 'Invalid: Emit event on bento-dropdown-country',
|
|
224
|
-
filename: 'test.vue',
|
|
225
|
-
code: `<template><bento-dropdown-country @input="val" /></template>`,
|
|
226
|
-
output: `<template><bento-dropdown-country @update:model-value="val" /></template>`,
|
|
227
|
-
options: [{ autofix: true }],
|
|
228
|
-
errors: [{ messageId: 'deprecation' }],
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: 'Invalid: Emit event on bento-dropdown-currency',
|
|
232
|
-
filename: 'test.vue',
|
|
233
|
-
code: `<template><bento-dropdown-currency @input="val" /></template>`,
|
|
234
|
-
output: `<template><bento-dropdown-currency @update:model-value="val" /></template>`,
|
|
235
|
-
options: [{ autofix: true }],
|
|
236
|
-
errors: [{ messageId: 'deprecation' }],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: 'Invalid: Emit event on bento-dropdown-payment-method',
|
|
240
|
-
filename: 'test.vue',
|
|
241
|
-
code: `<template><bento-dropdown-payment-method @input="val" /></template>`,
|
|
242
|
-
output: `<template><bento-dropdown-payment-method @update:model-value="val" /></template>`,
|
|
243
|
-
options: [{ autofix: true }],
|
|
244
|
-
errors: [{ messageId: 'deprecation' }],
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: 'Invalid: Emit event on bento-dropdown-tag',
|
|
248
|
-
filename: 'test.vue',
|
|
249
|
-
code: `<template><bento-dropdown-tag @input="val" /></template>`,
|
|
250
|
-
output: `<template><bento-dropdown-tag @update:model-value="val" /></template>`,
|
|
251
|
-
options: [{ autofix: true }],
|
|
252
|
-
errors: [{ messageId: 'deprecation' }],
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: 'Invalid: Emit event on bento-file-uploader',
|
|
256
|
-
filename: 'test.vue',
|
|
257
|
-
code: `<template><bento-file-uploader @input="val" /></template>`,
|
|
258
|
-
output: `<template><bento-file-uploader @update:model-value="val" /></template>`,
|
|
259
|
-
options: [{ autofix: true }],
|
|
260
|
-
errors: [{ messageId: 'deprecation' }],
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: 'Invalid: Emit event on bento-input-field',
|
|
264
|
-
filename: 'test.vue',
|
|
265
|
-
code: `<template><bento-input-field @input="val" /></template>`,
|
|
266
|
-
output: `<template><bento-input-field @update:model-value="val" /></template>`,
|
|
267
|
-
options: [{ autofix: true }],
|
|
268
|
-
errors: [{ messageId: 'deprecation' }],
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: 'Invalid: Emit event on bento-input-field-password',
|
|
272
|
-
filename: 'test.vue',
|
|
273
|
-
code: `<template><bento-input-field-password @input="val" /></template>`,
|
|
274
|
-
output: `<template><bento-input-field-password @update:model-value="val" /></template>`,
|
|
275
|
-
options: [{ autofix: true }],
|
|
276
|
-
errors: [{ messageId: 'deprecation' }],
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: 'Invalid: Emit event on bento-input-field-phone-number',
|
|
280
|
-
filename: 'test.vue',
|
|
281
|
-
code: `<template><bento-input-field-phone-number @input="val" /></template>`,
|
|
282
|
-
output: `<template><bento-input-field-phone-number @update:model-value="val" /></template>`,
|
|
283
|
-
options: [{ autofix: true }],
|
|
284
|
-
errors: [{ messageId: 'deprecation' }],
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: 'Invalid: Emit event on bento-checkbox-group',
|
|
288
|
-
filename: 'test.vue',
|
|
289
|
-
code: `<template><bento-checkbox-group @input="val" /></template>`,
|
|
290
|
-
output: `<template><bento-checkbox-group @update:model-value="val" /></template>`,
|
|
291
|
-
options: [{ autofix: true }],
|
|
292
|
-
errors: [{ messageId: 'deprecation' }],
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: 'Invalid: Emit event on bento-radio-group',
|
|
296
|
-
filename: 'test.vue',
|
|
297
|
-
code: `<template><bento-radio-group @input="val" /></template>`,
|
|
298
|
-
output: `<template><bento-radio-group @update:model-value="val" /></template>`,
|
|
299
|
-
options: [{ autofix: true }],
|
|
300
|
-
errors: [{ messageId: 'deprecation' }],
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
name: 'Invalid: Emit event on bento-selection-card-group',
|
|
304
|
-
filename: 'test.vue',
|
|
305
|
-
code: `<template><bento-selection-card-group @input="val" /></template>`,
|
|
306
|
-
output: `<template><bento-selection-card-group @update:model-value="val" /></template>`,
|
|
307
|
-
options: [{ autofix: true }],
|
|
308
|
-
errors: [{ messageId: 'deprecation' }],
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
name: 'Invalid: Emit event on bento-textarea',
|
|
312
|
-
filename: 'test.vue',
|
|
313
|
-
code: `<template><bento-textarea @input="val" /></template>`,
|
|
314
|
-
output: `<template><bento-textarea @update:model-value="val" /></template>`,
|
|
315
|
-
options: [{ autofix: true }],
|
|
316
|
-
errors: [{ messageId: 'deprecation' }],
|
|
317
|
-
},
|
|
318
|
-
],
|
|
319
|
-
});
|
|
320
|
-
});
|