/
typescript-eslintrc.js
82 lines (81 loc) · 2.63 KB
/
typescript-eslintrc.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
// Copyright (c) 2019 Gonzalo Müller Bravo.
// Licensed under the MIT License (MIT), see LICENSE.txt
module.exports = {
parserOptions: {
sourceType: 'module',
project: './tsconfig.json'
},
plugins: [ '@typescript-eslint' ],
rules: {
'@typescript-eslint/consistent-type-definitions': [
'error',
'interface'
],
'@typescript-eslint/ban-types': [
'error', {
types: {
'Array': 'Use [] instead',
'Object': {
message: 'Use object instead',
fixWith: 'object'
},
'{}': {
message: 'Use object instead',
fixWith: 'object'
},
'object': false,
'Component': 'Use function component instead',
'PureComponent': 'Use function component instead',
'React.Component': 'Use function component instead',
'React.PureComponent': 'Use function component instead',
'String': 'Use string instead'
}
}
],
'@typescript-eslint/explicit-function-return-type': [
'error', {
allowExpressions: true
}
],
'@typescript-eslint/explicit-member-accessibility': [
'error', {
accessibility: 'explicit',
overrides: {
accessors: 'off',
constructors: 'off',
methods: 'explicit',
properties: 'no-public',
parameterProperties: 'explicit'
}
}
],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/no-extraneous-class': [
'error', {
allowWithDecorator: true
}
],
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-type-alias': [
'warn', {
allowAliases: 'in-unions-and-intersections',
allowCallbacks: 'never',
allowLiterals: 'in-unions-and-intersections',
allowMappedTypes: 'always'
}
],
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/type-annotation-spacing': 'error'
}
}