-
Notifications
You must be signed in to change notification settings - Fork 302
/
.eslintrc.cjs
153 lines (149 loc) · 4.89 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
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
module.exports = {
// Global ESLint settings
root: true,
extends: [
'eslint-config-airbnb-base',
'eslint-config-airbnb-base/rules/strict',
],
parserOptions: {
ecmaVersion: 13,
sourceType: 'module',
ecmaFeatures: {
impliedStrict: true,
},
},
settings: {
'import/resolver': {
'babel-module': {},
},
},
env: {
browser: true,
es2020: true,
amd: true,
commonjs: true,
},
rules: {
'no-trailing-spaces': 'warn',
'padded-blocks': 'warn',
'no-unused-vars': 'warn',
'no-plusplus': 'off',
// this option sets a specific tab width for your code
// http://eslint.org/docs/rules/indent
indent: ['warn', 4, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
// MemberExpression: null,
// CallExpression: {
// parameters: null,
// },
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
}],
'one-var': ['error', 'never'],
'valid-jsdoc': ['error', {
requireReturn: false,
requireParamDescription: false,
requireReturnDescription: false,
}],
// TODO reactivate this rule once a proper npm package is made
// a good configuration might be:
/* 'import/no-extraneous-dependencies': ['error', {
devDependencies: ['test/**', 'tests/**', 'examples/**'],
}], */
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
// TODO reactivate all the following rules
// maybe 'no-mixed-operators': ['error', { allowSamePrecedence: true }],
'no-mixed-operators': 'off',
'no-use-before-define': ['error', { functions: false }],
// should probably be
// 'no-underscore-dangle': ['error', { allowAfterThis: true, allowAfterSuper: true }],
'no-underscore-dangle': 'off',
eqeqeq: 'off',
// what len ? Airbnb does 100. github wraps line above 80
'max-len': 'off',
'no-param-reassign': 'off',
'no-else-return': 'off',
'no-var': 'error',
'vars-on-top': 'off',
'no-shadow': 'off',
'no-restricted-properties': 'off',
'prefer-spread': 'off',
'prefer-destructuring': 'off',
'function-paren-newline': 'off',
'operator-linebreak': 'off',
'object-curly-newline': 'off',
curly: ['error', 'all'],
'no-multiple-empty-lines': 'off',
'no-restricted-globals': 'off',
'implicit-arrow-linebreak': 'off',
'prefer-promise-reject-errors': 'off',
'no-multi-spaces': 'off',
'import/no-cycle': 'off',
'import/no-useless-path-segments': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
ts: 'never',
tsx: 'never',
},
],
camelcase: 'off',
'switch-colon-spacing': 'off',
'lines-between-class-members': 'off',
'no-bitwise': 'off',
'no-restricted-syntax': 'off',
'consistent-return': 'off',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'new-cap': 'off',
'no-continue': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'class-methods-use-this': 'off',
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
'max-classes-per-file': ['error', 4],
'function-call-argument-newline': 'off',
// change default-param-last to on, but there are several breaking changes or default params to add.
'default-param-last': 'off',
},
globals: {
__DEBUG__: false,
},
// ESLint settings for .ts files
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
plugins: [
'@stylistic',
'@typescript-eslint',
'eslint-plugin-tsdoc',
],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'@stylistic/max-len': ['warn', {
code: 100,
comments: 80,
ignoreUrls: true,
}],
// see https://typescript-eslint.io/rules/no-use-before-define/
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'error',
'valid-jsdoc': 'off',
'tsdoc/syntax': 'warn',
},
},
],
};