-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
86 lines (84 loc) 路 2.36 KB
/
.eslintrc.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const fs = require("fs");
const path = require("path");
// Use gitignore as eslintignore (single source of truth)
const ignorePatterns = fs
.readFileSync(path.join(__dirname, ".gitignore"), "utf8")
.split("\n")
.map((line) => {
return line.split("#")[0].trim();
})
.filter((withoutComment) => {
return withoutComment.length > 0;
});
module.exports = {
env: {
browser: true,
jest: true,
node: true,
},
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:unicorn/recommended",
"prettier",
],
plugins: ["@typescript-eslint", "unicorn", "prettier"],
ignorePatterns,
rules: {
"arrow-body-style": "off",
"no-array-constructor": "off",
"no-console": "error",
"no-empty": ["error", { allowEmptyCatch: true }],
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^(_|error$)",
},
],
"@typescript-eslint/no-array-constructor": ["error"],
"@typescript-eslint/no-explicit-any": ["warn"],
"unicorn/filename-case": "off",
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": [
"error",
{
extendDefaultReplacements: false,
replacements: {
def: { defer: true, deferred: true, define: true, definition: true },
dir: { direction: true, directory: true },
docs: { documentation: true, documents: true },
dst: { daylightSavingTime: true, destination: true, distribution: true },
e: { error: true, event: true },
rel: { related: true, relationship: true, relative: true },
res: { response: true, result: true },
},
},
],
"unicorn/prefer-switch": ["error", { minimumCases: 5 }],
"unicorn/no-new-array": "off",
"unicorn/no-await-expression-member": "off",
},
overrides: [
{
files: ["*.cjs"],
rules: {
"unicorn/prefer-module": "off",
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: [".scripts/**/*.ts"],
rules: {
"no-console": "off",
"unicorn/no-process-exit": "off",
},
},
],
};