/
.eslintrc.json
155 lines (155 loc) · 3.91 KB
/
.eslintrc.json
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019
},
"plugins": [
"simple-import-sort",
"import",
"@typescript-eslint",
"prettier",
"tsdoc"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"env": {
"node": true,
"mocha": true,
"es6": true
},
"rules": {
"prettier/prettier": "error",
"tsdoc/syntax": "warn",
"no-console": "error",
"valid-typeof": "error",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"strict": [
"error",
"global"
],
"@typescript-eslint/no-explicit-any": "off",
"no-restricted-syntax": [
"error",
{
"selector": "TSEnumDeclaration",
"message": "Do not declare enums"
},
{
"selector": "BinaryExpression[operator=/[=!]==/] Identifier[name='undefined']",
"message": "Do not strictly check undefined"
},
{
"selector": "BinaryExpression[operator=/[=!]==/] Literal[raw='null']",
"message": "Do not strictly check null"
},
{
"selector": "BinaryExpression[operator=/[=!]==?/] Literal[value='undefined']",
"message": "Do not strictly check typeof undefined (NOTE: currently this rule only detects the usage of 'undefined' string literal so this could be a misfire)"
}
]
},
"overrides": [
{
"files": [
"*.d.ts"
],
"parser": "@typescript-eslint/parser",
"rules": {
"prettier/prettier": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": "off"
}
},
{
"files": [
"*.mjs"
],
"parserOptions": {
"sourceType": "module"
}
},
{
// Settings for javascript test files
"files": [
"test/**/*.js"
],
"parser": "espree",
"plugins": [
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unused-vars": "off",
// Since we use ts-node we should always require the TS code
// Also we have patches to apply to the mock server, so we should always import from there
"no-restricted-modules": [
"error",
{
"patterns": [
"**/../lib/**",
"mongodb-mock-server"
]
}
],
"no-console": "off",
"tsdoc/syntax": "off",
"strict": [
"off",
"global"
],
"no-restricted-syntax": "off"
}
},
{
// Settings for typescript test files
"files": [
"test/**/*.ts"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-console": "off",
"no-restricted-syntax": "off"
}
},
{
// Settings for typescript type test files
"files": [
"*.test-d.ts"
],
"parser": "@typescript-eslint/parser",
"rules": {
"prettier/prettier": "error",
"tsdoc/syntax": "warn",
"no-console": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
]
}