-
Notifications
You must be signed in to change notification settings - Fork 0
/
typescript.js
59 lines (52 loc) · 2.21 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
//https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#readme
/**
* @type {import('eslint').Linter.Config}
*/
const config = {
extends: [
'./index',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/typescript',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
// NOTE: we turn this off because we have the switch-exhaustiveness-check
'default-case': 'off',
// NOTE: we turn these off because we use their equivalent extension rules below
'no-use-before-define': 'off',
'no-loop-func': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-implicit-any-catch': 'error',
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-loop-func': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowNumber: true },
],
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
},
}
module.exports = config