-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
.eslintrc
102 lines (93 loc) · 3.14 KB
/
.eslintrc
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
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:jsdoc/recommended-typescript-error"
],
"plugins": [
"@typescript-eslint",
"simple-import-sort",
"jest"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"ignorePatterns": ["build/**"],
"env": {
"jest/globals": true
},
"rules": {
// ***** Imports *****
"@typescript-eslint/no-restricted-imports": ["error", {
"patterns": [{
"group": ["node:*"],
"message": "Don't use prefixes with Node.js built-ins."
}],
"paths": [{
"name": "fs",
"importNames": ["promises"],
"message": "Use util.promisify(fs.*)() instead of fs.promises.*()."
}]
}],
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
// ***** Typing *****
// Require explicit return types on functions and class methods.
"@typescript-eslint/explicit-function-return-type": "error",
// ***** Promises *****
// Disallow awaiting a value that is not a Thenable.
"@typescript-eslint/await-thenable": "error",
// Disallow async functions which have no `await` expression.
"@typescript-eslint/require-await": "error",
// Enforce consistent returning of awaited values.
"@typescript-eslint/return-await": "error",
// Require any function or method that returns a Promise to be marked async.
"@typescript-eslint/promise-function-async": ["error"],
// ***** JSDoc *****
"jsdoc/require-jsdoc": ["error", {
// Require on public parts of classes
"checkConstructors": false,
"contexts": [
"ClassDeclaration",
// TODO(cemmer): require private methods as well
"MethodDefinition[accessibility!=private][key.name!=/^(get|set)[A-Z][a-zA-Z]+/]"
]
}],
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"jsdoc/no-blank-blocks": "error",
// ***** Misc Disallows *****
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-readonly": "error",
// ***** Misc Allows *****
// There are a few places where this needs to be allowed, but only a few, so warn on them
"@typescript-eslint/no-floating-promises": "warn",
// There are a few places where this needs to be allowed, but only a few, so warn on them
"@typescript-eslint/no-unused-expressions": "warn",
// Significant parts of igir use async.js or mutexes & semaphores to intentlaly limit
// concurrent promises, so we want to respect those
"no-await-in-loop": "off",
// ROM patch file processors use a lot of bitwise operations for legitimate reasons
"no-bitwise": "off",
// Referencing ASCII characters <32 is entirely legitimate
"no-control-regex": "off"
},
"overrides": [
{
"files": [
"test/**/*.ts",
// TODO(cemmer)
"src/polyfill/**/*.ts",
"src/types/files/**/*.ts",
"src/types/patches/**/*.ts"
],
"rules": {
"jsdoc/require-jsdoc": "off"
}
}
]
}