forked from emmercm/igir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
120 lines (106 loc) · 3.58 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:jsdoc/recommended-typescript-error"
],
"plugins": [
"@typescript-eslint",
"simple-import-sort",
"jest",
"unicorn"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"ignorePatterns": ["build/**"],
"env": {
"jest/globals": true
},
"rules": {
// ***** Files *****
"unicorn/no-empty-file": "error",
"unicorn/filename-case": ["error", {
"case": "camelCase"
}],
// ***** Imports *****
"unicorn/prefer-node-protocol": "error",
"@typescript-eslint/no-restricted-imports": ["error", {
"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",
// ***** Classes *****
"unicorn/no-static-only-class": "error",
"@typescript-eslint/prefer-readonly": "error",
// ***** Functions *****
"unicorn/prefer-default-parameters": "error",
// ***** Loops *****
"unicorn/prefer-array-find": "error",
// ***** Operands *****
"@typescript-eslint/prefer-nullish-coalescing": "error",
// ***** Numbers *****
"unicorn/no-zero-fractions": "error",
"unicorn/number-literal-case": "error",
"unicorn/numeric-separators-style": "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"
}
}
]
}