This repository has been archived by the owner on Jun 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
127 lines (124 loc) · 3.33 KB
/
.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
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
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
env: {
node: true,
},
reportUnusedDisableDirectives: true,
overrides: [
{
files: ['*.js'],
// For now, require .js files (like .eslintrc.js) only to be formatted using Prettier.
extends: ['plugin:prettier/recommended'],
rules: {
'prettier/prettier': 'warn',
},
},
{
files: ['*.ts'],
parserOptions: {
project: './tsconfig.json',
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
],
rules: {
'prettier/prettier': 'warn',
'@typescript-eslint/ban-types': [
'error',
{
types: {
// By default type `object` is banned because of https://github.com/microsoft/TypeScript/issues/21732.
// This issue is not really affecting us and we use `object` heavily, therefore `object` is allowed.
object: false,
},
},
],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/member-ordering': [
'warn',
{
classes: ['field', 'constructor', 'method'],
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['class', 'interface', 'typeAlias', 'enumMember'],
format: ['PascalCase'],
},
],
'@typescript-eslint/no-misused-promises': [
'error',
{
// Needed to work with async express request handlers
checksVoidReturn: false,
},
],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'accessor-pairs': 'error',
'array-callback-return': 'error',
curly: 'error',
'default-case-last': 'error',
'default-param-last': 'error',
'dot-notation': 'error',
eqeqeq: ['error', 'always', { null: 'never' }],
'guard-for-in': 'error',
'no-constructor-return': 'error',
'no-else-return': 'error',
'no-extra-bind': 'error',
'no-lone-blocks': 'error',
'no-new-wrappers': 'error',
'no-nested-ternary': 'error',
'no-restricted-globals': [
'error',
{ name: 'parseInt', message: `Use 'Number.parseInt()' instead.` },
{ name: 'parseFloat', message: `Use 'Number.parseFloat()' instead.` },
],
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'import/no-cycle': 'error',
'import/order': [
'warn',
{
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'no-unreachable-loop': 'error',
radix: 'error',
'require-atomic-updates': 'error',
'sort-imports': [
'warn',
{
ignoreDeclarationSort: true,
},
],
'spaced-comment': ['warn', 'always'],
},
},
{
// The configuration for all other ".ts" files also gets applied here. This is at least how we expect it to work.
files: ['*.test.ts'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
},
],
};