generated from gapitio/htmlgraphics-html-bundler-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
85 lines (76 loc) · 2.31 KB
/
.eslintrc.cjs
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
module.exports = {
plugins: [
"@typescript-eslint",
"eslint-comments",
"promise",
"unicorn",
"import",
],
extends: [
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:eslint-comments/recommended",
"plugin:promise/recommended",
"plugin:unicorn/recommended",
"prettier",
],
env: {
node: true,
browser: true,
},
parserOptions: {
project: ["./tsconfig.eslint.json"],
extraFileExtensions: [".cjs"],
},
rules: {
// Too restrictive, writing ugly code to defend against a very unlikely scenario: https://eslint.org/docs/rules/no-prototype-builtins
"no-prototype-builtins": "off",
// https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
"import/prefer-default-export": "off",
"import/no-default-export": "warn",
// Dev dependencies should be allowed when using rollup
"import/no-extraneous-dependencies": "off",
// Common abbreviations are known and readable
"unicorn/prevent-abbreviations": "off",
// node:fs only works on v16+ of Node
"unicorn/prefer-node-protocol": "off",
"unicorn/filename-case": [
"error",
{
cases: { camelCase: true, pascalCase: true },
},
],
// Disallow certain syntax forms
"no-restricted-syntax": [
"error",
{
selector: "ForInStatement",
message:
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
},
{
selector: "LabeledStatement",
message:
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
},
{
selector: "WithStatement",
message:
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
},
],
// Disallow reassignment of function parameters
"no-param-reassign": ["error", { props: false }],
// Disallow duplicate conditions in if-else-if
"no-dupe-else-if": "error",
"@typescript-eslint/consistent-type-imports": "error",
},
overrides: [
{
files: ["*.ts"],
extends: [
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
},
],
};