@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
|
@@ -1,25 +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
|
-
'@adyen/bento/deprecation-filter-bar-deprecated-props': 'warn',
|
|
22
|
-
},
|
|
23
|
-
files: ['**/*.vue'],
|
|
24
|
-
},
|
|
25
|
-
]);
|
|
@@ -1,22 +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-filter-bar-deprecated-props', () => {
|
|
5
|
-
it('should lint with warning', () => {
|
|
6
|
-
const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
|
|
7
|
-
const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-filter-bar-deprecated-props.vue');
|
|
8
|
-
|
|
9
|
-
const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
|
|
10
|
-
|
|
11
|
-
// 3 from direct value prop (static, dynamic, v-model)
|
|
12
|
-
// + 1 from configWithValue (value on config item)
|
|
13
|
-
// + 3 from configWithOptions (messages + 2 keys)
|
|
14
|
-
// + 1 from inline template (messages)
|
|
15
|
-
expect(result[0].warningCount).toBe(8);
|
|
16
|
-
|
|
17
|
-
expect(result[0].messages[0]).toMatchObject({
|
|
18
|
-
ruleId: '@adyen/bento/deprecation-filter-bar-deprecated-props',
|
|
19
|
-
severity: 1,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationFilterBarDeprecatedProps from './deprecation-filter-bar-deprecated-props';
|
|
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-filter-bar-deprecated-props', () => {
|
|
18
|
-
ruleTester.run('deprecation-filter-bar-deprecated-props', deprecationFilterBarDeprecatedProps, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'Valid: bento-filter-bar with config prop (no value)',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-filter-bar :config="config" :filter-values="values" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'Valid: Vue 3 filter-values v-model on bento-filter-bar',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-filter-bar :config="config" v-model:filter-values="filterValues" />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Valid: filter config item without deprecated value property',
|
|
40
|
-
filename: 'test.vue',
|
|
41
|
-
code: `
|
|
42
|
-
<script setup>
|
|
43
|
-
const config = [{ field: 'name', label: 'Name', type: 'BentoInputFilter' }];
|
|
44
|
-
</script>
|
|
45
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
46
|
-
`,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'Valid: filter config options without deprecated messages keys',
|
|
50
|
-
filename: 'test.vue',
|
|
51
|
-
code: `
|
|
52
|
-
<script setup>
|
|
53
|
-
const config = [{
|
|
54
|
-
field: 'status',
|
|
55
|
-
label: 'Status',
|
|
56
|
-
type: 'BentoSelectFilter',
|
|
57
|
-
options: { listboxItems: [] },
|
|
58
|
-
}];
|
|
59
|
-
</script>
|
|
60
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
61
|
-
`,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'Valid: computed property key matching deprecated name (no false positive)',
|
|
65
|
-
filename: 'test.vue',
|
|
66
|
-
code: `
|
|
67
|
-
<script setup>
|
|
68
|
-
const key = 'value';
|
|
69
|
-
const config = [{ field: 'x', type: 'BentoInputFilter', [key]: 'test' }];
|
|
70
|
-
</script>
|
|
71
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
72
|
-
`,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'Valid: spread in options (no crash)',
|
|
76
|
-
filename: 'test.vue',
|
|
77
|
-
code: `
|
|
78
|
-
<script setup>
|
|
79
|
-
const defaults = {};
|
|
80
|
-
const config = [{
|
|
81
|
-
field: 'x',
|
|
82
|
-
type: 'BentoSelectFilter',
|
|
83
|
-
options: { ...defaults, listboxItems: [] },
|
|
84
|
-
}];
|
|
85
|
-
</script>
|
|
86
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
87
|
-
`,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'Valid: bento-data-grid with filters without deprecated props',
|
|
91
|
-
filename: 'test.vue',
|
|
92
|
-
code: `
|
|
93
|
-
<script setup>
|
|
94
|
-
const filters = [{ field: 'x', label: 'X', type: 'BentoInputFilter' }];
|
|
95
|
-
</script>
|
|
96
|
-
<template><bento-data-grid :filters="filters" /></template>
|
|
97
|
-
`,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'Valid: unrelated object with options.messages (no false positive)',
|
|
101
|
-
filename: 'test.vue',
|
|
102
|
-
code: `
|
|
103
|
-
<script setup>
|
|
104
|
-
const unrelated = { options: { messages: {} } };
|
|
105
|
-
</script>
|
|
106
|
-
<template><div /></template>
|
|
107
|
-
`,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: 'Valid: unrelated binary operation object with field, type, and value properties',
|
|
111
|
-
filename: 'test.vue',
|
|
112
|
-
code: `
|
|
113
|
-
<script>
|
|
114
|
-
export const parseBinaryOperation = operation => ({
|
|
115
|
-
field: operation.left.name,
|
|
116
|
-
operator: operation.type,
|
|
117
|
-
category: operation.left.type,
|
|
118
|
-
type: parseOperationValueType(operation.right.type),
|
|
119
|
-
value: parseOperationValue(operation),
|
|
120
|
-
key: getUniqueId(),
|
|
121
|
-
});
|
|
122
|
-
</script>
|
|
123
|
-
<template><div /></template>
|
|
124
|
-
`,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'Valid: unrelated object with a non-filter string type',
|
|
128
|
-
filename: 'test.vue',
|
|
129
|
-
code: `
|
|
130
|
-
<script setup>
|
|
131
|
-
const operation = { field: 'name', type: 'BinaryOperation', value: 'test' };
|
|
132
|
-
</script>
|
|
133
|
-
<template><div /></template>
|
|
134
|
-
`,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: 'Valid: unrelated enum member with a similar name',
|
|
138
|
-
filename: 'test.vue',
|
|
139
|
-
code: `
|
|
140
|
-
<script setup>
|
|
141
|
-
const config = [{ field: 'name', type: OtherFilterItemType.INPUT, value: 'test' }];
|
|
142
|
-
</script>
|
|
143
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
144
|
-
`,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: 'Valid: unrelated object with value property (no false positive)',
|
|
148
|
-
filename: 'test.vue',
|
|
149
|
-
code: `
|
|
150
|
-
<script setup>
|
|
151
|
-
const obj = { value: 'test', options: { messages: {} } };
|
|
152
|
-
</script>
|
|
153
|
-
<template><div /></template>
|
|
154
|
-
`,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
invalid: [
|
|
158
|
-
// Direct "value" prop on bento-filter-bar
|
|
159
|
-
{
|
|
160
|
-
name: 'Invalid: static value prop on bento-filter-bar',
|
|
161
|
-
filename: 'test.vue',
|
|
162
|
-
code: `<template><bento-filter-bar value="val" /></template>`,
|
|
163
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: 'Invalid: dynamic value prop on bento-filter-bar',
|
|
167
|
-
filename: 'test.vue',
|
|
168
|
-
code: `<template><bento-filter-bar :value="filters" /></template>`,
|
|
169
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: 'Invalid: v-model on bento-filter-bar',
|
|
173
|
-
filename: 'test.vue',
|
|
174
|
-
code: `<template><bento-filter-bar v-model="filters" /></template>`,
|
|
175
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: 'Invalid: Vue 3 value v-model on bento-filter-bar',
|
|
179
|
-
filename: 'test.vue',
|
|
180
|
-
code: `<template><bento-filter-bar v-model:value="filters" /></template>`,
|
|
181
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
182
|
-
},
|
|
183
|
-
// "value" inside filter config items (script)
|
|
184
|
-
{
|
|
185
|
-
name: 'Invalid: value property in filter config item without a label',
|
|
186
|
-
filename: 'test.vue',
|
|
187
|
-
code: `
|
|
188
|
-
<script setup>
|
|
189
|
-
const config = [{
|
|
190
|
-
field: 'name',
|
|
191
|
-
type: 'BentoInputFilter',
|
|
192
|
-
value: 'test',
|
|
193
|
-
}];
|
|
194
|
-
</script>
|
|
195
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
196
|
-
`,
|
|
197
|
-
errors: [{ messageId: 'deprecationConfigValue' }],
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: 'Invalid: value property in BentoFilterItemType enum config item',
|
|
201
|
-
filename: 'test.vue',
|
|
202
|
-
code: `
|
|
203
|
-
<script setup>
|
|
204
|
-
const config = [{
|
|
205
|
-
field: 'name',
|
|
206
|
-
type: BentoFilterItemType.INPUT,
|
|
207
|
-
value: 'test',
|
|
208
|
-
}];
|
|
209
|
-
</script>
|
|
210
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
211
|
-
`,
|
|
212
|
-
errors: [{ messageId: 'deprecationConfigValue' }],
|
|
213
|
-
},
|
|
214
|
-
// "value" inside filter config items (inline template)
|
|
215
|
-
{
|
|
216
|
-
name: 'Invalid: value property in filter config item (inline template)',
|
|
217
|
-
filename: 'test.vue',
|
|
218
|
-
code: `
|
|
219
|
-
<template>
|
|
220
|
-
<bento-filter-bar :config="[{ field: 'name', label: 'Name', type: 'BentoInputFilter', value: 'test' }]" />
|
|
221
|
-
</template>
|
|
222
|
-
`,
|
|
223
|
-
errors: [{ messageId: 'deprecationConfigValue' }],
|
|
224
|
-
},
|
|
225
|
-
// Deprecated messages option
|
|
226
|
-
{
|
|
227
|
-
name: 'Invalid: messages option in filter config',
|
|
228
|
-
filename: 'test.vue',
|
|
229
|
-
code: `
|
|
230
|
-
<script setup>
|
|
231
|
-
const config = [{
|
|
232
|
-
field: 'status',
|
|
233
|
-
label: 'Status',
|
|
234
|
-
type: 'BentoSelectFilter',
|
|
235
|
-
options: { messages: { en: { persistentButtonLabelPartiallySelected: 'x' } }, listboxItems: [] },
|
|
236
|
-
}];
|
|
237
|
-
</script>
|
|
238
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
239
|
-
`,
|
|
240
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
241
|
-
},
|
|
242
|
-
// Deprecated messagesPersistentButtonLabelPartiallySelectedKey
|
|
243
|
-
{
|
|
244
|
-
name: 'Invalid: messagesPersistentButtonLabelPartiallySelectedKey option',
|
|
245
|
-
filename: 'test.vue',
|
|
246
|
-
code: `
|
|
247
|
-
<script setup>
|
|
248
|
-
const config = [{
|
|
249
|
-
field: 'status',
|
|
250
|
-
label: 'Status',
|
|
251
|
-
type: 'BentoSelectFilter',
|
|
252
|
-
options: { messagesPersistentButtonLabelPartiallySelectedKey: 'customKey', listboxItems: [] },
|
|
253
|
-
}];
|
|
254
|
-
</script>
|
|
255
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
256
|
-
`,
|
|
257
|
-
errors: [
|
|
258
|
-
{
|
|
259
|
-
messageId: 'deprecationOption',
|
|
260
|
-
data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
},
|
|
264
|
-
// Deprecated messagesPersistentButtonLabelAllSelectedKey
|
|
265
|
-
{
|
|
266
|
-
name: 'Invalid: messagesPersistentButtonLabelAllSelectedKey option',
|
|
267
|
-
filename: 'test.vue',
|
|
268
|
-
code: `
|
|
269
|
-
<script setup>
|
|
270
|
-
const config = [{
|
|
271
|
-
field: 'status',
|
|
272
|
-
label: 'Status',
|
|
273
|
-
type: 'BentoSelectFilter',
|
|
274
|
-
options: { messagesPersistentButtonLabelAllSelectedKey: 'customKey', listboxItems: [] },
|
|
275
|
-
}];
|
|
276
|
-
</script>
|
|
277
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
278
|
-
`,
|
|
279
|
-
errors: [
|
|
280
|
-
{ messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
|
|
281
|
-
],
|
|
282
|
-
},
|
|
283
|
-
// All 3 deprecated options together
|
|
284
|
-
{
|
|
285
|
-
name: 'Invalid: all deprecated options in one config',
|
|
286
|
-
filename: 'test.vue',
|
|
287
|
-
code: `
|
|
288
|
-
<script setup>
|
|
289
|
-
const config = [{
|
|
290
|
-
field: 'status',
|
|
291
|
-
label: 'Status',
|
|
292
|
-
type: 'BentoSelectFilter',
|
|
293
|
-
options: {
|
|
294
|
-
messages: {},
|
|
295
|
-
messagesPersistentButtonLabelPartiallySelectedKey: 'k1',
|
|
296
|
-
messagesPersistentButtonLabelAllSelectedKey: 'k2',
|
|
297
|
-
listboxItems: [],
|
|
298
|
-
},
|
|
299
|
-
}];
|
|
300
|
-
</script>
|
|
301
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
302
|
-
`,
|
|
303
|
-
errors: [
|
|
304
|
-
{ messageId: 'deprecationOption', data: { key: 'messages' } },
|
|
305
|
-
{
|
|
306
|
-
messageId: 'deprecationOption',
|
|
307
|
-
data: { key: 'messagesPersistentButtonLabelPartiallySelectedKey' },
|
|
308
|
-
},
|
|
309
|
-
{ messageId: 'deprecationOption', data: { key: 'messagesPersistentButtonLabelAllSelectedKey' } },
|
|
310
|
-
],
|
|
311
|
-
},
|
|
312
|
-
// String literal key (edge case)
|
|
313
|
-
{
|
|
314
|
-
name: 'Invalid: string literal key for deprecated option',
|
|
315
|
-
filename: 'test.vue',
|
|
316
|
-
code: `
|
|
317
|
-
<script setup>
|
|
318
|
-
const config = [{
|
|
319
|
-
field: 'status',
|
|
320
|
-
label: 'Status',
|
|
321
|
-
type: 'BentoSelectFilter',
|
|
322
|
-
options: { 'messages': {} },
|
|
323
|
-
}];
|
|
324
|
-
</script>
|
|
325
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
326
|
-
`,
|
|
327
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
328
|
-
},
|
|
329
|
-
// bento-data-grid filters with deprecated value
|
|
330
|
-
{
|
|
331
|
-
name: 'Invalid: value in data-grid filter config item',
|
|
332
|
-
filename: 'test.vue',
|
|
333
|
-
code: `
|
|
334
|
-
<script setup>
|
|
335
|
-
const filters = [{
|
|
336
|
-
field: 'name',
|
|
337
|
-
label: 'Name',
|
|
338
|
-
type: 'BentoInputFilter',
|
|
339
|
-
value: 'test',
|
|
340
|
-
}];
|
|
341
|
-
</script>
|
|
342
|
-
<template><bento-data-grid :filters="filters" /></template>
|
|
343
|
-
`,
|
|
344
|
-
errors: [{ messageId: 'deprecationConfigValue' }],
|
|
345
|
-
},
|
|
346
|
-
// bento-data-grid filters with deprecated options
|
|
347
|
-
{
|
|
348
|
-
name: 'Invalid: deprecated options in data-grid filter config',
|
|
349
|
-
filename: 'test.vue',
|
|
350
|
-
code: `
|
|
351
|
-
<script setup>
|
|
352
|
-
const filters = [{
|
|
353
|
-
field: 'status',
|
|
354
|
-
label: 'Status',
|
|
355
|
-
type: 'BentoSelectFilter',
|
|
356
|
-
options: { messages: {}, listboxItems: [] },
|
|
357
|
-
}];
|
|
358
|
-
</script>
|
|
359
|
-
<template><bento-data-grid :filters="filters" /></template>
|
|
360
|
-
`,
|
|
361
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
362
|
-
},
|
|
363
|
-
// Inline template with deprecated options
|
|
364
|
-
{
|
|
365
|
-
name: 'Invalid: deprecated options in inline template config',
|
|
366
|
-
filename: 'test.vue',
|
|
367
|
-
code: `
|
|
368
|
-
<template>
|
|
369
|
-
<bento-filter-bar :config="[{
|
|
370
|
-
field: 'status',
|
|
371
|
-
label: 'Status',
|
|
372
|
-
type: 'BentoSelectFilter',
|
|
373
|
-
options: { messages: {}, listboxItems: [] },
|
|
374
|
-
}]" />
|
|
375
|
-
</template>
|
|
376
|
-
`,
|
|
377
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
378
|
-
},
|
|
379
|
-
// Spread + deprecated key combined
|
|
380
|
-
{
|
|
381
|
-
name: 'Invalid: spread + deprecated option combined',
|
|
382
|
-
filename: 'test.vue',
|
|
383
|
-
code: `
|
|
384
|
-
<script setup>
|
|
385
|
-
const defaults = {};
|
|
386
|
-
const config = [{
|
|
387
|
-
field: 'status',
|
|
388
|
-
label: 'Status',
|
|
389
|
-
type: 'BentoSelectFilter',
|
|
390
|
-
options: { ...defaults, messages: {} },
|
|
391
|
-
}];
|
|
392
|
-
</script>
|
|
393
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
394
|
-
`,
|
|
395
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
396
|
-
},
|
|
397
|
-
],
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
/* ------------------------------------------------ */
|
|
401
|
-
/* AUTOFIX TESTS */
|
|
402
|
-
/* ------------------------------------------------ */
|
|
403
|
-
ruleTester.run('deprecation-filter-bar-deprecated-props (autofix enabled)', deprecationFilterBarDeprecatedProps, {
|
|
404
|
-
valid: [
|
|
405
|
-
{
|
|
406
|
-
name: 'Valid: no deprecated props (autofix enabled)',
|
|
407
|
-
filename: 'test.vue',
|
|
408
|
-
options: [{ autofix: true }],
|
|
409
|
-
code: `<template><bento-filter-bar :config="config" /></template>`,
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
invalid: [
|
|
413
|
-
{
|
|
414
|
-
name: 'Autofix: preserves static value prop on bento-filter-bar',
|
|
415
|
-
filename: 'test.vue',
|
|
416
|
-
options: [{ autofix: true }],
|
|
417
|
-
code: `<template><bento-filter-bar value="val" /></template>`,
|
|
418
|
-
output: null,
|
|
419
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
name: 'Autofix: preserves dynamic value prop on bento-filter-bar',
|
|
423
|
-
filename: 'test.vue',
|
|
424
|
-
options: [{ autofix: true }],
|
|
425
|
-
code: `<template><bento-filter-bar :value="filters" /></template>`,
|
|
426
|
-
output: null,
|
|
427
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
name: 'Autofix: preserves v-model on bento-filter-bar',
|
|
431
|
-
filename: 'test.vue',
|
|
432
|
-
options: [{ autofix: true }],
|
|
433
|
-
code: `<template><bento-filter-bar v-model="filters" /></template>`,
|
|
434
|
-
output: null,
|
|
435
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: 'Autofix: preserves value on filter config item',
|
|
439
|
-
filename: 'test.vue',
|
|
440
|
-
options: [{ autofix: true }],
|
|
441
|
-
code: `
|
|
442
|
-
<script setup>
|
|
443
|
-
const config = [{
|
|
444
|
-
field: 'name',
|
|
445
|
-
label: 'Name',
|
|
446
|
-
type: 'BentoInputFilter',
|
|
447
|
-
value: 'test',
|
|
448
|
-
}];
|
|
449
|
-
</script>
|
|
450
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
451
|
-
`,
|
|
452
|
-
output: null,
|
|
453
|
-
errors: [{ messageId: 'deprecationConfigValue' }],
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
name: 'Autofix: removes deprecated messages option from filter config',
|
|
457
|
-
filename: 'test.vue',
|
|
458
|
-
options: [{ autofix: true }],
|
|
459
|
-
code: `
|
|
460
|
-
<script setup>
|
|
461
|
-
const config = [{
|
|
462
|
-
field: 'status',
|
|
463
|
-
label: 'Status',
|
|
464
|
-
type: 'BentoSelectFilter',
|
|
465
|
-
options: { messages: {}, listboxItems: [] },
|
|
466
|
-
}];
|
|
467
|
-
</script>
|
|
468
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
469
|
-
`,
|
|
470
|
-
output: `
|
|
471
|
-
<script setup>
|
|
472
|
-
const config = [{
|
|
473
|
-
field: 'status',
|
|
474
|
-
label: 'Status',
|
|
475
|
-
type: 'BentoSelectFilter',
|
|
476
|
-
options: { listboxItems: [] },
|
|
477
|
-
}];
|
|
478
|
-
</script>
|
|
479
|
-
<template><bento-filter-bar :config="config" /></template>
|
|
480
|
-
`,
|
|
481
|
-
errors: [{ messageId: 'deprecationOption', data: { key: 'messages' } }],
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: 'Autofix: does not fix when autofix is false',
|
|
485
|
-
filename: 'test.vue',
|
|
486
|
-
options: [{ autofix: false }],
|
|
487
|
-
code: `<template><bento-filter-bar value="val" other="x" /></template>`,
|
|
488
|
-
errors: [{ messageId: 'deprecationValue' }],
|
|
489
|
-
},
|
|
490
|
-
],
|
|
491
|
-
});
|
|
492
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<bento-filter-bar :config="filterBarConfig" />
|
|
4
|
-
<bento-data-grid :filters="dataGridFilters" />
|
|
5
|
-
<bento-filter-bar
|
|
6
|
-
:config="[
|
|
7
|
-
{
|
|
8
|
-
field: 'inline',
|
|
9
|
-
label: 'Inline',
|
|
10
|
-
type: BentoFilterItemType.INPUT,
|
|
11
|
-
options: { dropdown: { items: [] } },
|
|
12
|
-
},
|
|
13
|
-
]"
|
|
14
|
-
/>
|
|
15
|
-
<bento-data-grid
|
|
16
|
-
:filters="[
|
|
17
|
-
{
|
|
18
|
-
field: 'inlineGrid',
|
|
19
|
-
label: 'Inline Grid',
|
|
20
|
-
type: BentoFilterItemType.INPUT,
|
|
21
|
-
options: { variant: 'dropdown' },
|
|
22
|
-
},
|
|
23
|
-
]"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup>
|
|
29
|
-
const filterBarConfig = [
|
|
30
|
-
{
|
|
31
|
-
field: 'name',
|
|
32
|
-
label: 'Name',
|
|
33
|
-
type: BentoFilterItemType.INPUT,
|
|
34
|
-
options: { dropdown: { items: [] }, dropdownPosition: 'end', variant: 'dropdown' },
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const dataGridFilters = [
|
|
39
|
-
{
|
|
40
|
-
field: 'status',
|
|
41
|
-
label: 'Status',
|
|
42
|
-
type: BentoFilterItemType.INPUT,
|
|
43
|
-
options: { dropdown: { items: [] } },
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
</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-input-filter-dropdown-options': 'warn',
|
|
23
|
-
},
|
|
24
|
-
files: ['**/*.vue'],
|
|
25
|
-
},
|
|
26
|
-
]);
|
|
@@ -1,27 +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-input-filter-dropdown-options', () => {
|
|
5
|
-
it('should lint with warning', () => {
|
|
6
|
-
const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
|
|
7
|
-
const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-input-filter-dropdown-options.vue');
|
|
8
|
-
|
|
9
|
-
const result = JSON.parse(execFileSyncEslintVueFiles(eslintrc, vueFile));
|
|
10
|
-
|
|
11
|
-
// 3 from filterBarConfig (dropdown, dropdownPosition, variant)
|
|
12
|
-
// + 1 from dataGridFilters (dropdown)
|
|
13
|
-
// + 1 from inline bento-filter-bar (dropdown)
|
|
14
|
-
// + 1 from inline bento-data-grid (variant)
|
|
15
|
-
expect(result[0].warningCount).toBe(6);
|
|
16
|
-
|
|
17
|
-
expect(result[0].messages).toEqual(
|
|
18
|
-
expect.arrayContaining([
|
|
19
|
-
expect.objectContaining({
|
|
20
|
-
ruleId: '@adyen/bento/deprecation-input-filter-dropdown-options',
|
|
21
|
-
severity: 1,
|
|
22
|
-
messageId: 'deprecation',
|
|
23
|
-
}),
|
|
24
|
-
])
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
});
|