forked from ChainSafe/lodestar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
137 lines (136 loc) · 4.02 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
mocha: true,
},
globals: {
BigInt: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 10,
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint", "eslint-plugin-import", "eslint-plugin-node", "no-only-tests", "prettier"],
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
],
rules: {
"prettier/prettier": "error",
//doesnt work, it reports false errors
"constructor-super": "off",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/naming-convention": [
"error",
{selector: "default", format: ["camelCase"]},
{
selector: ["classProperty", "objectLiteralProperty", "classMethod", "parameter"],
format: ["camelCase"],
leadingUnderscore: "allow",
},
//variable must be in camel or upper case
{selector: "variable", format: ["camelCase", "UPPER_CASE"], leadingUnderscore: "allow"},
//classes and types must be in PascalCase
{selector: ["typeLike", "enum"], format: ["PascalCase"]},
{selector: "enumMember", format: null},
//interface must start with I
{selector: "interface", format: ["PascalCase"], prefix: ["I"]},
//ignore rule for quoted stuff
{
selector: [
"classProperty",
"objectLiteralProperty",
"typeProperty",
"classMethod",
"objectLiteralMethod",
"typeMethod",
"accessor",
"enumMember",
],
format: null,
modifiers: ["requiresQuotes"],
},
//ignore rules on destructured params
{
selector: "variable",
modifiers: ["destructured"],
format: null,
},
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"@typescript-eslint/func-call-spacing": "error",
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {accessibility: "no-public"}],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: false,
optionalDependencies: false,
peerDependencies: false,
},
],
"func-call-spacing": "off",
//if --fix is run it messes imports like /lib/presets/minimal & /lib/presets/mainnet
"import/no-duplicates": "off",
"node/no-deprecated-api": "error",
"new-parens": "error",
"no-caller": "error",
"no-bitwise": "off",
"no-cond-assign": "error",
"no-consecutive-blank-lines": 0,
"no-console": "warn",
"no-var": "error",
"object-curly-spacing": ["error", "never"],
"object-literal-sort-keys": 0,
"no-prototype-builtins": 0,
"prefer-const": "error",
quotes: ["error", "double"],
semi: "off",
// Prevents accidentally pushing a commit with .only in Mocha tests
"no-only-tests/no-only-tests": "error",
},
overrides: [
{
files: ["**/test/**/*.ts"],
rules: {
"import/no-extraneous-dependencies": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
{
files: ["**/lodestar-types/**/*.ts"],
rules: {
"@typescript-eslint/naming-convention": [
"off",
{selector: "interface", prefix: ["I"]},
{selector: "interface", format: ["PascalCase"], prefix: ["I"]},
],
},
},
],
};