-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
93 lines (85 loc) · 4.15 KB
/
.eslintrc.json
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
{
"env": {
"browser": true,
"es2021": true,
"node": true,
"mocha": true,
"worker": true
},
"extends": "airbnb-base",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
// "globals": {
// "fabric": "writable"
// },
"rules": {
"max-len": [
"error",
200,
{ "ignoreRegExpLiterals": true, "ignoreTemplateLiterals": true }
],
// This rule results in code being deleted.
"no-unreachable": "off",
// This edit allows for .js files (but not packages) to have an extension.
// This is necessary for code to run in both Node.js and the browser.
"import/extensions": ["error", "ignorePackages"],
// Disable rules intended to disable development tools in production. This project is still in development.
"no-console": "off",
"no-debugger": "off",
"no-constant-condition": "off",
"no-use-before-define": ["error", {
// Setting "functions" and "variables" to false should only impact the stylistic aspect of this rule.
// (A block-scoped variable used before declaration should still be flagged.)
"functions": false,
"classes": true,
"variables": false,
"allowNamedExports": false
}],
"prefer-const": ["error", {
"destructuring": "all"
}],
// This rule makes general sense as a best practice, however having it as an error flags too many functions that are fine as-is.
// For example, many string functions in the import code would need to be edited to copy the string to another variable before editing it,
// which would be a hassle to implement and probably decrease clarity.
"no-param-reassign": "off",
"no-mixed-operators": "off",
// This is purely aesthetic preference, and it is not worth the effort to edit.
"prefer-destructuring": "off",
"no-restricted-syntax": "off",
"function-paren-newline": "off",
"function-call-argument-newline": "off",
"max-classes-per-file": "off",
// Disable various subjective style rules
"no-plusplus": "off",
"radix": "off",
"no-continue": "off",
"no-underscore-dangle": "off",
"import/prefer-default-export": "off",
"no-return-assign": "off",
"no-useless-return": "off",
"no-nested-ternary": "off",
// The JSDoc `@type` tag only works for one declaration at a time.
// Therefore, the "one-var" and "one-var-declaration-per-line" rules should be left on.
// "one-var": "off",
// "one-var-declaration-per-line": "off",
// If this is enabled eslint breaks our import statements, such that they no longer run natively in the browser.
"import/no-relative-packages": "off",
// Using blocks for purely organizational purposes (e.g. when in-lining a function) is fine.
"no-lone-blocks": "off",
// This rule was depreciated
"no-return-await": "off",
// Allow certain boilerplate variables, even if unused.
// E.g. `const [key, value] of Object.entries(x)` is fine, even if `key` or `value` is not used.
"no-unused-vars": ["error", { "argsIgnorePattern": "(^resolve$)|(^reject$)|(^event$)|(^e$)", "varsIgnorePattern": "(^key\\d?$)|(^value\\d?$)" }],
// This rule makes sense in theory, however the *vast majority* of code it flags in this project is correct as written.
// Either (1) all iterations of the loop are waiting on the same promise(s), so there would be no benefit to rewriting in a more complicated way, or
// (2) the functions need to be run in a particular order due to triggering some side effect (such as drawing to a canvas).
"no-await-in-loop": "off",
// This enforces a rule that must be broken due to issues in JSDoc.
// JSDoc does not correctly export types when they are members of the default export,
// so the constructors must be exported individually as well.
"import/no-named-as-default-member": "off"
}
}