forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
110 lines (104 loc) · 4.14 KB
/
eslint.config.mjs
File metadata and controls
110 lines (104 loc) · 4.14 KB
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
import js from "@eslint/js"
import chaiFriendly from "eslint-plugin-chai-friendly"
import { jsdoc } from "eslint-plugin-jsdoc"
import { defineConfig, globalIgnores } from "eslint/config"
import globals from "globals"
import ts from "typescript-eslint"
export default defineConfig([
globalIgnores([
"build/**",
"docs/**",
"node_modules/**",
"sample/playground/**",
"src/driver/mongodb/{typings.ts,bson.typings.ts}",
"temp/**",
]),
{
files: ["**/*.ts"],
languageOptions: {
parser: ts.parser,
parserOptions: {
project: "tsconfig.json",
},
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
js,
ts,
},
extends: [js.configs.recommended, ...ts.configs.recommendedTypeChecked],
rules: {
// custom rules
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": "error",
// exceptions from typescript-eslint/recommended
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unsafe-function-type": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
},
],
"@typescript-eslint/no-wrapper-object-types": "off",
"prefer-const": ["error", { destructuring: "all" }],
// exceptions from typescript-eslint/recommended-type-checked
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksConditionals: false,
checksVoidReturn: false,
},
],
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/unbound-method": [
"warn",
{ ignoreStatic: true },
],
// exceptions for eslint/recommended
"no-async-promise-executor": "warn",
"no-useless-assignment": "warn",
"no-control-regex": "warn",
"no-empty": "warn",
"no-loss-of-precision": "warn",
"no-prototype-builtins": "warn",
"no-regex-spaces": "warn",
"no-return-assign": ["error", "always"],
"preserve-caught-error": "warn",
},
},
jsdoc({
files: ["src/**/*.ts"],
config: "flat/recommended-typescript", // change to 'flat/recommended-typescript-error' once warnings are fixed
// Temporarily enable individual rules when they are fixed, until all current warnings are gone,
// and then remove manual config in favor of `config: "flat/recommended-typescript-error"`
rules: {
"jsdoc/valid-types": "error",
},
}),
{
files: ["test/**/*.ts"],
...chaiFriendly.configs.recommendedFlat,
},
])