-
Notifications
You must be signed in to change notification settings - Fork 78
/
.eslintrc.cjs
121 lines (116 loc) · 5.8 KB
/
.eslintrc.cjs
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
115
116
117
118
119
120
121
module.exports = {
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:jsdoc/recommended",
"google",
"prettier",
],
rules: {
"jsdoc/newline-after-description": "off",
"@typescript-eslint/no-explicit-any": "off", // TODO(sijin): remove later
"jsdoc/require-jsdoc": "off",
"no-restricted-globals": ["error", "name", "length"],
"prefer-arrow-callback": "error",
"prettier/prettier": "error",
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
"require-jsdoc": "off", // This rule is deprecated and superseded by jsdoc/require-jsdoc.
"valid-jsdoc": "off", // This is deprecated but included in recommended configs.
"no-prototype-builtins": "warn", // TODO(bkendall): remove, allow to error.
"no-useless-escape": "warn", // TODO(bkendall): remove, allow to error.
"prefer-promise-reject-errors": "warn", // TODO(bkendall): remove, allow to error.
},
overrides: [
{
files: ["*.ts"],
rules: {
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
// Google style guide allows us to omit trivial parameters and returns
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"@typescript-eslint/no-invalid-this": "error",
"@typescript-eslint/no-unused-vars": "error", // Unused vars should not exist.
"no-invalid-this": "off", // Turned off in favor of @typescript-eslint/no-invalid-this.
"no-unused-vars": "off", // Off in favor of @typescript-eslint/no-unused-vars.
eqeqeq: ["error", "always", { null: "ignore" }],
camelcase: ["error", { properties: "never" }], // snake_case allowed in properties iif to satisfy an external contract / style
"@typescript-eslint/ban-types": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/explicit-function-return-type": ["warn", { allowExpressions: true }], // TODO(bkendall): SET to error.
"@typescript-eslint/no-extra-non-null-assertion": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-floating-promises": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-inferrable-types": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-misused-promises": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unnecessary-type-assertion": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-argument": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-assignment": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-call": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-member-access": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-unsafe-return": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/no-use-before-define": ["warn", { functions: false, typedefs: false }], // TODO(bkendall): change to error.
"@typescript-eslint/no-var-requires": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/prefer-includes": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/prefer-regexp-exec": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/prefer-string-starts-ends-with": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/restrict-plus-operands": "warn", // TODO(bkendall): remove, allow to error.
"@typescript-eslint/restrict-template-expressions": "warn", // TODO(bkendall): remove, allow to error.
"no-case-declarations": "warn", // TODO(bkendall): remove, allow to error.
"no-constant-condition": "warn", // TODO(bkendall): remove, allow to error.
"no-fallthrough": "warn", // TODO(bkendall): remove, allow to error.
},
},
{
files: ["*.js"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-includes": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/unbound-method": "off",
"no-var": "off", // TODO(bkendall): remove, allow to error.
"prefer-arrow-callback": "off", // TODO(bkendall): remove, allow to error.
},
},
{
files: ["*.spec.*"],
env: {
mocha: true,
},
rules: {},
},
],
globals: {},
parserOptions: {
ecmaVersion: "2017",
project: ["tsconfig.json", "tsconfig.dev.json"],
sourceType: "module",
warnOnUnsupportedTypeScriptVersion: false,
},
plugins: ["prettier", "@typescript-eslint", "jsdoc"],
settings: {
jsdoc: {
tagNamePreference: {
returns: "return",
},
},
},
parser: "@typescript-eslint/parser",
ignorePatterns: ["starters/**"],
};