@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,176 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationBentoDateRangePickerHasActionsProp from './deprecation-bento-date-range-picker-has-actions-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-date-range-picker-has-actions-prop', () => {
|
|
18
|
-
describe('action: add (default)', () => {
|
|
19
|
-
ruleTester.run(
|
|
20
|
-
'deprecation-bento-date-range-picker-has-actions-prop (add)',
|
|
21
|
-
deprecationBentoDateRangePickerHasActionsProp,
|
|
22
|
-
{
|
|
23
|
-
valid: [
|
|
24
|
-
{
|
|
25
|
-
name: 'Valid: component already has has-actions (static boolean)',
|
|
26
|
-
filename: 'test.vue',
|
|
27
|
-
code: `<template><bento-date-range-picker has-actions /></template>`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid: component already has has-actions (dynamic)',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `<template><bento-date-range-picker :has-actions="true" /></template>`,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'Valid: unrelated component without has-actions',
|
|
36
|
-
filename: 'test.vue',
|
|
37
|
-
code: `<template><bento-button label="click" /></template>`,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
invalid: [
|
|
41
|
-
{
|
|
42
|
-
name: 'Invalid: missing has-actions (no autofix)',
|
|
43
|
-
filename: 'test.vue',
|
|
44
|
-
code: `<template><bento-date-range-picker label="Pick" /></template>`,
|
|
45
|
-
output: null,
|
|
46
|
-
errors: [{ messageId: 'missingProp' }],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'Invalid: missing has-actions (autofix adds prop)',
|
|
50
|
-
filename: 'test.vue',
|
|
51
|
-
code: `<template><bento-date-range-picker label="Pick" /></template>`,
|
|
52
|
-
output: `<template><bento-date-range-picker has-actions label="Pick" /></template>`,
|
|
53
|
-
options: [{ action: 'add', autofix: true }],
|
|
54
|
-
errors: [{ messageId: 'missingProp' }],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: 'Invalid: missing has-actions on self-closing tag without attrs (autofix)',
|
|
58
|
-
filename: 'test.vue',
|
|
59
|
-
code: `<template><bento-date-range-picker /></template>`,
|
|
60
|
-
output: `<template><bento-date-range-picker has-actions /></template>`,
|
|
61
|
-
options: [{ autofix: true }],
|
|
62
|
-
errors: [{ messageId: 'missingProp' }],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'Invalid: missing has-actions on self-closing tag without space before /> (autofix)',
|
|
66
|
-
filename: 'test.vue',
|
|
67
|
-
code: `<template><bento-date-range-picker/></template>`,
|
|
68
|
-
output: `<template><bento-date-range-picker has-actions /></template>`,
|
|
69
|
-
options: [{ autofix: true }],
|
|
70
|
-
errors: [{ messageId: 'missingProp' }],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'Invalid: has-actions="false" (static string false, no autofix)',
|
|
74
|
-
filename: 'test.vue',
|
|
75
|
-
code: `<template><bento-date-range-picker has-actions="false" /></template>`,
|
|
76
|
-
output: null,
|
|
77
|
-
errors: [{ messageId: 'missingProp' }],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'Invalid: has-actions="false" (static string false, autofix replaces)',
|
|
81
|
-
filename: 'test.vue',
|
|
82
|
-
code: `<template><bento-date-range-picker has-actions="false" label="Pick" /></template>`,
|
|
83
|
-
output: `<template><bento-date-range-picker has-actions label="Pick" /></template>`,
|
|
84
|
-
options: [{ autofix: true }],
|
|
85
|
-
errors: [{ messageId: 'missingProp' }],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: 'Invalid: :has-actions="false" (dynamic false, autofix replaces)',
|
|
89
|
-
filename: 'test.vue',
|
|
90
|
-
code: `<template><bento-date-range-picker :has-actions="false" label="Pick" /></template>`,
|
|
91
|
-
output: `<template><bento-date-range-picker has-actions label="Pick" /></template>`,
|
|
92
|
-
options: [{ autofix: true }],
|
|
93
|
-
errors: [{ messageId: 'missingProp' }],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: 'Invalid: multi-line component missing has-actions (autofix preserves indentation)',
|
|
97
|
-
filename: 'test.vue',
|
|
98
|
-
code: `<template>
|
|
99
|
-
<bento-date-range-picker
|
|
100
|
-
label="Pick"
|
|
101
|
-
/>
|
|
102
|
-
</template>`,
|
|
103
|
-
output: `<template>
|
|
104
|
-
<bento-date-range-picker
|
|
105
|
-
has-actions
|
|
106
|
-
label="Pick"
|
|
107
|
-
/>
|
|
108
|
-
</template>`,
|
|
109
|
-
options: [{ autofix: true }],
|
|
110
|
-
errors: [{ messageId: 'missingProp' }],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe('action: remove', () => {
|
|
118
|
-
ruleTester.run(
|
|
119
|
-
'deprecation-bento-date-range-picker-has-actions-prop (remove)',
|
|
120
|
-
deprecationBentoDateRangePickerHasActionsProp,
|
|
121
|
-
{
|
|
122
|
-
valid: [
|
|
123
|
-
{
|
|
124
|
-
name: 'Valid: component without has-actions',
|
|
125
|
-
filename: 'test.vue',
|
|
126
|
-
code: `<template><bento-date-range-picker label="Pick" /></template>`,
|
|
127
|
-
options: [{ action: 'remove' }],
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
invalid: [
|
|
131
|
-
{
|
|
132
|
-
name: 'Invalid: has-actions present (static boolean, no autofix)',
|
|
133
|
-
filename: 'test.vue',
|
|
134
|
-
code: `<template><bento-date-range-picker has-actions /></template>`,
|
|
135
|
-
output: null,
|
|
136
|
-
options: [{ action: 'remove' }],
|
|
137
|
-
errors: [{ messageId: 'removeProp' }],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: 'Invalid: has-actions present (static boolean, autofix removes)',
|
|
141
|
-
filename: 'test.vue',
|
|
142
|
-
code: `<template><bento-date-range-picker has-actions label="Pick" /></template>`,
|
|
143
|
-
output: `<template><bento-date-range-picker label="Pick" /></template>`,
|
|
144
|
-
options: [{ action: 'remove', autofix: true }],
|
|
145
|
-
errors: [{ messageId: 'removeProp' }],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'Invalid: has-actions present (dynamic, autofix removes)',
|
|
149
|
-
filename: 'test.vue',
|
|
150
|
-
code: `<template><bento-date-range-picker :has-actions="true" /></template>`,
|
|
151
|
-
output: `<template><bento-date-range-picker /></template>`,
|
|
152
|
-
options: [{ action: 'remove', autofix: true }],
|
|
153
|
-
errors: [{ messageId: 'removeProp' }],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'Invalid: multi-line has-actions on its own line (autofix removes entire line)',
|
|
157
|
-
filename: 'test.vue',
|
|
158
|
-
code: `<template>
|
|
159
|
-
<bento-date-range-picker
|
|
160
|
-
has-actions
|
|
161
|
-
label="Pick"
|
|
162
|
-
/>
|
|
163
|
-
</template>`,
|
|
164
|
-
output: `<template>
|
|
165
|
-
<bento-date-range-picker
|
|
166
|
-
label="Pick"
|
|
167
|
-
/>
|
|
168
|
-
</template>`,
|
|
169
|
-
options: [{ action: 'remove', autofix: true }],
|
|
170
|
-
errors: [{ messageId: 'removeProp' }],
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
@@ -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-dropdown-size-prop': ['warn', { autofix: true }],
|
|
23
|
-
},
|
|
24
|
-
files: ['**/*.vue'],
|
|
25
|
-
},
|
|
26
|
-
]);
|
|
@@ -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
|
-
});
|
package/rules/deprecation-bento-dropdown-size-prop/deprecation-bento-dropdown-size-prop.test.ts
DELETED
|
@@ -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,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
|
-
});
|