-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.js
151 lines (131 loc) · 3.7 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
module.exports = {
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'node',
],
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:@typescript-eslint/eslint-recommended',
// "plugin:@typescript-eslint/recommended",
// 'plugin:node/recommended-module',
],
env: {
node: true,
},
ignorePatterns: ['dist/**', 'doc/**', 'commonjs/**', 'lib/**/*.js', 'cli/**/*.js', 'oauth.js'],
rules: {
// enforce consistent linebreak style
// https://eslint.org/docs/rules/linebreak-style
'linebreak-style': 'off',
strict: ['error', 'global'],
// specify the maximum length of a line in your program
// http://eslint.org/docs/rules/max-len
'max-len': ['error', 120, 2, {
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
// we are using unused args in several interface definitions
'no-unused-vars': 'off',
// we do not need that, since we are using ts
'import/no-unresolved': 'off',
},
overrides: [
{
files: ['lib/**/*.ts', 'connect.js'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2015,
project: './tsconfig.json',
},
env: {
es6: true,
browser: true,
node: true,
},
rules: {
// we disallow default exports
"import/prefer-default-export": "off",
"import/no-default-export": "error",
// we use this in several places, should be discussed if we want to re-enable this
'class-methods-use-this': 'off',
"no-underscore-dangle": ['error', { "allowAfterThis": true }],
'node/no-deprecated-api': 'error',
'no-buffer-constructor': 'error',
'no-console': 'error',
}
},
{
files: ['cli/*.ts'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2015,
project: './tsconfig.json',
},
env: {
node: true,
},
rules: {
'no-console': 'off',
'@typescript-eslint/no-use-before-define': 'off',
// we must require our self which isn't supported right now in ts
// https://github.com/microsoft/TypeScript/issues/38675
'import/no-extraneous-dependencies': 'off',
'no-restricted-syntax': 'off',
}
},
{
files: ['spec/*.js'],
globals: {
Abort: true,
ArrayBuffer: true,
DB: true,
env: true,
expect: true,
helper: true,
Map: true,
Promise: true,
Set: true,
Baqend: true,
},
env: {
es6: false,
node: true,
mocha: true,
browser: true,
},
rules: {
'consistent-return': 'off',
'func-names': 'off',
'global-require': 'off',
'guard-for-in': 'warn',
'new-cap': 'warn',
'no-console': 'warn',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-eval': 'warn',
'no-mixed-operators': 'off',
'no-multi-str': 'off',
'no-new': 'off',
'no-restricted-syntax': 'off',
'no-shadow': 'warn',
'no-unused-expressions': 'off',
'no-unused-vars': 'warn',
'no-use-before-define': 'warn',
'no-var': 'off',
'node/no-unpublished-require': 'off',
'object-shorthand': 'off',
'one-var': 'off',
'one-var-declaration-per-line': 'off',
'prefer-arrow-callback': 'off',
'prefer-promise-reject-errors': 'warn',
'vars-on-top': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'no-await-in-loop': 'off',
},
},
],
};