-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypescript-strict.mjs
47 lines (41 loc) · 1.1 KB
/
typescript-strict.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import tseslint from 'typescript-eslint'
import { JAVASCRIPT_FILES, TYPESCRIPT_FILES } from '../constants.mjs'
export default tseslint.config(
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
files: TYPESCRIPT_FILES,
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/no-floating-promises': 1,
'@typescript-eslint/no-unsafe-argument': 1,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-use-before-define': [
1,
{
functions: true,
classes: true,
variables: true,
typedefs: false, // 允许类型在定义前使用
},
],
'@typescript-eslint/restrict-template-expressions': [
1,
{
allowNumber: true,
},
],
},
},
{
files: JAVASCRIPT_FILES,
extends: [tseslint.configs.disableTypeChecked],
},
)