-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.js
102 lines (102 loc) · 3.27 KB
/
index.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
module.exports = {
rules: {
/**
* Require consistent usage of type exports.
*
* 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-exports/
*/
'@typescript-eslint/consistent-type-exports': [
'warn',
{ fixMixedExportsWithInlineTypeSpecifier: true },
],
/**
* Require consistent usage of type imports.
*
* 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-imports/
*/
'@typescript-eslint/consistent-type-imports': [
'warn',
{
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
prefer: 'type-imports',
},
],
/**
* Require explicit return types on functions and class methods.
*
* 🚫 Not fixable - https://typescript-eslint.io/rules/explicit-function-return-type/
*/
'@typescript-eslint/explicit-function-return-type': [
'warn',
{ allowExpressions: true },
],
/**
* Require using function property types in method signatures.
*
* These have enhanced typechecking, whereas method signatures do not.
*
* 🔧 Fixable - https://typescript-eslint.io/rules/method-signature-style/
*/
'@typescript-eslint/method-signature-style': 'warn',
/**
* Require consistent naming conventions.
*
* Improves IntelliSense suggestions and avoids name collisions.
*
* 🚫 Not fixable - https://typescript-eslint.io/rules/naming-convention/
*/
'@typescript-eslint/naming-convention': [
'error',
// Anything type-like should be written in PascalCase.
{
format: ['PascalCase'],
selector: ['typeLike', 'enumMember'],
},
// Interfaces cannot be prefixed with `I`, or have restricted names.
{
custom: {
match: false,
regex: '^I[A-Z]|^(Interface|Props|State)$',
},
format: ['PascalCase'],
selector: 'interface',
},
],
/**
* Disallow members of unions and intersections that do nothing or override type information.
*
* 🚫 Not fixable - https://typescript-eslint.io/rules/no-redundant-type-constituents/
*/
'@typescript-eslint/no-redundant-type-constituents': 'warn',
/**
* Disallow unnecessary namespace qualifiers.
*
* 🔧 Fixable - https://typescript-eslint.io/rules/no-unnecessary-qualifier/
*/
'@typescript-eslint/no-unnecessary-qualifier': 'warn',
/**
* Require using `RegExp.exec()` over `String.match()` for consistency.
*
* 🔧 Fixable - https://typescript-eslint.io/rules/prefer-regexp-exec/
*/
'@typescript-eslint/prefer-regexp-exec': 'warn',
/**
* Require Array#sort calls to provide a compare function.
*
* 🚫 Not fixable - https://typescript-eslint.io/rules/require-array-sort-compare/
*/
'@typescript-eslint/require-array-sort-compare': [
'error',
{ ignoreStringArrays: true },
],
/**
* Require exhaustive checks when using union types in switch statements.
*
* This ensures cases are considered when items are later added to a union.
*
* 🚫 Not fixable - https://typescript-eslint.io/rules/switch-exhaustiveness-check/
*/
'@typescript-eslint/switch-exhaustiveness-check': 'error',
},
};