@boehringer-ingelheim/eslint-config 5.0.1 → 5.0.2
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 +9 -9
- package/base/index.js +79 -79
- package/base/local.js +6 -6
- package/base/strict.js +14 -5
- package/lib/eslint-plugin-perfectionist.js +17 -17
- package/package.json +12 -12
- package/playwright/index.js +5 -5
- package/react/index.js +41 -41
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Create or update the `.eslintrc.js` file in your projects root directory accordi
|
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
module.exports = {
|
|
28
|
-
extends: [
|
|
28
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict'],
|
|
29
29
|
};
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -35,9 +35,9 @@ This is not recommended as the goal is to have similar code stylings in all proj
|
|
|
35
35
|
|
|
36
36
|
```js
|
|
37
37
|
module.exports = {
|
|
38
|
-
extends: [
|
|
38
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict'],
|
|
39
39
|
rules: {
|
|
40
|
-
|
|
40
|
+
'no-empty-function': 'off',
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
```
|
|
@@ -59,7 +59,7 @@ Opinionated Options that differ from the standard/recommended eslint configurati
|
|
|
59
59
|
|
|
60
60
|
```js
|
|
61
61
|
module.exports = {
|
|
62
|
-
extends: [
|
|
62
|
+
extends: ['@boehringer-ingelheim/eslint-config/base'],
|
|
63
63
|
};
|
|
64
64
|
```
|
|
65
65
|
|
|
@@ -79,7 +79,7 @@ This configuration also sets up the TypeScript parser [`@typescript-eslint/parse
|
|
|
79
79
|
module.exports = {
|
|
80
80
|
parserOptions: {
|
|
81
81
|
// Use `tsconfing.dev.json` as typescript project configuration, see: https://typescript-eslint.io/architecture/parser/#project
|
|
82
|
-
project:
|
|
82
|
+
project: './tsconfig.dev.json',
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
85
|
```
|
|
@@ -88,7 +88,7 @@ module.exports = {
|
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
90
|
module.exports = {
|
|
91
|
-
extends: [
|
|
91
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict', '@boehringer-ingelheim/eslint-config/base/local'],
|
|
92
92
|
};
|
|
93
93
|
```
|
|
94
94
|
|
|
@@ -98,7 +98,7 @@ This shared ESLint configuration configures or disables some rules for a better
|
|
|
98
98
|
|
|
99
99
|
```js
|
|
100
100
|
module.exports = {
|
|
101
|
-
extends: [
|
|
101
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict'],
|
|
102
102
|
};
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -108,7 +108,7 @@ This shared ESLint configuration extends the `@boehringer-ingelheim/eslint-confi
|
|
|
108
108
|
|
|
109
109
|
```js
|
|
110
110
|
module.exports = {
|
|
111
|
-
extends: [
|
|
111
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict', '@boehringer-ingelheim/eslint-config/react'],
|
|
112
112
|
};
|
|
113
113
|
```
|
|
114
114
|
|
|
@@ -125,7 +125,7 @@ The configuration sets several custom rules, including `@typescript-eslint/ban-t
|
|
|
125
125
|
|
|
126
126
|
```js
|
|
127
127
|
module.exports = {
|
|
128
|
-
extends: [
|
|
128
|
+
extends: ['@boehringer-ingelheim/eslint-config/base/strict', '@boehringer-ingelheim/eslint-config/playwright'],
|
|
129
129
|
};
|
|
130
130
|
```
|
|
131
131
|
|
package/base/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const { SORT_CLASSES_GROUPS, SORT_IMPORTS_GROUPS } = require(
|
|
1
|
+
const { SORT_CLASSES_GROUPS, SORT_IMPORTS_GROUPS } = require('../lib/eslint-plugin-perfectionist');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
5
5
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
6
6
|
*/
|
|
7
|
-
require(
|
|
7
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
8
8
|
|
|
9
9
|
/** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData['parserOptions'] & import('@typescript-eslint/parser').ParserOptions } } */
|
|
10
10
|
module.exports = {
|
|
@@ -12,126 +12,126 @@ module.exports = {
|
|
|
12
12
|
es2022: true,
|
|
13
13
|
},
|
|
14
14
|
extends: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
'eslint:recommended',
|
|
16
|
+
'plugin:@typescript-eslint/recommended-type-checked',
|
|
17
|
+
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
18
|
+
'plugin:import/recommended',
|
|
19
|
+
'plugin:import/typescript',
|
|
20
|
+
'plugin:perfectionist/recommended-natural',
|
|
21
|
+
'plugin:sonarjs/recommended-legacy',
|
|
22
22
|
],
|
|
23
23
|
overrides: [
|
|
24
24
|
{
|
|
25
25
|
files: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
'**/*.d.ts', // TypeScript declaration files
|
|
27
|
+
'**/*.{spec,test}.*', // Usually test files
|
|
28
|
+
'./*.{js,cjs,mjs,ts,cts,mts}', // Mostly configuration files on root level
|
|
29
29
|
],
|
|
30
30
|
rules: {
|
|
31
|
-
|
|
31
|
+
'import/no-unused-modules': 'off',
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
|
-
parser:
|
|
35
|
+
parser: '@typescript-eslint/parser',
|
|
36
36
|
parserOptions: {
|
|
37
37
|
// find the tsconfig.json nearest each source file
|
|
38
38
|
project: true,
|
|
39
39
|
},
|
|
40
|
-
plugins: [
|
|
40
|
+
plugins: ['@typescript-eslint', 'sonarjs'],
|
|
41
41
|
// Warn about unused eslint-disable directives
|
|
42
42
|
reportUnusedDisableDirectives: true,
|
|
43
43
|
rules: {
|
|
44
44
|
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
'@typescript-eslint/adjacent-overload-signatures': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
46
|
+
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
|
47
|
+
'@typescript-eslint/no-misused-promises': [
|
|
48
|
+
'error',
|
|
49
49
|
{
|
|
50
50
|
checksVoidReturn: false,
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
'@typescript-eslint/no-unused-vars': [
|
|
54
|
+
'error',
|
|
55
55
|
{
|
|
56
|
-
argsIgnorePattern:
|
|
57
|
-
caughtErrorsIgnorePattern:
|
|
58
|
-
varsIgnorePattern:
|
|
56
|
+
argsIgnorePattern: '^_',
|
|
57
|
+
caughtErrorsIgnorePattern: '^_',
|
|
58
|
+
varsIgnorePattern: '^_',
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
|
-
|
|
61
|
+
'@typescript-eslint/sort-type-constituents': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
62
62
|
|
|
63
63
|
// eslint: https://github.com/eslint/eslint/tree/main/lib/rules
|
|
64
|
-
|
|
65
|
-
camelcase:
|
|
66
|
-
curly:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
eqeqeq:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
64
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
65
|
+
camelcase: 'warn',
|
|
66
|
+
curly: 'error',
|
|
67
|
+
'default-case': 'error',
|
|
68
|
+
'dot-notation': ['error', { allowPattern: '^[a-z]+(_[a-z]+)+$' }],
|
|
69
|
+
eqeqeq: 'error',
|
|
70
|
+
'logical-assignment-operators': ['error', 'never'],
|
|
71
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
72
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
73
|
+
'no-empty-function': 'error',
|
|
74
|
+
'no-lonely-if': 'error',
|
|
75
|
+
'no-negated-condition': 'error',
|
|
76
|
+
'no-nested-ternary': 'error',
|
|
77
|
+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
78
|
+
'no-unneeded-ternary': 'error',
|
|
79
|
+
'no-useless-concat': 'error',
|
|
80
|
+
'operator-assignment': ['error', 'never'],
|
|
81
|
+
'prefer-const': 'error',
|
|
82
|
+
'prefer-rest-params': 'error',
|
|
83
|
+
'prefer-template': 'error',
|
|
84
|
+
'sort-imports': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
85
|
+
'sort-keys': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
86
86
|
|
|
87
87
|
// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
'import/no-cycle': 'error',
|
|
89
|
+
'import/no-unused-modules': [
|
|
90
|
+
'error',
|
|
91
91
|
{
|
|
92
92
|
missingExports: true,
|
|
93
|
-
src: [
|
|
93
|
+
src: ['.'],
|
|
94
94
|
unusedExports: true,
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
'import/order': 'off', // disabled due to conflict with eslint-plugin-perfectionist
|
|
98
|
+
'import/prefer-default-export': 'off',
|
|
99
99
|
|
|
100
100
|
// Deactivated as TypeScript provides the same checks as part of standard type checking: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
'import/default': 'off',
|
|
102
|
+
'import/named': 'off',
|
|
103
|
+
'import/namespace': 'off',
|
|
104
|
+
'import/no-named-as-default-member': 'off',
|
|
105
105
|
|
|
106
106
|
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
'perfectionist/sort-array-includes': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
108
|
+
'perfectionist/sort-astro-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
109
|
+
'perfectionist/sort-classes': ['error', { groups: SORT_CLASSES_GROUPS, 'ignore-case': true, type: 'natural' }],
|
|
110
|
+
'perfectionist/sort-enums': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
111
|
+
'perfectionist/sort-exports': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
112
|
+
'perfectionist/sort-imports': [
|
|
113
|
+
'error',
|
|
114
114
|
{
|
|
115
115
|
groups: SORT_IMPORTS_GROUPS,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
type:
|
|
116
|
+
'ignore-case': true,
|
|
117
|
+
'newlines-between': 'ignore',
|
|
118
|
+
type: 'natural',
|
|
119
119
|
},
|
|
120
120
|
],
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
'perfectionist/sort-interfaces': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
122
|
+
'perfectionist/sort-intersection-types': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
123
|
+
'perfectionist/sort-jsx-props': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
124
|
+
'perfectionist/sort-maps': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
125
|
+
'perfectionist/sort-named-exports': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
126
|
+
'perfectionist/sort-named-imports': ['error', { 'ignore-alias': true, 'ignore-case': true, type: 'natural' }],
|
|
127
|
+
'perfectionist/sort-object-types': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
128
|
+
'perfectionist/sort-objects': ['error', { 'ignore-case': true, 'partition-by-comment': true, type: 'natural' }],
|
|
129
|
+
'perfectionist/sort-svelte-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
130
|
+
'perfectionist/sort-union-types': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
131
|
+
'perfectionist/sort-vue-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
|
|
132
132
|
},
|
|
133
133
|
settings: {
|
|
134
|
-
|
|
134
|
+
'import/resolver': {
|
|
135
135
|
typescript: true,
|
|
136
136
|
},
|
|
137
137
|
},
|
package/base/local.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
3
3
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
4
4
|
*/
|
|
5
|
-
require(
|
|
5
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
6
6
|
|
|
7
|
-
const isCI = require(
|
|
7
|
+
const isCI = require('is-ci');
|
|
8
8
|
|
|
9
9
|
/** @type {import('eslint').ESLint.ConfigData} */
|
|
10
10
|
module.exports = {
|
|
@@ -12,9 +12,9 @@ module.exports = {
|
|
|
12
12
|
? {}
|
|
13
13
|
: {
|
|
14
14
|
// Only activate in CI, as suggested here: https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting#eslint-plugin-import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
'import/no-cycle': 'off',
|
|
16
|
+
'import/no-deprecated': 'off',
|
|
17
|
+
'import/no-named-as-default': 'off',
|
|
18
|
+
'import/no-unused-modules': 'off',
|
|
19
19
|
},
|
|
20
20
|
};
|
package/base/strict.js
CHANGED
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
3
3
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
4
4
|
*/
|
|
5
|
-
require(
|
|
5
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
6
|
+
|
|
7
|
+
const typescriptEslintPlugin = require('@typescript-eslint/eslint-plugin');
|
|
6
8
|
|
|
7
9
|
/** @type {import('eslint').ESLint.ConfigData} */
|
|
8
10
|
module.exports = {
|
|
9
|
-
extends: [
|
|
11
|
+
extends: ['./index.js', 'plugin:@typescript-eslint/strict-type-checked'],
|
|
10
12
|
rules: {
|
|
11
13
|
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
'@typescript-eslint/consistent-type-imports': 'error',
|
|
15
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
16
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
...typescriptEslintPlugin.rules['restrict-template-expressions'].meta.docs.recommended.strict,
|
|
20
|
+
allowNumber: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
14
23
|
|
|
15
24
|
// eslint-plugin-import: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
|
|
16
|
-
|
|
25
|
+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
|
17
26
|
},
|
|
18
27
|
};
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* The following group names are available for configuration: https://eslint-plugin-perfectionist.azat.io/rules/sort-imports#groups
|
|
6
6
|
*/
|
|
7
7
|
const SORT_IMPORTS_GROUPS = [
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
['builtin', 'builtin-type'],
|
|
9
|
+
['external', 'external-type'],
|
|
10
|
+
['internal', 'internal-type'],
|
|
11
|
+
['parent', 'parent-type', 'sibling', 'sibling-type', 'index', 'index-type'],
|
|
12
|
+
['style', 'side-effect'],
|
|
13
|
+
'object',
|
|
14
|
+
'unknown',
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -23,16 +23,16 @@ const SORT_IMPORTS_GROUPS = [
|
|
|
23
23
|
* - https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/index.ts#L61
|
|
24
24
|
*/
|
|
25
25
|
const SORT_CLASSES_GROUPS = [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[
|
|
35
|
-
|
|
26
|
+
'index-signature',
|
|
27
|
+
'static-property',
|
|
28
|
+
'private-property',
|
|
29
|
+
'property',
|
|
30
|
+
'constructor',
|
|
31
|
+
'static-method',
|
|
32
|
+
'private-method',
|
|
33
|
+
'method',
|
|
34
|
+
['get-method', 'set-method'],
|
|
35
|
+
'unknown',
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boehringer-ingelheim/eslint-config",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"boehringer",
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"eslint": "^8.56.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rushstack/eslint-patch": "^1.10.
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
35
|
-
"@typescript-eslint/parser": "^7.
|
|
33
|
+
"@rushstack/eslint-patch": "^1.10.3",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
35
|
+
"@typescript-eslint/parser": "^7.14.1",
|
|
36
36
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
37
37
|
"eslint-plugin-import": "^2.29.1",
|
|
38
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
39
|
-
"eslint-plugin-perfectionist": "^2.
|
|
40
|
-
"eslint-plugin-playwright": "^1.6.
|
|
41
|
-
"eslint-plugin-react": "^7.34.
|
|
38
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
39
|
+
"eslint-plugin-perfectionist": "^2.11.0",
|
|
40
|
+
"eslint-plugin-playwright": "^1.6.2",
|
|
41
|
+
"eslint-plugin-react": "^7.34.3",
|
|
42
42
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
43
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
43
|
+
"eslint-plugin-react-refresh": "^0.4.7",
|
|
44
44
|
"eslint-plugin-sonarjs": "^1.0.3",
|
|
45
45
|
"eslint-plugin-typescript-enum": "^2.1.0",
|
|
46
46
|
"is-ci": "^3.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@boehringer-ingelheim/prettier-config": "
|
|
49
|
+
"@boehringer-ingelheim/prettier-config": "2.0.0",
|
|
50
50
|
"@commitlint/cli": "19.3.0",
|
|
51
51
|
"@commitlint/config-conventional": "19.2.2",
|
|
52
52
|
"@commitlint/types": "19.0.3",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@semantic-release/git": "10.0.1",
|
|
55
55
|
"dotenv-cli": "7.4.2",
|
|
56
56
|
"husky": "9.0.11",
|
|
57
|
-
"prettier": "3.2
|
|
58
|
-
"semantic-release": "
|
|
57
|
+
"prettier": "3.3.2",
|
|
58
|
+
"semantic-release": "24.0.0"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/playwright/index.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
3
3
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
4
4
|
*/
|
|
5
|
-
require(
|
|
5
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
6
6
|
|
|
7
7
|
/** @type {import('eslint').ESLint.ConfigData} */
|
|
8
8
|
module.exports = {
|
|
9
|
-
extends: [
|
|
9
|
+
extends: ['plugin:playwright/playwright-test'],
|
|
10
10
|
rules: {
|
|
11
11
|
// eslint-plugin-playwright: https://github.com/playwright-community/eslint-plugin-playwright
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
'playwright/prefer-to-be': 'error',
|
|
13
|
+
'playwright/prefer-to-have-length': 'error',
|
|
14
|
+
'playwright/require-top-level-describe': 'error',
|
|
15
15
|
},
|
|
16
16
|
};
|
package/react/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const { SORT_IMPORTS_GROUPS } = require(
|
|
1
|
+
const { SORT_IMPORTS_GROUPS } = require('../lib/eslint-plugin-perfectionist');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Workaround to allow ESLint to resolve plugins that were installed
|
|
5
5
|
* by an external config, see https://github.com/eslint/eslint/issues/3458.
|
|
6
6
|
*/
|
|
7
|
-
require(
|
|
7
|
+
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
8
8
|
|
|
9
9
|
/** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData['parserOptions'] & import('@typescript-eslint/parser').ParserOptions } } */
|
|
10
10
|
module.exports = {
|
|
@@ -12,85 +12,85 @@ module.exports = {
|
|
|
12
12
|
browser: true,
|
|
13
13
|
},
|
|
14
14
|
extends: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
'../base/index.js',
|
|
16
|
+
'plugin:jsx-a11y/recommended',
|
|
17
|
+
'plugin:react/recommended',
|
|
18
|
+
'plugin:react/jsx-runtime',
|
|
19
|
+
'plugin:typescript-enum/recommended',
|
|
20
20
|
],
|
|
21
21
|
parserOptions: {
|
|
22
22
|
ecmaFeatures: {
|
|
23
23
|
jsx: true,
|
|
24
24
|
},
|
|
25
|
-
ecmaVersion:
|
|
26
|
-
sourceType:
|
|
25
|
+
ecmaVersion: 'latest',
|
|
26
|
+
sourceType: 'module',
|
|
27
27
|
},
|
|
28
|
-
plugins: [
|
|
28
|
+
plugins: ['jsx-a11y', 'react', 'react-hooks', 'react-refresh', 'typescript-enum'],
|
|
29
29
|
rules: {
|
|
30
30
|
// @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
'@typescript-eslint/ban-types': [
|
|
32
|
+
'error',
|
|
33
33
|
{
|
|
34
34
|
types: {
|
|
35
|
-
|
|
35
|
+
'React.FC': {
|
|
36
36
|
message:
|
|
37
|
-
|
|
37
|
+
'Please use object type destructure declaration, see: https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components',
|
|
38
38
|
},
|
|
39
|
-
|
|
39
|
+
'React.FunctionalComponent': {
|
|
40
40
|
message:
|
|
41
|
-
|
|
41
|
+
'Please use object type destructure declaration, see: https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components',
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
|
-
|
|
46
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
47
47
|
|
|
48
48
|
// eslint-plugin-react: https://github.com/jsx-eslint/eslint-plugin-react/tree/master/lib/rules
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
52
|
|
|
53
53
|
// eslint-plugin-react-hooks: https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
55
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
56
56
|
|
|
57
57
|
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
'perfectionist/sort-imports': [
|
|
59
|
+
'error',
|
|
60
60
|
{
|
|
61
|
-
|
|
61
|
+
'custom-groups': {
|
|
62
62
|
type: {
|
|
63
|
-
react: [
|
|
63
|
+
react: ['react'],
|
|
64
64
|
},
|
|
65
65
|
value: {
|
|
66
|
-
react: [
|
|
66
|
+
react: ['react'],
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
|
-
groups: [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type:
|
|
69
|
+
groups: ['react', ...SORT_IMPORTS_GROUPS],
|
|
70
|
+
'ignore-case': true,
|
|
71
|
+
'newlines-between': 'ignore',
|
|
72
|
+
type: 'natural',
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
'perfectionist/sort-jsx-props': [
|
|
76
|
+
'error',
|
|
77
77
|
{
|
|
78
|
-
|
|
79
|
-
callback:
|
|
80
|
-
reservedProps: [
|
|
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
81
|
},
|
|
82
|
-
groups: [
|
|
83
|
-
|
|
84
|
-
type:
|
|
82
|
+
groups: ['reservedProps', 'unknown', 'callback'],
|
|
83
|
+
'ignore-case': true,
|
|
84
|
+
type: 'natural',
|
|
85
85
|
},
|
|
86
86
|
],
|
|
87
87
|
|
|
88
88
|
// eslint-plugin-react-refresh: https://github.com/ArnaudBarre/eslint-plugin-react-refresh
|
|
89
|
-
|
|
89
|
+
'react-refresh/only-export-components': 'warn',
|
|
90
90
|
},
|
|
91
91
|
settings: {
|
|
92
92
|
react: {
|
|
93
|
-
version:
|
|
93
|
+
version: 'detect',
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
96
|
};
|