Skip to content

Commit 17a05a0

Browse files
committed
refactor(eslint-config): new rules and suppression for own code
1 parent 5858e11 commit 17a05a0

File tree

9 files changed

+137
-31
lines changed

9 files changed

+137
-31
lines changed

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"src/lib/base.utils.ts": {
3+
"@typescript-eslint/no-unsafe-return": {
4+
"count": 1
5+
}
6+
},
7+
"src/lib/github.utils.ts": {
8+
"@typescript-eslint/no-unsafe-member-access": {
9+
"count": 1
10+
}
11+
}
12+
}

packages/eslint-config-recommended/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"eslint": "^9.37.0",
4242
"eslint-config-prettier": "^10.1.8",
4343
"eslint-plugin-import": "^2.32.0",
44+
"eslint-plugin-simple-import-sort": "^12.1.1",
4445
"eslint-plugin-unused-imports": "^4.2.0",
4546
"typescript-eslint": "8.46.0"
4647
},

packages/eslint-config-recommended/src/index.ts

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,32 @@ export function defineScTsConfig(...configs: Parameters<typeof defineConfig>): R
5353
'error',
5454
{ accessibility: 'no-public' }, // override default accessibility configuration ('explicit')
5555
],
56-
// '@typescript-eslint/member-ordering': [
57-
// 'error',
58-
// {
59-
// default: [
60-
// 'public-static-field',
61-
// 'protected-static-field',
62-
// 'private-static-field',
63-
//
64-
// 'public-instance-field',
65-
// 'protected-instance-field',
66-
// 'private-instance-field',
67-
//
68-
// 'public-static-method',
69-
// 'protected-static-method',
70-
// 'private-static-method',
71-
//
72-
// 'public-constructor',
73-
// 'protected-constructor',
74-
// 'private-constructor',
75-
//
76-
// 'public-instance-method',
77-
// 'protected-instance-method',
78-
// 'private-instance-method',
79-
// ],
80-
// },
81-
// ],
56+
'@typescript-eslint/member-ordering': [
57+
'error',
58+
{
59+
default: [
60+
'public-static-field',
61+
'protected-static-field',
62+
'private-static-field',
63+
64+
'public-instance-field',
65+
'protected-instance-field',
66+
'private-instance-field',
67+
68+
'public-static-method',
69+
'protected-static-method',
70+
'private-static-method',
71+
72+
'public-constructor',
73+
'protected-constructor',
74+
'private-constructor',
75+
76+
'public-instance-method',
77+
'protected-instance-method',
78+
'private-instance-method',
79+
],
80+
},
81+
],
8282

8383
/*
8484
* the rule sorts selectors in the following priority:
@@ -185,18 +185,14 @@ export function defineScTsConfig(...configs: Parameters<typeof defineConfig>): R
185185
*/
186186
'@typescript-eslint/no-non-null-assertion': 'error', // override "recommended" (severity: "warn")
187187

188-
//
189-
'@typescript-eslint/no-unused-vars': 'off',
188+
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
190189

191190
/*
192191
* disabling rules from extensions
193192
*/
194193
'@typescript-eslint/no-explicit-any': 'off',
195194
'@typescript-eslint/no-unsafe-argument': 'off',
196195
'@typescript-eslint/no-unsafe-assignment': 'off',
197-
'@typescript-eslint/no-unsafe-call': 'off',
198-
'@typescript-eslint/no-unsafe-member-access': 'off', // <-- why do we disable this rule? i mean you can just define a type/interface and use a type-assertion. at least better unsafe access
199-
'@typescript-eslint/no-unsafe-return': 'off',
200196
'@typescript-eslint/unbound-method': 'off',
201197
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
202198

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"src/rules/deny-parent-index-file-import.ts": {
3+
"@typescript-eslint/no-unsafe-member-access": {
4+
"count": 2
5+
}
6+
},
7+
"src/rules/import-denylist.ts": {
8+
"@typescript-eslint/no-unsafe-member-access": {
9+
"count": 3
10+
}
11+
},
12+
"src/rules/prefix-builtin-module-import.ts": {
13+
"@typescript-eslint/no-unsafe-member-access": {
14+
"count": 2
15+
}
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"src/helpers.ts": {
3+
"@typescript-eslint/no-unsafe-call": {
4+
"count": 1
5+
},
6+
"@typescript-eslint/no-unsafe-member-access": {
7+
"count": 1
8+
},
9+
"@typescript-eslint/no-unsafe-return": {
10+
"count": 1
11+
}
12+
},
13+
"src/prepare-dist.ts": {
14+
"@typescript-eslint/no-unsafe-member-access": {
15+
"count": 2
16+
}
17+
}
18+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"src/lib/compare-with/compare-with.ts": {
3+
"@typescript-eslint/no-unsafe-call": {
4+
"count": 2
5+
},
6+
"@typescript-eslint/no-unsafe-member-access": {
7+
"count": 4
8+
}
9+
},
10+
"src/lib/enum/enum.ts": {
11+
"@typescript-eslint/no-unsafe-member-access": {
12+
"count": 3
13+
}
14+
},
15+
"src/lib/group-by/group-by.ts": {
16+
"@typescript-eslint/no-unsafe-member-access": {
17+
"count": 3
18+
}
19+
},
20+
"src/lib/json-stringify-replacer/json-stringify-replacer.function.ts": {
21+
"@typescript-eslint/no-unsafe-return": {
22+
"count": 1
23+
}
24+
},
25+
"src/lib/map-values-deep/map-values-deep.spec.ts": {
26+
"@typescript-eslint/no-unsafe-member-access": {
27+
"count": 2
28+
}
29+
},
30+
"src/lib/map-values-deep/map-values-deep.ts": {
31+
"@typescript-eslint/no-unsafe-member-access": {
32+
"count": 2
33+
}
34+
},
35+
"src/lib/object/omit-props.function.ts": {
36+
"@typescript-eslint/no-unsafe-return": {
37+
"count": 1
38+
}
39+
},
40+
"src/lib/object/pick-props-assert-defined.function.ts": {
41+
"@typescript-eslint/no-unsafe-return": {
42+
"count": 1
43+
}
44+
},
45+
"src/lib/object/pick-props.function.ts": {
46+
"@typescript-eslint/no-unsafe-return": {
47+
"count": 1
48+
}
49+
}
50+
}

packages/utilities/src/lib/map-values-deep/map-values-deep.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-return */
12
import { mapValuesDeep } from './map-values-deep.js'
23

34
describe('map values deep', () => {

packages/utilities/src/lib/map-values-deep/map-values-deep.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-return */
12
import { getTag } from '../tag/get-tag.function.js'
23
import { Tag } from '../tag/tag.enum.js'
34

0 commit comments

Comments
 (0)