-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy patheslint.config.mjs
73 lines (66 loc) · 1.95 KB
/
eslint.config.mjs
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
import eslintjs from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
const OFF = 0;
const WARN = 1;
const ERROR = 2;
/**
* @param {"error" | "warn"} reportErrorsAs
*/
export function createConfig(reportErrorsAs = "error") {
const errorLevel = reportErrorsAs === "error" ? ERROR : WARN;
return tseslint.config(
eslintjs.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
"**/node_modules/**",
"**/out/**",
"**/_templates/**",
"**/playground/**"
],
languageOptions: {
ecmaVersion: 13,
sourceType: "module",
// parser: tseslint.parser,
// parserOptions: {
// projectService: true,
// tsconfigRootDir: import.meta.dirname
// },
globals: {
...globals.node,
...globals.jest
}
},
// plugins: {
// "@typescript-eslint": tseslint.plugin
// },
rules: {
eqeqeq: [errorLevel, "smart"],
radix: errorLevel,
"@typescript-eslint/ban-ts-comment": OFF,
"@typescript-eslint/ban-types": OFF,
"@typescript-eslint/no-empty-function": OFF,
"@typescript-eslint/no-explicit-any": OFF,
"@typescript-eslint/no-unused-vars": OFF,
"@typescript-eslint/no-unsafe-function-type": OFF,
"block-scoped-var": errorLevel,
"default-case-last": errorLevel,
"default-case": errorLevel,
"dot-notation": errorLevel,
"func-name-matching": errorLevel,
"guard-for-in": errorLevel,
"max-lines": [errorLevel, { max: 1024 }],
"max-nested-callbacks": errorLevel,
"new-cap": errorLevel,
"no-invalid-this": errorLevel,
"no-unused-expressions": OFF,
"consistent-this": OFF,
"no-control-regex": OFF,
"no-empty": OFF,
"no-use-before-define": OFF
}
}
);
}
export default createConfig("error");