-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
107 lines (94 loc) · 2.31 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
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
"use strict"
/*
eslint
no-magic-numbers: off,
no-implicit-globals: off,
*/
// shorthands to prevent typos
const
E = "error",
W = "warn"
/**
regex pattern of intentionally unused identifiers
*/
const UNUSED_ID = "^(_|(foo)?(ba[rz])?|bruh|yeet|gyatt?|amon?gus)$"
//eslint-disable-next-line no-undef
module.exports = {
env: { browser: true, es2022: true },
parserOptions: { ecmaVersion: "latest" },
extends: "eslint:recommended",
rules: {
"no-unused-expressions": W,
"no-unused-vars": [
W,
{
varsIgnorePattern: UNUSED_ID,
argsIgnorePattern: UNUSED_ID
}
],
"no-magic-numbers": [
W,// too many false-positives
{
ignore: [-1, 0, 1, 2],
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
enforceConst: true
}
],
// Rust certified
"prefer-const": E,
/*
this is not forbidden, it's just to make mutation intentional.
to-do: replace by this proposal:
https://github.com/Fishrock123/proposal-const-function-arguments
*/"no-param-reassign": E,// should it be `W`?
"no-var": E,
"no-implicit-globals": [E, { lexicalBindings: true }],
"no-empty-function": E,
"no-loop-func": E,
"no-lone-blocks": E,
"no-constant-binary-expression": E,
"no-self-compare": E,
"no-unmodified-loop-condition": E,
"no-unreachable-loop": E,
"no-extra-label": E,
// guard-clauses are better
"no-else-return": [E, { "allowElseIf": false }],
"no-useless-return": E,
"no-unneeded-ternary": [E, { "defaultAssignment": false }],
"no-useless-computed-key": [E, { "enforceForClassMembers": true }],
"no-useless-concat": E,
"no-useless-constructor": E,
"no-useless-rename": E,
"object-shorthand": E,
"require-atomic-updates": E,
"no-eval": E,
"no-implied-eval": E,
"no-script-url": E,
"dot-notation": E,
"no-array-constructor": E,
"no-sequences": E,
// prefer Object bags
"max-params": [E, 4],
"max-depth": W,
// avoid CB-Hell
"max-nested-callbacks": [E, 3],
indent: [E, "tab"],
"linebreak-style": [E, "unix"],
"no-template-curly-in-string": W,
quotes: [
E,
// "single" is cleaner,
// but "double" is more consistent with JSON
"double"
],
semi: [
E,
// ASI is confusing, regardless of what you do
"never"
],
// GH-issues can be used as alt,
// that's why no `W`
"no-warning-comments": [E, { "terms": ["todo", "to-do"] }]
}
}