-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
95 lines (81 loc) · 2.85 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
84
85
86
87
88
89
90
91
92
93
94
95
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
parserOptions: {
project: "./tsconfig.json",
ecmaVersion: 2018,
sourceType: "module",
},
rules: {
"@typescript-eslint/array-type": "off",
// eslint complains about this:
// "@typescript-eslint/array-type": ["error", {readonly: "array"}],
// Awaiting a non-thenable is often a bug and never useful.
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
// Allows functions that are expressions to avoid declaring a return
// type.
allowExpressions: true,
},
],
// It seems like a drag to have to mark every member as public.
"@typescript-eslint/explicit-member-accessibility": [
"error",
{accessibility: "off"},
],
// This complains when we use ! to strip null or undefined from a type, but
// we only do this when the type checker hasn't followed the logic fully.
"@typescript-eslint/no-non-null-assertion": "off",
// The docs say "Parameter properties can be confusing to those new to
// TypeScript as they are less explicit than other ways of declaring and
// initializing class members.". That's not enough for us, given how useful
// they are.
"@typescript-eslint/no-parameter-properties": [
"error",
{
allows: ["readonly", "private readonly"],
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
// It's nice to be able to declare all of the args that an inline
// function takes, even if we don't use them all.
args: "none",
},
],
"@typescript-eslint/no-use-before-define": [
"error",
{
// The docs admit that this is safe for functions.
functions: false,
},
],
// Everyone says that we should use `import foo = require("foo")` to load
// JS modules but that doesn't work with noImplicitAny.
"@typescript-eslint/no-var-requires": "off",
// Likely to be removed from the default.
// https://github.com/typescript-eslint/typescript-eslint/issues/433
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/strict-boolean-expressions": ["error", {}],
// We fix these automatically with prettier. There's no need to treat them
// as errors while editing a file.
"prettier/prettier": "off",
"@typescript-eslint/ban-ts-comment": [
"error",
{"ts-ignore": "allow-with-description"},
],
// The official line is that we shouldn't use `object` as a type. We should
// fix this.
"@typescript-eslint/ban-types": "off",
},
};