-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
77 lines (75 loc) · 2.43 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
// @ts-check
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "unused-imports"],
extends: [
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"prettier",
],
// https://stackoverflow.com/questions/63118405
ignorePatterns: [
"coverage",
"packages/*/dist/",
"packages/cli/templates/",
".eslintrc.cjs",
"examples/",
],
settings: {
"import/resolver": {
typescript: true,
node: true,
},
},
rules: {
// fs-extra causing problem
"import/no-named-as-default-member": "off",
// This is handled by TypeScript
"import/no-unresolved": "off",
"unused-imports/no-unused-imports": "warn",
// ESLint breaks with this since it needs to read source code
// https://github.com/typescript-eslint/typescript-eslint/issues/1192
//
// Require that we handle promise
// "@typescript-eslint/no-floating-promises": "warn",
// Forbid conditional promises
// "@typescript-eslint/no-misused-promises": "warn",
// If function returns promise, it must be async
// "@typescript-eslint/promise-function-async": "error",
//
//
// Allow `test!.hello`. It's common when looping, and it's better than to do necessary
// checks for `null | undefined`
"@typescript-eslint/no-non-null-assertion": "off",
// Allow empty function
"@typescript-eslint/no-empty-function": "off",
// Warn when we have unreachable code
"no-unreachable": "warn",
// Do not await promise that is returned
// `const fn = () => await fetch()`. `await` is redundant.
"no-return-await": "error",
// Allow unused vars // it started to complain when used with decorators
"@typescript-eslint/no-unused-vars": "off",
// Allow to have vars with `any` type. There are a lot of places where checking is not important
// and it helps with testing/mocking
"@typescript-eslint/no-explicit-any": "off",
// Allow to specify type even when it can be inferred.
// Allows this: `const price: number = 5`
"@typescript-eslint/no-inferrable-types": "off",
// Used a lot in testing to circumvent `readonly`
"@typescript-eslint/ban-ts-comment": "off",
// Warn when we didn't specify return type (except in callbacks)
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
"no-empty": "off",
},
}