@adyen/eslint-plugin-bento 1.3.0 → 2.0.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 ADDED
@@ -0,0 +1,79 @@
1
+ # Changelog
2
+
3
+ ## [2.0.0](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.3.0...eslint-plugin-bento-v2.0.0) (2025-05-14)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **eslint:** migrated `@adyen/bento-eslint` to `eslint@9`
9
+
10
+ ### Miscellaneous Chores
11
+
12
+ * **eslint:** migrated `@adyen/bento-eslint` to `eslint@9` ([d8d390e](https://github.com/Adyen/bento/commit/d8d390eed5272a7f1c4e6ed6d9bbb71dc8f4b9a6))
13
+
14
+ ## [1.3.0](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.2.0...eslint-plugin-bento-v1.3.0) (2025-04-16)
15
+
16
+
17
+ ### Features
18
+
19
+ * **eslint:** added javascript type support to ESLint rules package ([0420b72](https://github.com/Adyen/bento/commit/0420b727b491a2ba8179149d5585f8c58a701fc5))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **eslint:** moved `jscodeshift` as dependency to fix issue with dependencies ([fe41f4b](https://github.com/Adyen/bento/commit/fe41f4bc5d91f119ca37a47e29c6651ba35229de))
25
+
26
+
27
+ ### Miscellaneous Chores
28
+
29
+ * added `vue-eslint-parser` as dev dep to Vue2 package to re-enable ESlint on VSCodium ([f6a5aea](https://github.com/Adyen/bento/commit/f6a5aeaf03292ff78f805a8f64653a6db6102f05))
30
+
31
+ ## [1.2.0](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.1.0...eslint-plugin-bento-v1.2.0) (2025-04-09)
32
+
33
+
34
+ ### Features
35
+
36
+ * **eslint:** added new cases to be covered by `currency` & `tag` slot deprecation rules ([b4e86a6](https://github.com/Adyen/bento/commit/b4e86a68cb34c9295248e95eb2002abfaf5d7805))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **eslint:** corrected export module from `componentSlotMigration` util ([3321662](https://github.com/Adyen/bento/commit/33216626557496d6cad80aeaecdcefb7a0cde122))
42
+
43
+ ## [1.1.0](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.0.3...eslint-plugin-bento-v1.1.0) (2025-04-02)
44
+
45
+
46
+ ### Features
47
+
48
+ * **eslint:** added rule to disable the usage of `default` slot in `bento-currency` ([1914017](https://github.com/Adyen/bento/commit/19140179c47de9eeba6a17b94962646c93815004))
49
+ * **eslint:** added rule to disable the usage of `default` slot in `bento-tag` ([1914017](https://github.com/Adyen/bento/commit/19140179c47de9eeba6a17b94962646c93815004))
50
+
51
+ ## [1.0.3](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.0.2...eslint-plugin-bento-v1.0.3) (2025-03-26)
52
+
53
+
54
+ ### Miscellaneous Chores
55
+
56
+ * fixed all PNPM script parameters ([123269d](https://github.com/Adyen/bento/commit/123269d9cbaa791e0984074845c227c21125e864))
57
+
58
+ ## [1.0.2](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.0.1...eslint-plugin-bento-v1.0.2) (2024-12-04)
59
+
60
+
61
+ ### Miscellaneous Chores
62
+
63
+ * replaced `airbnb-base` with `eslint:recommended` `eslint` rules ([762ebf5](https://github.com/Adyen/bento/commit/762ebf549ca6f0baadb7a6c7b96bebe1084a57ee))
64
+ * updated `vitest` to `2.1.4` ([b615334](https://github.com/Adyen/bento/commit/b6153346e284cc2230119c4b5ca25a2f6786d844))
65
+
66
+ ## [1.0.1](https://github.com/Adyen/bento/compare/eslint-plugin-bento-v1.0.0...eslint-plugin-bento-v1.0.1) (2024-11-13)
67
+
68
+
69
+ ### Bug Fixes
70
+
71
+ * **eslint:** aligned `@adyen/eslint-plugin-bento` deps with main repo ([bf0c98e](https://github.com/Adyen/bento/commit/bf0c98e7144740b6f937cfd296114b09f1039f20))
72
+ * **eslint:** prevented `vue-old-spacer-tokens` from overwriting all classes with `b-` ([74ff227](https://github.com/Adyen/bento/commit/74ff2272371ce85d0a486b88830ed280dfc099bd))
73
+
74
+ ## 1.0.0 (2024-11-06)
75
+
76
+
77
+ ### Features
78
+
79
+ * **eslint:** added ESLint Bento rule set package ([0339bc3](https://github.com/Adyen/bento/commit/0339bc3db17a220d9b252bfe3d8a51e6561bfba8))
package/README.md CHANGED
@@ -5,42 +5,77 @@ The Bento ESLint package helps improving the usage of Bento components and utili
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install --save-dev eslint@8 vue-eslint-parser@7 @adyen/eslint-plugin-bento
8
+ npm install --save-dev eslint@9 vue-eslint-parser@10 @adyen/eslint-plugin-bento@2
9
9
  ```
10
10
 
11
11
  <!-- prettier-ignore -->
12
12
  > Requirements
13
13
  >
14
- > ESLint v6.0.0 up to v8.0.0
15
- > Node.js v12.22.x, v14.17.x, v16.x and above
16
- > `vue-eslint-parser` v7.0.0
14
+ > ESLint v9.0.0
15
+ > Node.js v20.x and above
16
+ > `vue-eslint-parser` v10.0.0
17
17
 
18
18
  ## Usage
19
19
 
20
- The `@adyen/bento` plugin hasn't been tested in ESLint9 nor with the flat config (i.e. `eslint.config.js`).
20
+ ### Flat config recommended (`eslint.config.js`)
21
21
 
22
- ### Legacy Config (`.eslintrc`)
22
+ All rules are set to `warn`
23
23
 
24
24
  ```javascript
25
- module.exports = {
26
- extends: ['plugin:@adyen/bento/recommended'],
27
- rules: {
28
- // override/add rules settings here, such as:
29
- // '@adyen/bento/spacer-tokens': 'error',
25
+ const { defineConfig } = require('eslint/config');
26
+ const parser = require('vue-eslint-parser');
27
+ const bento = require('@adyen/eslint-plugin-bento');
28
+
29
+ module.exports = defineConfig([
30
+ {
31
+ // Other configs
30
32
  },
31
- };
33
+ ...bento.configs['vue-recommended'],
34
+ ]);
32
35
  ```
33
36
 
34
- or without the recommended config:
37
+ ### Flat config strict
38
+
39
+ All rules are set to `err`
40
+
41
+ ```javascript
42
+ const { defineConfig } = require('eslint/config');
43
+ const parser = require('vue-eslint-parser');
44
+ const bento = require('@adyen/eslint-plugin-bento');
45
+
46
+ module.exports = defineConfig([
47
+ {
48
+ // Other configs
49
+ },
50
+ ...bento.configs['vue-strict'],
51
+ ]);
52
+ ```
53
+
54
+ ### Custom
55
+
56
+ Without the recommended configs:
35
57
 
36
58
  ```javascript
37
- module.exports = {
38
- parser: 'vue-eslint-parser',
39
- plugins: ['@adyen/bento'],
40
- rules: {
41
- '@adyen/bento/vue-old-spacer-tokens': 'warn',
59
+ const { defineConfig } = require('eslint/config');
60
+ const vueParser = require('vue-eslint-parser');
61
+ const bento = require('@adyen/eslint-plugin-bento');
62
+
63
+ module.exports = defineConfig([
64
+ {
65
+ languageOptions: {
66
+ parser: vueParser,
67
+ },
68
+ plugins: {
69
+ '@adyen/bento': bento,
70
+ },
71
+ rules: {
72
+ '@adyen/bento/vue-old-spacer-tokens': 'warn',
73
+ '@adyen/bento/deprecation-currency-default-slot': 'warn'
74
+ '@adyen/bento/deprecation-tag-default-slot': 'warn'
75
+ },
76
+ files: ['**/*.vue'],
42
77
  },
43
- };
78
+ ]);
44
79
  ```
45
80
 
46
81
  ## Rules
@@ -53,7 +88,7 @@ Disallow the use of ADL space utility classes in favor of Bento _spacer_ utility
53
88
 
54
89
  The recommended configuration contains pre-configured rules and their severity
55
90
 
56
- - `@adyen/bento/vue-old-spacer-tokens`: `warn`
91
+ - `@adyen/bento/vue-old-spacer-tokens`: `warn`
57
92
 
58
93
  ### `@adyen/bento/deprecation-currency-default-slot`
59
94
 
@@ -63,7 +98,7 @@ Disallow the use of the `default` slot in `bento-currency` instances
63
98
 
64
99
  The recommended configuration contains pre-configured rules and their severity
65
100
 
66
- - `@adyen/bento/deprecation-currency-default-slot`: `warn`
101
+ - `@adyen/bento/deprecation-currency-default-slot`: `warn`
67
102
 
68
103
  ### `@adyen/bento/deprecation-tag-default-slot`
69
104
 
@@ -73,4 +108,4 @@ Disallow the use of the `default` slot in `bento-tag` instances
73
108
 
74
109
  The recommended configuration contains pre-configured rules and their severity
75
110
 
76
- - `@adyen/bento/deprecation-tag-default-slot`: `warn`
111
+ - `@adyen/bento/deprecation-tag-default-slot`: `warn`
@@ -0,0 +1,19 @@
1
+ module.exports = [
2
+ {
3
+ name: '@bento/adyen/recommended',
4
+ files: ['*.vue', '**/*.vue'],
5
+ languageOptions: {
6
+ parser: require('vue-eslint-parser'),
7
+ },
8
+ plugins: {
9
+ get '@adyen/bento'() {
10
+ return require('../index');
11
+ },
12
+ },
13
+ rules: {
14
+ '@adyen/bento/deprecation-currency-default-slot': 'warn',
15
+ '@adyen/bento/deprecation-tag-default-slot': 'warn',
16
+ '@adyen/bento/vue-old-spacer-tokens': 'warn',
17
+ },
18
+ },
19
+ ];
@@ -0,0 +1,19 @@
1
+ module.exports = [
2
+ {
3
+ name: '@bento/adyen/strict',
4
+ files: ['*.vue', '**/*.vue'],
5
+ languageOptions: {
6
+ parser: require('vue-eslint-parser'),
7
+ },
8
+ plugins: {
9
+ get '@adyen/bento'() {
10
+ return require('../index');
11
+ },
12
+ },
13
+ rules: {
14
+ '@adyen/bento/deprecation-currency-default-slot': 'error',
15
+ '@adyen/bento/deprecation-tag-default-slot': 'error',
16
+ '@adyen/bento/vue-old-spacer-tokens': 'error',
17
+ },
18
+ },
19
+ ];
package/index.js CHANGED
@@ -1,30 +1,20 @@
1
- const fs = require('fs');
2
- const deprecationCurrencyDefaultSlot = require('./rules/deprecation-currency-default-slot/deprecation-currency-default-slot');
3
- const deprecationTagDefaultSlot = require('./rules/deprecation-tag-default-slot/deprecation-tag-default-slot');
4
- const spacerTokens = require('./rules/vue-old-spacer-tokens/vue-old-spacer-tokens');
5
-
6
1
  // The package name and version must be in sync with 'package.json'
7
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
2
+ const pkg = require('./package.json');
8
3
 
9
- module.exports = {
4
+ const plugin = {
10
5
  meta: {
11
6
  name: pkg.name,
12
7
  version: pkg.version,
13
8
  },
14
9
  configs: {
15
- recommended: {
16
- parser: 'vue-eslint-parser',
17
- plugins: ['@adyen/bento'],
18
- rules: {
19
- '@adyen/bento/deprecation-currency-default-slot': 'warn',
20
- '@adyen/bento/deprecation-tag-default-slot': 'warn',
21
- '@adyen/bento/vue-old-spacer-tokens': 'warn',
22
- },
23
- },
10
+ 'vue-recommended': require('./configs/vue-recommended'),
11
+ 'vue-strict': require('./configs/vue-strict'),
24
12
  },
25
13
  rules: {
26
- 'deprecation-currency-default-slot': deprecationCurrencyDefaultSlot,
27
- 'deprecation-tag-default-slot': deprecationTagDefaultSlot,
28
- 'vue-old-spacer-tokens': spacerTokens,
14
+ 'deprecation-currency-default-slot': require('./rules/deprecation-currency-default-slot/deprecation-currency-default-slot'),
15
+ 'deprecation-tag-default-slot': require('./rules/deprecation-tag-default-slot/deprecation-tag-default-slot'),
16
+ 'vue-old-spacer-tokens': require('./rules/vue-old-spacer-tokens/vue-old-spacer-tokens'),
29
17
  },
30
18
  };
19
+
20
+ module.exports = plugin;
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@adyen/eslint-plugin-bento",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Adyen Bento ESLint rules",
5
5
  "main": "index.js",
6
6
  "files": [
7
+ "README.md",
8
+ "CHANGELOG.md",
9
+ "configs",
7
10
  "index.js",
8
11
  "rules/*",
9
12
  "utils/*",
@@ -22,21 +25,26 @@
22
25
  "jscodeshift": "17.1.2"
23
26
  },
24
27
  "devDependencies": {
28
+ "@eslint/js": "9.24.0",
29
+ "@types/eslint": "9.6.1",
25
30
  "@types/estree": "1.0.6",
26
31
  "@types/node": "20.17.24",
27
- "@types/eslint": "8.56.12",
32
+ "@typescript-eslint/eslint-plugin": "8.26.0",
33
+ "@typescript-eslint/parser": "8.26.0",
34
+ "@vitest/eslint-plugin": "1.1.25",
28
35
  "@vitest/coverage-v8": "2.1.9",
29
- "eslint": "8.57.1",
36
+ "eslint": "9.24.0",
37
+ "eslint-plugin-vue": "10.0.0",
38
+ "globals": "16.0.0",
30
39
  "vitest": "2.1.9",
31
- "eslint-plugin-vue": "9.25.0",
32
- "vue-eslint-parser": "9.3.2"
40
+ "vue-eslint-parser": "10.1.3"
33
41
  },
34
42
  "peerDependencies": {
35
- "eslint": "^8.0",
43
+ "eslint": "^9.0",
36
44
  "vue-eslint-parser": "^9.0"
37
45
  },
38
46
  "scripts": {
39
- "lint": "eslint -c ./.eslintrc.js ./ --exit-on-fatal-error",
47
+ "lint": "eslint -c ./eslint.config.js ./ --exit-on-fatal-error",
40
48
  "test": "vitest run --config ./vitest.config.ts",
41
49
  "test:coverage": "pnpm run test --coverage",
42
50
  "test:watch": "vitest watch"
@@ -0,0 +1,18 @@
1
+ const { defineConfig } = require('eslint/config');
2
+ const parser = require('vue-eslint-parser');
3
+ const adyenBento = require('@adyen/eslint-plugin-bento');
4
+
5
+ module.exports = defineConfig([
6
+ {
7
+ languageOptions: {
8
+ parser: parser,
9
+ },
10
+ plugins: {
11
+ '@adyen/bento': adyenBento,
12
+ },
13
+ rules: {
14
+ '@adyen/bento/deprecation-currency-default-slot': 'warn',
15
+ },
16
+ files: ['**/*.vue'],
17
+ },
18
+ ]);
@@ -7,7 +7,7 @@ const ESLINT = 'pnpm eslint';
7
7
  describe('@adyen/bento/deprecation-currency-default-slot', () => {
8
8
  it('should lint with warning', () => {
9
9
  // Load .eslintrc
10
- const eslintrc = path.resolve(__dirname, '__tests__', '.eslintrc.js');
10
+ const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
11
11
  // Load the test file
12
12
  const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-currency-default-slot.vue');
13
13
 
@@ -28,7 +28,7 @@ module.exports = {
28
28
 
29
29
  /** @param {RuleContext} context */
30
30
  create(context) {
31
- const sourceCode = context.getSourceCode();
31
+ const sourceCode = context.sourceCode;
32
32
 
33
33
  const template =
34
34
  sourceCode.parserServices.getTemplateBodyTokenStore &&
@@ -1,8 +1,11 @@
1
1
  import { RuleTester } from 'eslint';
2
+ import vueParser from 'vue-eslint-parser';
2
3
  import deprecationCurrencyDefaultSlot from './deprecation-currency-default-slot';
3
4
 
4
5
  const ruleTester = new RuleTester({
5
- parser: require.resolve('vue-eslint-parser'),
6
+ languageOptions: {
7
+ parser: vueParser,
8
+ },
6
9
  });
7
10
 
8
11
  describe('@adyen/bento/deprecation-currency-default-slot should suggest the usage of "label" property instead of "default" slot', () => {
@@ -0,0 +1,18 @@
1
+ const { defineConfig } = require('eslint/config');
2
+ const parser = require('vue-eslint-parser');
3
+ const adyenBento = require('@adyen/eslint-plugin-bento');
4
+
5
+ module.exports = defineConfig([
6
+ {
7
+ languageOptions: {
8
+ parser: parser,
9
+ },
10
+ plugins: {
11
+ '@adyen/bento': adyenBento,
12
+ },
13
+ rules: {
14
+ '@adyen/bento/deprecation-tag-default-slot': 'warn',
15
+ },
16
+ files: ['**/*.vue'],
17
+ },
18
+ ]);
@@ -7,7 +7,7 @@ const ESLINT = 'pnpm eslint';
7
7
  describe('@adyen/bento/deprecation-tag-default-slot', () => {
8
8
  it('should lint with warning', () => {
9
9
  // Load .eslintrc
10
- const eslintrc = path.resolve(__dirname, '__tests__', '.eslintrc.js');
10
+ const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
11
11
  // Load the test file
12
12
  const vueFile = path.resolve(__dirname, '__tests__', 'deprecation-tag-default-slot.vue');
13
13
 
@@ -28,7 +28,7 @@ module.exports = {
28
28
 
29
29
  /** @param {RuleContext} context */
30
30
  create(context) {
31
- const sourceCode = context.getSourceCode();
31
+ const sourceCode = context.sourceCode;
32
32
  const template =
33
33
  sourceCode.parserServices.getTemplateBodyTokenStore &&
34
34
  sourceCode.parserServices.getTemplateBodyTokenStore();
@@ -1,8 +1,11 @@
1
1
  import { RuleTester } from 'eslint';
2
+ import vueParser from 'vue-eslint-parser';
2
3
  import deprecationTagDefaultSlot from './deprecation-tag-default-slot';
3
4
 
4
5
  const ruleTester = new RuleTester({
5
- parser: require.resolve('vue-eslint-parser'),
6
+ languageOptions: {
7
+ parser: vueParser,
8
+ },
6
9
  });
7
10
 
8
11
  describe('@adyen/bento/deprecation-tag-default-slot should suggest the usage of "label" property instead of "default" slot', () => {
@@ -0,0 +1,18 @@
1
+ const { defineConfig } = require('eslint/config');
2
+ const parser = require('vue-eslint-parser');
3
+ const adyenBento = require('@adyen/eslint-plugin-bento');
4
+
5
+ module.exports = defineConfig([
6
+ {
7
+ languageOptions: {
8
+ parser: parser,
9
+ },
10
+ plugins: {
11
+ '@adyen/bento': adyenBento,
12
+ },
13
+ rules: {
14
+ '@adyen/bento/vue-old-spacer-tokens': 'warn',
15
+ },
16
+ files: ['**/*.vue'],
17
+ },
18
+ ]);
@@ -6,8 +6,8 @@ const ESLINT = 'pnpm eslint';
6
6
 
7
7
  describe('@adyen/bento/vue-old-spacer-tokens', () => {
8
8
  it('should lint with warning', () => {
9
- // Load .eslintrc
10
- const eslintrc = path.resolve(__dirname, '__tests__', '.eslintrc.js');
9
+ // Load eslint.config
10
+ const eslintrc = path.resolve(__dirname, '__tests__', 'eslint.config.js');
11
11
  // Load the test file
12
12
  const vueFile = path.resolve(__dirname, '__tests__', 'vue-old-spacer-tokens.vue');
13
13
 
@@ -5,7 +5,7 @@
5
5
  * @typedef {import('estree').Node} Node
6
6
  */
7
7
  /**
8
- * @typedef {import('vue-eslint-parser/ast').VLiteral} VLiteral
8
+ * @typedef {import('vue-eslint-parser').AST.VLiteral} VLiteral
9
9
  */
10
10
  /**
11
11
  * @typedef {import('eslint-plugin-vue/lib/utils').RuleModule} RuleModule
@@ -59,7 +59,6 @@ module.exports = {
59
59
  const regexPaddingMargin = /\bu-(padding|margin)\b/g;
60
60
  if (regexPaddingMargin.test(cssClass)) {
61
61
  // Loop through the list of classes and replace them
62
- // eslint-disable-next-line no-restricted-syntax
63
62
  for (const [oldClass, newClass] of Object.entries(CLASS_MAP)) {
64
63
  // Check if the utility can be fixed/re-mapped
65
64
  // by checking if the digit has a Bento counterpart
@@ -1,8 +1,11 @@
1
1
  import { RuleTester } from 'eslint';
2
+ import vueParser from 'vue-eslint-parser';
2
3
  import spacerTokens from './vue-old-spacer-tokens';
3
4
 
4
5
  const ruleTester = new RuleTester({
5
- parser: require.resolve('vue-eslint-parser'),
6
+ languageOptions: {
7
+ parser: vueParser,
8
+ },
6
9
  });
7
10
 
8
11
  describe('@adyen/bento/vue-old-spacer-tokens should suggest a Bento alternative to ADL classes', () => {
@@ -6,8 +6,8 @@ const j = require('jscodeshift');
6
6
  */
7
7
 
8
8
  /**
9
- * @typedef {import('vue-eslint-parser/ast').VText} VText
10
- * @typedef {import('vue-eslint-parser/ast').VExpressionContainer} VExpressionContainer
9
+ * @typedef {import('vue-eslint-parser').AST.VText} VText
10
+ * @typedef {import('vue-eslint-parser').AST.VExpressionContainer} VExpressionContainer
11
11
  */
12
12
 
13
13
  /**
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- env: { es2021: true },
3
- parser: 'vue-eslint-parser',
4
- plugins: ['@adyen/bento'],
5
- rules: {
6
- '@adyen/bento/deprecation-currency-default-slot': 'warn',
7
- },
8
- };
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- env: { es2021: true },
3
- parser: 'vue-eslint-parser',
4
- plugins: ['@adyen/bento'],
5
- rules: {
6
- '@adyen/bento/deprecation-tag-default-slot': 'warn',
7
- },
8
- };
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- env: { es2021: true },
3
- parser: 'vue-eslint-parser',
4
- plugins: ['@adyen/bento'],
5
- rules: {
6
- '@adyen/bento/vue-old-spacer-tokens': 'warn',
7
- },
8
- };