-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
122 lines (116 loc) · 4.44 KB
/
index.js
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
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import jsdoc from "eslint-plugin-jsdoc";
import pluginPromise from "eslint-plugin-promise";
import unicorn from "eslint-plugin-unicorn";
import tsLint from "typescript-eslint";
const config = tsLint.config(
eslint.configs.recommended,
tsLint.configs.recommended,
jsdoc.configs["flat/recommended-typescript"],
{
plugins: { jsdoc: jsdoc, unicorn: unicorn, promise: pluginPromise },
rules: {
// #################################################
// Unicorn
"unicorn/prefer-node-protocol": "error",
"unicorn/no-array-for-each": "error",
// #################################################
// ESlint
"eqeqeq": ["error", "always", { null: "ignore" }],
"default-case": "error",
"dot-notation": "off",
"no-void": [
"error",
{
allowAsStatement: true,
},
],
"block-scoped-var": "error",
"curly": "off",
"no-nested-ternary": "error",
"no-self-compare": "error",
"no-var": "error",
// #################################################
// Promise
"promise/always-return": "off",
"promise/no-callback-in-promise": "error",
"promise/no-promise-in-callback": "error",
"promise/no-nesting": "off",
"promise/catch-or-return": [
"error",
{
allowFinally: true,
terminationMethod: ["catch", "finally"],
},
],
// #################################################
// Typescript
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "none",
ignoreRestSiblings: false,
},
],
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { arguments: false } }],
"@typescript-eslint/no-confusing-void-expression": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/no-explicit-any": [
"error",
{
ignoreRestArgs: true,
},
],
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variable",
format: ["camelCase", "snake_case", "UPPER_CASE"],
},
{
selector: "parameter",
format: ["camelCase", "snake_case"],
},
{
selector: "class",
format: ["PascalCase"],
},
{
selector: "method",
format: null,
custom: {
regex: "^[a-z].*",
match: true,
},
},
{
selector: "interface",
format: ["PascalCase"],
prefix: ["I"],
},
],
// #################################################
// jsdoc
"jsdoc/require-returns": 0,
},
},
// Load at the end
eslintConfigPrettier
);
export default config;