@boehringer-ingelheim/eslint-config 2.0.0 → 3.1.0-next.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/README.md +1 -1
- package/base/index.js +30 -20
- package/package.json +11 -11
- package/react/index.js +32 -29
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-
|
|
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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { SORT_IMPORTS_GROUPS } = require("../lib/eslint-plugin-perfectionist");
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
3
5
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
@@ -15,6 +17,7 @@ module.exports = {
|
|
|
15
17
|
"plugin:@typescript-eslint/stylistic-type-checked",
|
|
16
18
|
"plugin:import/recommended",
|
|
17
19
|
"plugin:import/typescript",
|
|
20
|
+
"plugin:perfectionist/recommended-natural",
|
|
18
21
|
"plugin:sonarjs/recommended",
|
|
19
22
|
],
|
|
20
23
|
overrides: [
|
|
@@ -34,9 +37,10 @@ module.exports = {
|
|
|
34
37
|
// find the tsconfig.json nearest each source file
|
|
35
38
|
project: true,
|
|
36
39
|
},
|
|
37
|
-
plugins: ["@typescript-eslint", "sonarjs"
|
|
40
|
+
plugins: ["@typescript-eslint", "sonarjs"],
|
|
38
41
|
rules: {
|
|
39
42
|
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
|
|
43
|
+
"@typescript-eslint/adjacent-overload-signatures": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
40
44
|
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
|
|
41
45
|
"@typescript-eslint/no-misused-promises": [
|
|
42
46
|
"error",
|
|
@@ -52,7 +56,7 @@ module.exports = {
|
|
|
52
56
|
varsIgnorePattern: "^_",
|
|
53
57
|
},
|
|
54
58
|
],
|
|
55
|
-
"@typescript-eslint/sort-type-constituents": "
|
|
59
|
+
"@typescript-eslint/sort-type-constituents": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
56
60
|
|
|
57
61
|
// eslint: https://github.com/eslint/eslint/tree/main/lib/rules
|
|
58
62
|
"arrow-body-style": ["error", "as-needed"],
|
|
@@ -75,6 +79,8 @@ module.exports = {
|
|
|
75
79
|
"prefer-const": "error",
|
|
76
80
|
"prefer-rest-params": "error",
|
|
77
81
|
"prefer-template": "error",
|
|
82
|
+
"sort-imports": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
83
|
+
"sort-keys": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
78
84
|
|
|
79
85
|
// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
|
|
80
86
|
"import/no-cycle": "error",
|
|
@@ -86,30 +92,34 @@ module.exports = {
|
|
|
86
92
|
unusedExports: true,
|
|
87
93
|
},
|
|
88
94
|
],
|
|
89
|
-
"import/order":
|
|
90
|
-
"error",
|
|
91
|
-
{
|
|
92
|
-
alphabetize: {
|
|
93
|
-
caseInsensitive: true,
|
|
94
|
-
order: "asc",
|
|
95
|
-
orderImportKind: "asc",
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
],
|
|
95
|
+
"import/order": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
99
96
|
"import/prefer-default-export": "off",
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
98
|
+
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
|
|
99
|
+
"perfectionist/sort-array-includes": ["error", { "ignore-case": true, type: "natural" }],
|
|
100
|
+
"perfectionist/sort-astro-attributes": ["error", { "ignore-case": true, type: "natural" }],
|
|
101
|
+
"perfectionist/sort-classes": ["error", { "ignore-case": true, type: "natural" }],
|
|
102
|
+
"perfectionist/sort-enums": ["error", { "ignore-case": true, type: "natural" }],
|
|
103
|
+
"perfectionist/sort-exports": ["error", { "ignore-case": true, type: "natural" }],
|
|
104
|
+
"perfectionist/sort-imports": [
|
|
106
105
|
"error",
|
|
107
|
-
"asc",
|
|
108
106
|
{
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
groups: SORT_IMPORTS_GROUPS,
|
|
108
|
+
"ignore-case": true,
|
|
109
|
+
"newlines-between": "ignore",
|
|
110
|
+
type: "natural",
|
|
111
111
|
},
|
|
112
112
|
],
|
|
113
|
+
"perfectionist/sort-interfaces": ["error", { "ignore-case": true, type: "natural" }],
|
|
114
|
+
"perfectionist/sort-jsx-props": ["error", { "ignore-case": true, type: "natural" }],
|
|
115
|
+
"perfectionist/sort-maps": ["error", { "ignore-case": true, type: "natural" }],
|
|
116
|
+
"perfectionist/sort-named-exports": ["error", { "ignore-case": true, type: "natural" }],
|
|
117
|
+
"perfectionist/sort-named-imports": ["error", { "ignore-case": true, type: "natural" }],
|
|
118
|
+
"perfectionist/sort-object-types": ["error", { "ignore-case": true, type: "natural" }],
|
|
119
|
+
"perfectionist/sort-objects": ["error", { "ignore-case": true, "partition-by-comment": true, type: "natural" }],
|
|
120
|
+
"perfectionist/sort-svelte-attributes": ["error", { "ignore-case": true, type: "natural" }],
|
|
121
|
+
"perfectionist/sort-union-types": ["error", { "ignore-case": true, type: "natural" }],
|
|
122
|
+
"perfectionist/sort-vue-attributes": ["error", { "ignore-case": true, type: "natural" }],
|
|
113
123
|
},
|
|
114
124
|
settings: {
|
|
115
125
|
"import/resolver": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boehringer-ingelheim/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0-next.1",
|
|
4
4
|
"description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"boehringer",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@rushstack/eslint-patch": "^1.3.3",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
34
|
-
"@typescript-eslint/parser": "^6.
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
34
|
+
"@typescript-eslint/parser": "^6.7.0",
|
|
35
35
|
"eslint-import-resolver-typescript": "^3.6.0",
|
|
36
|
-
"eslint-plugin-import": "^2.28.
|
|
36
|
+
"eslint-plugin-import": "^2.28.1",
|
|
37
37
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
38
|
-
"eslint-plugin-
|
|
39
|
-
"eslint-plugin-
|
|
38
|
+
"eslint-plugin-perfectionist": "^2.1.0",
|
|
39
|
+
"eslint-plugin-playwright": "^0.16.0",
|
|
40
|
+
"eslint-plugin-react": "^7.33.2",
|
|
40
41
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
41
|
-
"eslint-plugin-sonarjs": "^0.
|
|
42
|
-
"eslint-plugin-sort-keys-plus": "^1.3.1",
|
|
42
|
+
"eslint-plugin-sonarjs": "^0.21.0",
|
|
43
43
|
"eslint-plugin-typescript-enum": "^2.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@commitlint/types": "17.4.4",
|
|
50
50
|
"@semantic-release/changelog": "6.0.3",
|
|
51
51
|
"@semantic-release/git": "10.0.1",
|
|
52
|
-
"dotenv-cli": "7.
|
|
52
|
+
"dotenv-cli": "7.3.0",
|
|
53
53
|
"husky": "8.0.3",
|
|
54
|
-
"prettier": "3.0.
|
|
55
|
-
"semantic-release": "21.
|
|
54
|
+
"prettier": "3.0.3",
|
|
55
|
+
"semantic-release": "21.1.1"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/react/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { SORT_IMPORTS_GROUPS } = require("../lib/eslint-plugin-perfectionist");
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
3
5
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
@@ -43,44 +45,45 @@ module.exports = {
|
|
|
43
45
|
],
|
|
44
46
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
45
47
|
|
|
46
|
-
// eslint-plugin-
|
|
47
|
-
"
|
|
48
|
+
// eslint-plugin-react: https://github.com/jsx-eslint/eslint-plugin-react/tree/master/lib/rules
|
|
49
|
+
"react/jsx-pascal-case": "error",
|
|
50
|
+
"react/jsx-sort-props": "off", // disabled due to conflict with eslint-plugin-perfectionist
|
|
51
|
+
"react/sort-default-props": "error",
|
|
52
|
+
|
|
53
|
+
// eslint-plugin-react-hooks: https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md
|
|
54
|
+
"react-hooks/exhaustive-deps": "error",
|
|
55
|
+
"react-hooks/rules-of-hooks": "error",
|
|
56
|
+
|
|
57
|
+
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
|
|
58
|
+
"perfectionist/sort-imports": [
|
|
48
59
|
"error",
|
|
49
60
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
group: "external",
|
|
58
|
-
pattern: "react",
|
|
59
|
-
position: "before",
|
|
61
|
+
"custom-groups": {
|
|
62
|
+
type: {
|
|
63
|
+
react: ["react"],
|
|
64
|
+
},
|
|
65
|
+
value: {
|
|
66
|
+
react: ["react"],
|
|
60
67
|
},
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
},
|
|
69
|
+
groups: ["react", ...SORT_IMPORTS_GROUPS],
|
|
70
|
+
"ignore-case": true,
|
|
71
|
+
"newlines-between": "ignore",
|
|
72
|
+
type: "natural",
|
|
63
73
|
},
|
|
64
74
|
],
|
|
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": [
|
|
75
|
+
"perfectionist/sort-jsx-props": [
|
|
69
76
|
"error",
|
|
70
77
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
"custom-groups": {
|
|
79
|
+
callback: "on*",
|
|
80
|
+
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
|
|
81
|
+
},
|
|
82
|
+
groups: ["reservedProps", "unknown", "callback"],
|
|
83
|
+
"ignore-case": true,
|
|
84
|
+
type: "natural",
|
|
77
85
|
},
|
|
78
86
|
],
|
|
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
87
|
},
|
|
85
88
|
settings: {
|
|
86
89
|
react: {
|