@boehringer-ingelheim/eslint-config 1.1.4 → 3.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/README.md CHANGED
@@ -71,7 +71,7 @@ The following plugins are used in this configuration:
71
71
  - [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import)
72
72
  - [`eslint-plugin-sonarjs`](https://github.com/SonarSource/eslint-plugin-sonarjs)
73
73
 
74
- Additionally, the [`eslint-plugin-sort-keys-plus`](https://github.com/forivall/eslint-plugin-sort-keys-plus) is used to automatically fix sorting issues.
74
+ Additionally, the [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) is used to automatically fix sorting issues.
75
75
 
76
76
  This configuration also sets up the TypeScript parser [`@typescript-eslint/parser`](https://typescript-eslint.io/architecture/parser) and [`eslint-import-resolver-typescript`](https://github.com/import-js/eslint-import-resolver-typescript). The TypeScript project file `./tsconfig.json` is set as default value for the project option in the parser configuration. If this is not the case, this must be changed accordingly:
77
77
 
package/base/index.js CHANGED
@@ -11,10 +11,11 @@ module.exports = {
11
11
  },
12
12
  extends: [
13
13
  "eslint:recommended",
14
- "plugin:@typescript-eslint/recommended",
15
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
14
+ "plugin:@typescript-eslint/recommended-type-checked",
15
+ "plugin:@typescript-eslint/stylistic-type-checked",
16
16
  "plugin:import/recommended",
17
17
  "plugin:import/typescript",
18
+ "plugin:perfectionist/recommended-natural",
18
19
  "plugin:sonarjs/recommended",
19
20
  ],
20
21
  overrides: [
@@ -34,9 +35,10 @@ module.exports = {
34
35
  // find the tsconfig.json nearest each source file
35
36
  project: true,
36
37
  },
37
- plugins: ["@typescript-eslint", "sonarjs", "sort-keys-plus"],
38
+ plugins: ["@typescript-eslint", "sonarjs"],
38
39
  rules: {
39
40
  // @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
41
+ "@typescript-eslint/adjacent-overload-signatures": "off", // disabled due to conflict with eslint-plugin-perfectionist
40
42
  "@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
41
43
  "@typescript-eslint/no-misused-promises": [
42
44
  "error",
@@ -52,7 +54,7 @@ module.exports = {
52
54
  varsIgnorePattern: "^_",
53
55
  },
54
56
  ],
55
- "@typescript-eslint/sort-type-constituents": "error",
57
+ "@typescript-eslint/sort-type-constituents": "off", // disabled due to conflict with eslint-plugin-perfectionist
56
58
 
57
59
  // eslint: https://github.com/eslint/eslint/tree/main/lib/rules
58
60
  "arrow-body-style": ["error", "as-needed"],
@@ -75,6 +77,8 @@ module.exports = {
75
77
  "prefer-const": "error",
76
78
  "prefer-rest-params": "error",
77
79
  "prefer-template": "error",
80
+ "sort-imports": "off", // disabled due to conflict with eslint-plugin-perfectionist
81
+ "sort-keys": "off", // disabled due to conflict with eslint-plugin-perfectionist
78
82
 
79
83
  // eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
80
84
  "import/no-cycle": "error",
@@ -86,28 +90,20 @@ module.exports = {
86
90
  unusedExports: true,
87
91
  },
88
92
  ],
89
- "import/order": [
93
+ "import/order": "off", // disabled due to conflict with eslint-plugin-perfectionist
94
+ "import/prefer-default-export": "off",
95
+
96
+ // eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
97
+ "perfectionist/sort-imports": [
90
98
  "error",
91
99
  {
92
- alphabetize: {
93
- caseInsensitive: true,
94
- order: "asc",
95
- orderImportKind: "asc",
96
- },
100
+ "newlines-between": "ignore",
97
101
  },
98
102
  ],
99
- "import/prefer-default-export": "off",
100
-
101
- /**
102
- * Required to fix sort-keys automatically, since this is not done by default.
103
- * See: https://github.com/forivall/eslint-plugin-sort-keys-plus
104
- */
105
- "sort-keys-plus/sort-keys": [
103
+ "perfectionist/sort-objects": [
106
104
  "error",
107
- "asc",
108
105
  {
109
- caseSensitive: false,
110
- natural: true,
106
+ "partition-by-comment": true,
111
107
  },
112
108
  ],
113
109
  },
package/base/strict.js CHANGED
@@ -6,5 +6,5 @@ require("@rushstack/eslint-patch/modern-module-resolution");
6
6
 
7
7
  /** @type {import('eslint').ESLint.ConfigData} */
8
8
  module.exports = {
9
- extends: ["./index.js", "plugin:@typescript-eslint/strict"],
9
+ extends: ["./index.js", "plugin:@typescript-eslint/strict-type-checked"],
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boehringer-ingelheim/eslint-config",
3
- "version": "1.1.4",
3
+ "version": "3.0.0",
4
4
  "description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
5
5
  "keywords": [
6
6
  "boehringer",
@@ -29,29 +29,29 @@
29
29
  "eslint": "^8.34.0"
30
30
  },
31
31
  "dependencies": {
32
- "@rushstack/eslint-patch": "^1.3.0",
33
- "@typescript-eslint/eslint-plugin": "^5.59.8",
34
- "@typescript-eslint/parser": "^5.59.8",
35
- "eslint-import-resolver-typescript": "^3.5.5",
36
- "eslint-plugin-import": "^2.27.5",
32
+ "@rushstack/eslint-patch": "^1.3.3",
33
+ "@typescript-eslint/eslint-plugin": "^6.3.0",
34
+ "@typescript-eslint/parser": "^6.3.0",
35
+ "eslint-import-resolver-typescript": "^3.6.0",
36
+ "eslint-plugin-import": "^2.28.0",
37
37
  "eslint-plugin-jsx-a11y": "^6.7.1",
38
- "eslint-plugin-playwright": "^0.12.0",
39
- "eslint-plugin-react": "^7.32.2",
38
+ "eslint-plugin-perfectionist": "^2.1.0",
39
+ "eslint-plugin-playwright": "^0.15.3",
40
+ "eslint-plugin-react": "^7.33.1",
40
41
  "eslint-plugin-react-hooks": "^4.6.0",
41
- "eslint-plugin-sonarjs": "^0.19.0",
42
- "eslint-plugin-sort-keys-plus": "^1.3.1",
42
+ "eslint-plugin-sonarjs": "^0.20.0",
43
43
  "eslint-plugin-typescript-enum": "^2.1.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@boehringer-ingelheim/prettier-config": "1.0.0",
47
- "@commitlint/cli": "17.6.5",
48
- "@commitlint/config-conventional": "17.6.5",
47
+ "@commitlint/cli": "17.7.1",
48
+ "@commitlint/config-conventional": "17.7.0",
49
49
  "@commitlint/types": "17.4.4",
50
50
  "@semantic-release/changelog": "6.0.3",
51
51
  "@semantic-release/git": "10.0.1",
52
52
  "dotenv-cli": "7.2.1",
53
53
  "husky": "8.0.3",
54
- "prettier": "2.8.8",
55
- "semantic-release": "21.0.2"
54
+ "prettier": "3.0.1",
55
+ "semantic-release": "21.0.7"
56
56
  }
57
57
  }
package/react/index.js CHANGED
@@ -43,44 +43,52 @@ module.exports = {
43
43
  ],
44
44
  "@typescript-eslint/consistent-type-definitions": ["error", "type"],
45
45
 
46
- // eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
47
- "import/order": [
46
+ // eslint-plugin-react: https://github.com/jsx-eslint/eslint-plugin-react/tree/master/lib/rules
47
+ "react/jsx-pascal-case": "error",
48
+ "react/jsx-sort-props": "off", // disabled due to conflict with eslint-plugin-perfectionist
49
+ "react/sort-default-props": "error",
50
+
51
+ // eslint-plugin-react-hooks: https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md
52
+ "react-hooks/exhaustive-deps": "error",
53
+ "react-hooks/rules-of-hooks": "error",
54
+
55
+ // eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
56
+ "perfectionist/sort-imports": [
48
57
  "error",
49
58
  {
50
- alphabetize: {
51
- caseInsensitive: true,
52
- order: "asc",
53
- orderImportKind: "asc",
54
- },
55
- pathGroups: [
56
- {
57
- group: "external",
58
- pattern: "react",
59
- position: "before",
59
+ "custom-groups": {
60
+ type: {
61
+ react: ["react"],
62
+ },
63
+ value: {
64
+ react: ["react"],
60
65
  },
66
+ },
67
+ groups: [
68
+ "react",
69
+ // Groups from shared config: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#groups
70
+ "type",
71
+ ["builtin", "external"],
72
+ "internal-type",
73
+ "internal",
74
+ ["parent-type", "sibling-type", "index-type"],
75
+ ["parent", "sibling", "index"],
76
+ "object",
77
+ "unknown",
61
78
  ],
62
- pathGroupsExcludedImportTypes: ["react"],
79
+ "newlines-between": "ignore",
63
80
  },
64
81
  ],
65
-
66
- // eslint-plugin-react: https://github.com/jsx-eslint/eslint-plugin-react/tree/master/lib/rules
67
- "react/jsx-pascal-case": "error",
68
- "react/jsx-sort-props": [
82
+ "perfectionist/sort-jsx-props": [
69
83
  "error",
70
84
  {
71
- callbacksLast: true,
72
- ignoreCase: true,
73
- noSortAlphabetically: false,
74
- reservedFirst: true,
75
- shorthandFirst: false,
76
- shorthandLast: false,
85
+ "custom-groups": {
86
+ callback: "on*",
87
+ reservedProps: ["children", "dangerouslySetInnerHTML", "key", "ref"], // Reserved props from: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/jsx-sort-props.js#L40C12-L40C12
88
+ },
89
+ groups: ["reservedProps", "unknown", "callback"],
77
90
  },
78
91
  ],
79
- "react/sort-default-props": "error",
80
-
81
- // eslint-plugin-react-hooks: https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md
82
- "react-hooks/exhaustive-deps": "error",
83
- "react-hooks/rules-of-hooks": "error",
84
92
  },
85
93
  settings: {
86
94
  react: {