-
Notifications
You must be signed in to change notification settings - Fork 63
/
.eslintrc.js
72 lines (72 loc) · 1.99 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
// eslint-disable-next-line no-undef
module.exports = {
env: {
es2021: true,
node: true,
browser: true,
},
extends: "eslint:recommended",
overrides: [],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
globals: {
Blockly: "readonly",
Scratch: "readonly",
},
rules: {
// Unused variables commonly indicate logic errors
"no-unused-vars": [
"error",
{
// Unused arguments are useful, eg. it can be nice for blocks to accept `args` even if they don't use it
args: "none",
// Allow silently eating try { } catch { }
caughtErrors: "none",
// Variables starting with _ are intentionally unused
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
// Allow while (true) { }
"no-constant-condition": [
"error",
{
checkLoops: false,
},
],
// Allow empty catch {} blocks
"no-empty": [
"error",
{
allowEmptyCatch: true,
},
],
// Returning a value from a constructor() implies a mistake
"no-constructor-return": "error",
// new Promise(async () => {}) implies a mistake
"no-async-promise-executor": "warn",
// x === x implies a mistake
"no-self-compare": "error",
// Using ${...} in a non-template-string implies a mistake
"no-template-curly-in-string": "error",
// Loops that only iterate once imply a mistake
"no-unreachable-loop": "error",
// Detect some untrusted code execution
"no-eval": "error",
"no-implied-eval": "error",
"no-new-func": "error",
"no-script-url": "error",
// Combinations of || and && are unreadable and may not do what you expect
"no-mixed-operators": [
"error",
{
groups: [["&&", "||"]],
},
],
// Disallow async functions that don't need to be. This is important as a Promise and non-Promise return value
// significantly impacts the behavior of projects.
"require-await": "error",
},
};