@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,136 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import vueParser from 'vue-eslint-parser';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import deprecationCurrencyDefaultSlot from './deprecation-currency-default-slot';
|
|
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-currency-default-slot should suggest the usage of "label" property instead of "default" slot', () => {
|
|
18
|
-
ruleTester.run('deprecation-currency-default-slot', deprecationCurrencyDefaultSlot, {
|
|
19
|
-
valid: [
|
|
20
|
-
{
|
|
21
|
-
name: 'BentoCurrency with "value" property',
|
|
22
|
-
filename: 'test.vue',
|
|
23
|
-
code: `
|
|
24
|
-
<template>
|
|
25
|
-
<bento-currency :value="12345" currency="USD" />
|
|
26
|
-
</template>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'BentoCurrency with closing tag but no children',
|
|
31
|
-
filename: 'test.vue',
|
|
32
|
-
code: `
|
|
33
|
-
<template>
|
|
34
|
-
<bento-currency :value="12345" :currency="BentoCurrencyISOCode.USD" major-units />
|
|
35
|
-
</template>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'BentoCurrency with closing tag but no children',
|
|
40
|
-
filename: 'test.vue',
|
|
41
|
-
code: `
|
|
42
|
-
<template>
|
|
43
|
-
<bento-currency
|
|
44
|
-
:value="thisIsMyVariableWithCurrencyValue"
|
|
45
|
-
:currency="BentoCurrencyISOCode.USD"
|
|
46
|
-
major-units
|
|
47
|
-
/>
|
|
48
|
-
</template>
|
|
49
|
-
`,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
invalid: [
|
|
53
|
-
{
|
|
54
|
-
name: 'BentoCurrency with VText child',
|
|
55
|
-
code: `
|
|
56
|
-
<template>
|
|
57
|
-
<bento-currency currency="USD">
|
|
58
|
-
12345
|
|
59
|
-
</bento-currency>
|
|
60
|
-
</template>
|
|
61
|
-
`,
|
|
62
|
-
output: `
|
|
63
|
-
<template>
|
|
64
|
-
<bento-currency currency="USD" :value="12345" />
|
|
65
|
-
</template>
|
|
66
|
-
`,
|
|
67
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "value" property' }],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'BentoCurrency with CallExpression child',
|
|
71
|
-
code: `
|
|
72
|
-
<template>
|
|
73
|
-
<bento-currency :currency="BentoCurrencyISOCode.EUR" major-units
|
|
74
|
-
>{{ myFunction(valueRefs, EnumValues.EURO_AMOUNT) }}
|
|
75
|
-
</bento-currency>
|
|
76
|
-
</template>
|
|
77
|
-
`,
|
|
78
|
-
output: `
|
|
79
|
-
<template>
|
|
80
|
-
<bento-currency :currency="BentoCurrencyISOCode.EUR" major-units
|
|
81
|
-
:value="myFunction(valueRefs, EnumValues.EURO_AMOUNT)" />
|
|
82
|
-
</template>
|
|
83
|
-
`,
|
|
84
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "value" property' }],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: 'BentoCurrency with VText child and no attributes',
|
|
88
|
-
code: `
|
|
89
|
-
<template>
|
|
90
|
-
<bento-currency>
|
|
91
|
-
12345.23
|
|
92
|
-
</bento-currency>
|
|
93
|
-
</template>
|
|
94
|
-
`,
|
|
95
|
-
output: `
|
|
96
|
-
<template>
|
|
97
|
-
<bento-currency :value="12345.23" />
|
|
98
|
-
</template>
|
|
99
|
-
`,
|
|
100
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "value" property' }],
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'BentoCurrency with property as child',
|
|
104
|
-
code: `
|
|
105
|
-
<template>
|
|
106
|
-
<bento-currency :key="item.thisIsMyVariableWithCurrencyValue" :currency="BentoCurrencyISOCode.EUR" major-units>
|
|
107
|
-
{{ item.thisIsMyVariableWithCurrencyValue }}
|
|
108
|
-
</bento-currency>
|
|
109
|
-
</template>
|
|
110
|
-
`,
|
|
111
|
-
output: `
|
|
112
|
-
<template>
|
|
113
|
-
<bento-currency :key="item.thisIsMyVariableWithCurrencyValue" :currency="BentoCurrencyISOCode.EUR" major-units :value="item.thisIsMyVariableWithCurrencyValue" />
|
|
114
|
-
</template>
|
|
115
|
-
`,
|
|
116
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "value" property' }],
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: 'BentoCurrency with simple property as child',
|
|
120
|
-
code: `
|
|
121
|
-
<template>
|
|
122
|
-
<bento-currency>
|
|
123
|
-
{{ thisIsMyVariableWithCurrencyValue }}
|
|
124
|
-
</bento-currency>
|
|
125
|
-
</template>
|
|
126
|
-
`,
|
|
127
|
-
output: `
|
|
128
|
-
<template>
|
|
129
|
-
<bento-currency :value="thisIsMyVariableWithCurrencyValue" />
|
|
130
|
-
</template>
|
|
131
|
-
`,
|
|
132
|
-
errors: [{ message: '"default" slot is deprecated in favor of the "value" property' }],
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<!-- Direct value prop on bento-filter-bar: 3 warnings -->
|
|
4
|
-
<bento-filter-bar value="val" />
|
|
5
|
-
<bento-filter-bar :value="filters" />
|
|
6
|
-
<bento-filter-bar v-model="filters" />
|
|
7
|
-
|
|
8
|
-
<!-- Script-defined config with deprecated value + options: used below -->
|
|
9
|
-
<bento-filter-bar :config="configWithValue" />
|
|
10
|
-
<bento-data-grid :filters="configWithOptions" />
|
|
11
|
-
|
|
12
|
-
<!-- Inline template config with deprecated options: 1 warning -->
|
|
13
|
-
<bento-filter-bar
|
|
14
|
-
:config="[
|
|
15
|
-
{
|
|
16
|
-
field: 'inline',
|
|
17
|
-
label: 'Inline',
|
|
18
|
-
type: 'BentoSelectFilter',
|
|
19
|
-
options: { messages: {} },
|
|
20
|
-
},
|
|
21
|
-
]"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script setup>
|
|
27
|
-
// 1 warning (value on config item)
|
|
28
|
-
const configWithValue = [
|
|
29
|
-
{
|
|
30
|
-
field: 'name',
|
|
31
|
-
label: 'Name',
|
|
32
|
-
type: 'BentoInputFilter',
|
|
33
|
-
value: 'test',
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// 3 warnings (messages + 2 keys)
|
|
38
|
-
const configWithOptions = [
|
|
39
|
-
{
|
|
40
|
-
field: 'status',
|
|
41
|
-
label: 'Status',
|
|
42
|
-
type: 'BentoSelectFilter',
|
|
43
|
-
options: {
|
|
44
|
-
messages: {},
|
|
45
|
-
messagesPersistentButtonLabelPartiallySelectedKey: 'k1',
|
|
46
|
-
messagesPersistentButtonLabelAllSelectedKey: 'k2',
|
|
47
|
-
listboxItems: [],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<script>
|
|
54
|
-
export const parseBinaryOperation = operation => ({
|
|
55
|
-
field: operation.left.name,
|
|
56
|
-
operator: operation.type,
|
|
57
|
-
category: operation.left.type,
|
|
58
|
-
type: parseOperationValueType(operation.right.type),
|
|
59
|
-
value: parseOperationValue(operation),
|
|
60
|
-
key: getUniqueId(),
|
|
61
|
-
});
|
|
62
|
-
</script>
|
|
@@ -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
|
-
});
|