-
Notifications
You must be signed in to change notification settings - Fork 2
/
ts-recommended.js
120 lines (119 loc) · 3.49 KB
/
ts-recommended.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
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
'prettier',
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: '.',
ecmaVersion: 'latest',
},
rules: {
'prettier/prettier': [
'error',
{
bracketSpacing: true,
trailingComma: 'all',
singleQuote: true,
semi: true,
useTabs: false,
tabWidth: 2,
printWidth: 120,
},
],
eqeqeq: 'error',
curly: 'error',
'eol-last': ['error', 'always'],
'prefer-template': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-explicit-any': ['warn', { fixToUnknown: true }],
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'default', format: ['camelCase'] },
{ selector: 'variableLike', format: ['camelCase'] },
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
{
selector: ['objectLiteralProperty', 'typeProperty', 'parameterProperty'],
format: null,
},
{
selector: 'class',
format: ['PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: 'function',
format: ['camelCase', 'PascalCase'],
},
{
selector: 'parameter',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
{ selector: 'enumMember', format: ['UPPER_CASE'] },
{ selector: 'memberLike', format: ['camelCase', 'PascalCase', 'UPPER_CASE'] },
{
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{ selector: 'typeParameter', format: ['PascalCase'], prefix: ['T'] },
{
selector: 'typeLike',
format: ['PascalCase'],
custom: { regex: '^[IT][A-Z]', match: false },
},
{
selector: 'interface',
format: ['PascalCase'],
custom: { regex: '^[IT][A-Z]', match: false },
},
],
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
allowAny: false,
allowNullish: false,
allowRegExp: false,
},
],
'@typescript-eslint/prefer-readonly': 'warn',
'import/order': [
'error',
{
groups: ['index', 'sibling', 'parent', 'internal', 'external', 'builtin', 'object', 'type'],
},
],
},
};