-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cjs
72 lines (68 loc) · 1.92 KB
/
index.cjs
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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { join } = require("node:path");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { existsSync } = require("node:fs");
const resolveProject = () => {
const eslintJson = join(process.cwd(), "tsconfig.eslint.json");
if (existsSync(eslintJson)) {
return eslintJson;
}
return join(process.cwd(), "tsconfig.json");
};
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "eslint-plugin-local-rules", "import"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
project: [resolveProject()],
},
env: {
browser: true,
es2017: true,
node: true,
},
overrides: [
{
files: ['*.ts'],
rules: {
'prefer-const': 'error'
}
}
],
rules: {
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error",
"arrow-body-style": ["warn", "as-needed"],
curly: "error",
"local-rules/prefer-object-params": "warn",
"local-rules/use-option-type-wrapper": "warn",
"import/no-duplicates": ["error", { "prefer-inline": true }],
"no-console": ["error", { allow: ["error", "warn"] }],
"no-continue": "warn",
"no-delete-var": "error",
"no-else-return": ["warn", { allowElseIf: false }],
"no-unused-vars": "off",
"prefer-template": "error",
},
globals: {
NodeJS: true,
},
};