This repository was archived by the owner on Mar 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
80 lines (68 loc) · 2.18 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
/* eslint-env node */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
env: {
browser: true,
es2021: true,
},
parserOptions: {
ecmaVersion: "2021",
project: "./tsconfig.json",
},
ignorePatterns: "*.js",
rules: {
// Use Array<> and ReadonlyArray<> syntax.
"@typescript-eslint/array-type": ["error", { default: "generic" }],
// Require types on public things.
"@typescript-eslint/explicit-module-boundary-types": "error",
// Allow casting to any, since this is used in the tests.
"@typescript-eslint/no-explicit-any": "off",
// Only allow unused variables that are prefixed with an underscore.
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
vars: "all",
varsIgnorePattern: "^_",
},
],
// Do not allow unnecessary checks.
"@typescript-eslint/no-unnecessary-condition": "error",
// Require explicit boolean expressions to avoid the ambiguities that JavaScript has, https://dorey.github.io/JavaScript-Equality-Table/#if-statement.
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
allowString: false,
allowNumber: false,
allowNullableObject: false,
allowNullableBoolean: false,
allowNullableString: false,
allowNullableNumber: false,
allowAny: false,
},
],
// Always use strict comparisons.
eqeqeq: "error",
// Do not allow shorthands like !!foo and +foo to convert between types.
"no-implicit-coercion": "error",
// Forbid reassigning parameters.
"no-param-reassign": "error",
// Prefer const over let.
"prefer-const": "error",
// Prefer template strings over concatenating with plus.
"prefer-template": "error",
// Do not require that react components have a name.
"react/display-name": "off",
// Turn off prop types validation, since we're using TypeScript to validate this.
"react/prop-types": "off",
},
};