-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
ts.js
109 lines (105 loc) · 3.22 KB
/
ts.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import tseslint from 'typescript-eslint'
import base from './index.js'
export default [
...base,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true
}
},
plugins: {
'@typescript-eslint': tseslint.plugin
},
rules: {
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/dot-notation': [
'error',
{
allowKeywords: true
}
],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true
}
],
'@typescript-eslint/no-confusing-void-expression': 'error',
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-invalid-this': [
'error',
{ capIsConstructor: true }
],
'@typescript-eslint/no-mixed-enums': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTaggedTemplates: true,
allowTernary: true
}
],
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-use-before-define': [
'error',
{
classes: false,
functions: false,
variables: false
}
],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/unified-signatures': 'error',
'dot-notation': 'off',
'func-callspacing': 'off',
'import/extensions': [
'error',
'always',
{ checkTypeImports: true, ignorePackages: true }
],
'lines-between-class-members': 'off',
'no-dupe-class-members': 'off',
'no-invalid-this': 'off',
'no-redeclare': 'off',
'no-shadow': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
'object-curly-spacing': 'off'
}
},
{
files: ['*.{test.ts,test.tsx,stories.tsx}', 'types.ts', '**/test/*'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
}
},
{
files: ['**/types.ts'],
rules: {
'no-console': 'off'
}
}
]