-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
124 lines (106 loc) · 2.76 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
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
"use strict"
const generalRules = {
complexity: "off",
"func-style": ["error", "expression"],
"id-length": ["error", { exceptionPatterns: ["^_$"] }],
"import/no-unused-modules": "off",
"import/prefer-default-export": "off",
"max-statements": "off",
"new-cap": "off",
"no-console": "off",
"prettier/prettier": "error",
"sonarjs/cognitive-complexity": "off",
"sort-keys-fix/sort-keys-fix": ["error", "asc", { natural: true }],
}
const typescriptRules = {
"@typescript-eslint/ban-types": [
"error",
{
types: {
Function: false,
},
},
],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/init-declarations": "off",
"@typescript-eslint/naming-convention": [
"error",
{
format: ["strictCamelCase"],
leadingUnderscore: "allow",
selector: "default",
},
{
format: ["strictCamelCase", "StrictPascalCase"],
selector: "function",
},
{
format: ["StrictPascalCase"],
selector: ["typeLike", "enumMember"],
},
{
format: ["PascalCase"],
leadingUnderscore: "allow",
prefix: ["is", "has", "are", "can", "should", "did", "will"],
selector: ["variable", "parameter", "property", "accessor"],
types: ["boolean"],
},
],
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_$" }],
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/require-array-sort-compare": [
"error",
{ ignoreStringArrays: true },
],
"etc/no-misused-generics": "off",
"etc/no-t": "off",
"typescript-sort-keys/interface": "error",
"typescript-sort-keys/string-enum": "error",
}
module.exports = {
env: {
es2022: true,
node: true,
},
extends: ["hardcore", "prettier"],
ignorePatterns: ["build", "node_modules"],
overrides: [
{
extends: ["hardcore", "hardcore/ts", "prettier"],
files: "*.ts",
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
project: "./tsconfig.json",
sourceType: "module",
},
rules: { ...generalRules, ...typescriptRules },
},
{
files: [".eslintrc.cjs"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "script",
},
rules: {
"import/no-commonjs": "off",
"putout/putout": [
"error",
{
rules: {
"convert-commonjs-to-esm": "off",
},
},
],
"unicorn/prefer-module": "off",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["prettier", "sort-keys-fix", "typescript-sort-keys"],
rules: generalRules,
}