-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtypescript.js
189 lines (188 loc) · 6.67 KB
/
typescript.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json']
},
plugins: [
'@typescript-eslint',
'typescript-sort-keys'
],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@stylistic/recommended-extends'
],
rules: {
// Default ESlint rules to TypeScript-ESlint
'@stylistic/array-bracket-spacing': [ 'error', 'always' ],
'@stylistic/arrow-parens': [ 'error', 'as-needed' ],
'brace-style': 0,
'@stylistic/brace-style': [ 'error', '1tbs' ],
'comma-dangle': 0,
'@stylistic/comma-dangle': [ 'error', 'only-multiline' ],
'dot-notation': 0,
'@typescript-eslint/dot-notation': 2,
'keyword-spacing': 0,
'@stylistic/keyword-spacing': 2,
'no-array-constructor': 0,
'@typescript-eslint/no-array-constructor': 2,
'no-dupe-class-members': 0,
'@typescript-eslint/no-dupe-class-members': 2,
'no-empty-function': 0,
'@typescript-eslint/no-empty-function': 2,
'no-extra-semi': 0,
'@stylistic/no-extra-semi': 2,
'no-implied-eval': 0,
'@typescript-eslint/no-implied-eval': 2,
'no-invalid-this': 0,
'@typescript-eslint/no-invalid-this': 2,
'no-loop-func': 0,
'@typescript-eslint/no-loop-func': 2,
'no-redeclare': 0,
'@typescript-eslint/no-redeclare': 2,
'no-shadow': 0,
'@typescript-eslint/no-shadow': 2,
'no-throw-literal': 0,
'@typescript-eslint/only-throw-error': 2,
'no-unused-expressions': 0,
'@typescript-eslint/no-unused-expressions': [
'error',
{
'allowShortCircuit': true,
'allowTernary': true
}
],
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': [ 'error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'caughtErrors': 'none',
'caughtErrorsIgnorePattern': '^_',
'destructuredArrayIgnorePattern': '^_',
'ignoreRestSiblings': true
} ],
'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': ['error', { 'functions': false }],
'no-useless-constructor': 0,
'@typescript-eslint/no-useless-constructor': 2,
'object-curly-spacing': 0,
'@stylistic/object-curly-spacing': ['error', 'always'],
'padding-line-between-statements': 0,
'@stylistic/padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: '*', next: 'return' }
],
'quotes': 0,
'@stylistic/quotes': ['error', 'single'],
'semi': 0,
'@stylistic/semi': ['error', 'always'],
'space-before-blocks': 0,
'@stylistic/space-before-blocks': 2,
'space-before-function-paren': 0,
'@stylistic/space-before-function-paren': ['error', {
'anonymous': 'never',
'named': 'never',
'asyncArrow': 'always'
}],
'space-infix-ops': 0,
'@stylistic/space-infix-ops': 2,
'no-undef': 0,
'no-prototype-builtins': 0,
// Typescript-ESlint Rules
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 0,
'@stylistic/member-delimiter-style': ['error', {
multiline: {
delimiter: 'semi',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: true
}
}],
'@typescript-eslint/method-signature-style': 2,
'@typescript-eslint/no-confusing-non-null-assertion': 2,
'@typescript-eslint/no-duplicate-enum-values': 2,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unnecessary-type-constraint': 2,
'@typescript-eslint/prefer-as-const': 1,
'@typescript-eslint/prefer-enum-initializers': 1,
'@typescript-eslint/prefer-optional-chain': 1,
'@typescript-eslint/naming-convention': [
'error',
{
'selector': 'interface',
'format': [ 'PascalCase' ],
'custom': {
'regex': '^I[A-Z]',
'match': true
}
}
],
'@typescript-eslint/no-empty-object-type': 0,
'@stylistic/type-annotation-spacing': ['error', {
before: true,
after: true,
overrides: {
colon: {
before: false,
after: true
}
}
}],
'typescript-sort-keys/interface': 2,
'typescript-sort-keys/string-enum': 2,
'@stylistic/indent': [
'error',
4,
{
'CallExpression': {
arguments: 'off'
},
'FunctionDeclaration': {
body: 1,
parameters: 2
},
'FunctionExpression': {
parameters: 2
},
'MemberExpression': 'off',
'SwitchCase': 0
}
],
'@stylistic/jsx-equals-spacing': [ 'error', 'always' ],
'@stylistic/jsx-closing-bracket-location': [
'error',
'after-props'
],
'@stylistic/jsx-quotes': [ 'error', 'prefer-single' ],
'react/jsx-indent-props': 0,
'@stylistic/jsx-indent-props': 0,
'@stylistic/jsx-curly-spacing': [
'error',
'always',
{
'spacing': {
'objectLiterals': 'never'
}
}
],
'@stylistic/quote-props': 0,
'@stylistic/indent-binary-ops': 0, // TODO: revisit this rule
'@stylistic/no-multiple-empty-lines': [ 'error', { 'max': 2, 'maxEOF': 1, 'maxBOF': 1 } ],
'@stylistic/padded-blocks': 0,
'@stylistic/multiline-ternary': 0,
'@stylistic/jsx-wrap-multilines': 0,
'@stylistic/jsx-curly-brace-presence': 0,
'@stylistic/jsx-curly-newline': 0,
'@stylistic/jsx-function-call-newline': 0,
'@stylistic/jsx-one-expression-per-line': 0,
'@stylistic/jsx-tag-spacing': 0,
'@stylistic/jsx-closing-tag-location': 0,
'@stylistic/type-generic-spacing': 0,
}
}