-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
114 lines (110 loc) · 4.83 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
module.exports = {
extends: ["plugin:@typescript-eslint/recommended", "prettier/@typescript-eslint", "plugin:prettier/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["import"],
parserOptions: {
ecmaVersion: 6,
project: "./tsconfig.json",
sourceType: "module",
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
}
},
rules: {
//#region ESlint rules.
eqeqeq: ["error", "always", { null: "ignore" }],
"no-eval": "error",
"prefer-const": "warn",
"prefer-template": "warn",
"guard-for-in": "error",
"no-sparse-arrays": "error",
"no-extra-label": "warn",
"jsx-quotes": ["error", "prefer-double"],
"no-console": ["warn", { allow: ["warn", "error", "info"] }],
"no-shadow": "warn",
//#endregion
//#region Import rules.
"import/no-useless-path-segments": "warn",
// TODO: "import/no-self-import": "error", Check why it doesn't work.
"import/no-default-export": "error",
"import/no-anonymous-default-export": "error",
"import/newline-after-import": ["warn", { count: 1 }],
//#endregion
//#region TypeScript ESlint Recommended rules.
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "as", objectLiteralTypeAssertions: "never" }],
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-use-before-define": [
"warn",
{ functions: false, classes: false, enums: false, variables: true, typedefs: false }
],
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/unbound-method": "error",
//#endregion
//#region TypeScript ESlint rules.
"@typescript-eslint/array-type": [
"error",
{
default: "array-simple",
readonly: "generic"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"warn",
{
accessibility: "explicit",
overrides: {
accessors: "explicit",
constructors: "no-public",
methods: "explicit",
properties: "explicit",
parameterProperties: "explicit"
}
}
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "typeParameter",
format: ["PascalCase"],
prefix: ["T"]
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
// TODO: @typescript-eslint/member-ordering
"@typescript-eslint/no-dynamic-delete": "error",
"@typescript-eslint/no-extra-non-null-assertion": "warn",
"@typescript-eslint/no-extraneous-class": "warn",
"@typescript-eslint/no-floating-promises": "warn",
// TODO: "@typescript-eslint/no-magic-numbers": ["error", { ignoreEnums: true }],
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-qualifier": "warn",
// TODO: "@typescript-eslint/no-unnecessary-type-arguments": "warn", It doesn't work well with react hooks.
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-useless-constructor": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/promise-function-async": "warn",
"@typescript-eslint/quotes": ["warn", "double", { allowTemplateLiterals: true, avoidEscape: true }],
"@typescript-eslint/require-array-sort-compare": "warn",
// TODO: @typescript-eslint/restrict-plus-operands ???
// TODO: @typescript-eslint/restrict-template-expressions ???
"@typescript-eslint/return-await": ["error", "in-try-catch"],
"@typescript-eslint/strict-boolean-expressions": "warn",
// TODO: "@typescript-eslint/typedef": "warn", Maybe we don't need to use this.
"@typescript-eslint/unified-signatures": "warn",
"@typescript-eslint/no-inferrable-types": [
"warn",
{
ignoreParameters: true
}
],
//#endregion
"prettier/prettier": "warn"
}
};