This repository was archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.js
More file actions
110 lines (107 loc) · 3.21 KB
/
.eslintrc.js
File metadata and controls
110 lines (107 loc) · 3.21 KB
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
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./src/tsconfig.src.json", "./spec/tsconfig.json"],
},
plugins: ["@typescript-eslint", "prettier", "import"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
rules: {
/*
* ESLint
*/
// Error prevention
"array-callback-return": "warn",
"consistent-return": "warn",
"no-constructor-return": "warn",
"no-implicit-coercion": "warn",
"no-promise-executor-return": "error",
"no-template-curly-in-string": "warn",
"no-undef-init": "error",
"no-unreachable-loop": "warn",
"require-atomic-updates": "warn",
radix: "warn",
/*
* Prettier
*/
"prettier/prettier": "warn",
/*
* Typescript
*/
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
allowExpressions: true,
},
],
"@typescript-eslint/member-delimiter-style": "warn",
"@typescript-eslint/method-signature-style": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "default",
format: ["strictCamelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "forbid",
},
{
selector: "variable",
format: ["strictCamelCase", "StrictPascalCase", "UPPER_CASE"],
},
{
selector: "property",
format: ["strictCamelCase", "StrictPascalCase", "UPPER_CASE"],
},
{ selector: "typeAlias", format: ["StrictPascalCase"] },
{
selector: "typeParameter",
format: ["PascalCase"], // Allow "T", "TValue", "Value" and such
},
{
selector: "interface",
format: ["StrictPascalCase"],
custom: {
regex: "^I[A-Z]",
match: false,
},
},
{ selector: "class", format: ["StrictPascalCase"] },
{ selector: "enum", format: ["StrictPascalCase"] },
{ selector: "enumMember", format: ["UPPER_CASE"] },
],
"@typescript-eslint/no-base-to-string": "error",
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/no-dynamic-delete": "error",
"@typescript-eslint/no-non-null-assertion": "off", // Essential when working with maps
"@typescript-eslint/no-redeclare": "error",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/prefer-enum-initializers": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/require-array-sort-compare": "warn",
"@typescript-eslint/strict-boolean-expressions": "warn",
/*
* Imports
*/
"import/no-absolute-path": "error",
"import/no-cycle": "warn",
"import/no-default-export": "warn",
"import/no-mutable-exports": "warn",
"import/no-useless-path-segments": "warn",
"import/no-webpack-loader-syntax": "warn",
},
};