-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
83 lines (73 loc) · 3.29 KB
/
.eslintrc.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
module.exports = {
env: {
es2022: true,
node: true,
},
extends: ["eslint:recommended"],
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
overrides: [
{
files: ["test/**/*"],
env: {
jest: true,
},
},
],
parserOptions: {
project: ["./tsconfig.json"],
},
ignorePatterns: [".eslintrc.js"],
rules: {
// https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript
// Use typescript's checker for unused vars (critical for Enums)
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
// https://typescript-eslint.io/rules/no-use-before-define
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "error",
// https://typescript-eslint.io/rules/ban-ts-comment
// Disallow @ts-<directive> comments or require descriptions after directives.
"@typescript-eslint/ban-ts-comment": "error",
// https://typescript-eslint.io/rules/no-explicit-any
// Disallow the any type.
//"@typescript-eslint/no-explicit-any": "error",
// https://typescript-eslint.io/rules/no-unsafe-assignment
// Disallow assigning a value with type any to variables and properties.
"@typescript-eslint/no-unsafe-assignment": "error",
// https://typescript-eslint.io/rules/no-unsafe-return
// Disallow returning a value with type any from a function.
"@typescript-eslint/no-unsafe-return": "error",
// https://typescript-eslint.io/rules/ban-types
// Disallow certain types.
"@typescript-eslint/ban-types": [
"error",
{
types: {
unknown: "That is not allowed in this course.",
any: "That is not allowed in this course.",
},
},
],
// https://typescript-eslint.io/rules/no-array-constructor
// Disallow generic Array constructors.
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": "error",
// https://typescript-eslint.io/rules/no-base-to-string
// Require .toString() to only be called on objects which provide useful information when stringified.
"@typescript-eslint/no-base-to-string": "error",
// https://typescript-eslint.io/rules/no-confusing-void-expression
// Require expressions of type void to appear in statement position.
"@typescript-eslint/no-confusing-void-expression": "error",
// https://typescript-eslint.io/rules/no-for-in-array
// Disallow iterating over an array with a for-in loop. (Force for-of instead!)
"@typescript-eslint/no-for-in-array": "error",
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
// Disallow unnecessary equality comparisons against boolean literals.
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
// https://typescript-eslint.io/rules/no-unnecessary-condition
// Disallow conditionals where the type is always truthy or always falsy.
"@typescript-eslint/no-unnecessary-condition": "error",
},
};