forked from visjs/vis-network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
186 lines (171 loc) · 5.93 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
module.exports = {
env: {
"cypress/globals": true,
browser: true,
es6: true,
node: true,
mocha: true
},
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: "module",
ecmaVersion: 2019,
project: 'tsconfig.json',
},
plugins: ["prettier", "@typescript-eslint", "cypress"],
extends: ['eslint:recommended', 'prettier'],
// For the full list of rules, see: http://eslint.org/docs/rules/
rules: {
'prettier/prettier': ['off'],
complexity: [2, 55],
"max-statements": [2, 115],
"no-unreachable": 1,
"no-useless-escape": 0,
"no-console": 0,
// To flag presence of console.log without breaking linting:
//"no-console": ["warn", { allow: ["warn", "error"] }],
"require-jsdoc": ["error", {
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
ArrowFunctionExpression: false
}
}],
"valid-jsdoc": [2, {
requireReturnDescription: false,
requireReturn: false,
requireParamDescription: false,
requireReturnType: true
}],
"guard-for-in": 1,
},
overrides: [
{
files: ['**/*.ts', '**/*.d.ts'],
rules: {
'prettier/prettier': ['error'],
// @TODO: Seems to mostly work just fine but I'm not 100 % sure.
// @TODO: Deprecated, anything like this for tsdoc?
'valid-jsdoc': [
'error',
{
prefer: {
arg: 'param',
argument: 'param',
return: 'returns',
},
requireParamDescription: true,
requireParamType: false,
requireReturn: false, // Requires return for void functions.
requireReturnDescription: true,
requireReturnType: false,
},
],
// Class related.
'@typescript-eslint/member-naming': [
'error',
{ private: '^_', protected: '^_', public: '^[^_]' },
],
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-readonly': 'error',
// Other.
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
// @TODO: Seems like a good thing, not yet on npm though.
// '@typescript-eslint/require-await': 'error',
// These are hoisted, I have no idea why it reports them by default.
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: false, typedefs: false },
],
// False positives for overloading, also tsc compiles with errors anyway.
'no-dupe-class-members': 'off',
// Blocks typesafe exhaustive switch (switch (x) { … default: const never: never = x }).
'no-case-declarations': 'off',
// Reports used types.
'no-unused-vars': 'off',
// Reports typeof bigint as an error, tsc validates this anyway so no problem turning this off.
'valid-typeof': 'off',
},
},
{
files: [
"lib/network/gephiParser.ts",
"test/NodesHandler.test.ts",
"test/dot-parser/dot-parser.test.ts",
"test/edges/bezier-edge-dynamic.test.ts",
"test/edges/bezier-edge-static.test.ts",
"test/edges/cubic-bezier-edge.test.ts",
"test/edges/edge-base.test.ts",
"test/edges/end-points.test.ts",
"test/edges/helpers.ts",
"test/edges/straight-edge.test.ts",
"test/gephi-parser.test.ts",
"test/helpers/index.ts"
],
rules: {
"prettier/prettier": [
"error",
{
endOfLine: "lf",
parser: "typescript",
printWidth: 80,
quoteProps: "consistent",
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: "es5",
useTabs: false
}
],
// @TODO: Seems to mostly work just fine but I'm not 100 % sure.
// @TODO: Deprecated, anything like this for tsdoc?
"valid-jsdoc": [
"error",
{
prefer: {
arg: "param",
argument: "param",
return: "returns"
},
requireParamDescription: true,
requireParamType: false,
requireReturn: false, // Requires return for void functions.
requireReturnDescription: true,
requireReturnType: false
}
],
// Class related.
"@typescript-eslint/member-naming": [
"error",
{ private: "^_", protected: "^_", public: "^[^_]" }
],
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/prefer-readonly": "error",
// Other.
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
// @TODO: Seems like a good thing, not yet on npm though.
// "@typescript-eslint/require-await": "error",
// These are hoisted, I have no idea why it reports them by default.
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: false, typedefs: false }
],
// False positives for overloading, also tsc compiles with errors anyway.
"no-dupe-class-members": "off",
// Blocks typesafe exhaustive switch (switch (x) { … default: const never: never = x }).
"no-case-declarations": "off",
// Reports used types.
"no-unused-vars": "off",
// Reports typeof bigint as an error, tsc validates this anyway so no problem turning this off.
"valid-typeof": "off"
}
},
]
};