forked from brettz9/eslint-config-ash-nazg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
266 lines (244 loc) · 9.47 KB
/
index.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
module.exports = {
"extends": [
// This plugin's rules are overridden by following configs (except for
// its own rules), so including first; we also don't want its disabling
// of some, e.g., recommended rules
// Actually, we're disabling instead for now (and manually enabling in
// `index.js` and adding to `plugins`), as has disabling and adds rules
// we don't want; filed the following to get an "all" config instead
// showing only rules specific to the plugin:
// https://github.com/mysticatea/eslint-plugin/issues/21
// "plugin:@mysticatea/es2019",
"eslint:recommended",
// These may override "standard" which includes their rules,
// so including first
"plugin:promise/recommended",
"plugin:import/recommended",
// This may override eslint:recommended and the promise/import rules,
// but it doesn't turn any off
"standard",
// These only add their own rules and are not used by the others
"plugin:unicorn/recommended",
"plugin:eslint-comments/recommended",
"plugin:compat/recommended",
"plugin:array-func/all",
"plugin:sonarjs/recommended",
"plugin:jsdoc/recommended"
],
"plugins": [
// These have no rules
"markdown",
"html",
// See above on why adding here instead of extending a config
"@mysticatea",
// Filed the following to avoid need for adding `plugins` for this as well
// as adding the rule manually as we do below (will need to reference in
// `package.json` if do so can show in `implicitly-included`):
// https://github.com/dustinspecker/eslint-plugin-no-use-extend-native/issues/125
"no-use-extend-native",
// Filed the following to avoid need for adding `plugins` for this as
// well as `extends`: https://github.com/SonarSource/eslint-plugin-sonarjs/issues/117
"sonarjs"
],
"settings": {
"jsdoc": {
"tagNamePreference": {
"augments": "extends"
}
}
},
"rules": {
// RULES SHOULD ONLY BE DIFFERENT FROM INHERITED (ENABLING, DISABLING, CHANGING)
"array-bracket-newline": ["error", "consistent"],
"array-bracket-spacing": ["error"],
"array-callback-return": ["error"],
"arrow-parens": ["error"],
"block-scoped-var": ["error"],
"callback-return": ["error"],
"computed-property-spacing": ["error"],
"consistent-return": ["error"],
"dot-notation": ["error"],
"func-name-matching": ["error"],
"function-paren-newline": ["error", "consistent"],
"global-require": ["error"],
"guard-for-in": ["error"],
"implicit-arrow-linebreak": ["error"],
"jsx-quotes": ["error"],
"linebreak-style": ["error"],
"max-nested-callbacks": ["error"],
"multiline-ternary": ["error", "always-multiline"],
"no-await-in-loop": ["error"],
"no-bitwise": ["error"],
"no-buffer-constructor": ["error"],
"no-confusing-arrow": ["error"],
"no-div-regex": ["error"],
"no-duplicate-imports": ["error"],
"no-else-return": ["error"],
"no-empty": ["error", {"allowEmptyCatch": true}],
"no-eq-null": ["error"],
"no-extra-label": ["error"],
"no-implicit-coercion": ["error"],
"no-implicit-globals": ["error"],
"no-lonely-if": ["error"],
"no-loop-func": ["error"],
"no-mixed-requires": ["error", {"grouping": true, "allowCall": true}],
"no-process-env": ["error"],
"no-restricted-globals": ["error", {
"name": "event",
"message": "Use local event parameter instead (preferably as \"e\" or \"ev\")."
}, {
"name": "fdescribe",
"message": "Do not commit fdescribe. Use describe instead."
}],
"no-restricted-properties": ["error", {
"property": "__defineGetter__",
"message": "Please use `Object.defineProperty` instead."
}],
"no-script-url": ["error"],
"no-sync": ["error"],
"no-var": ["error"],
"no-void": ["error"],
"nonblock-statement-body-position": ["error"],
"object-shorthand": ["error", "always", {"avoidExplicitReturnArrows": true}],
"operator-assignment": ["error"],
"prefer-const": ["error"],
"prefer-destructuring": ["error", {"object": true}],
"prefer-object-spread": ["error"],
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"quote-props": ["error", "as-needed"],
"radix": ["error", "as-needed"],
"require-await": ["error"],
"semi-style": ["error"],
"strict": ["error"],
"switch-colon-spacing": ["error"],
"wrap-regex": ["error"],
"semi": ["error", "always"],
"indent": ["error", 2, {"outerIIFEBody": 0}],
"object-curly-spacing": ["error", "never"],
"no-restricted-syntax": ["error", "[operator=instanceof]"],
// Disable standard
"object-curly-newline": ["off"],
"object-property-newline": ["off"],
"one-var": ["off"],
"lines-between-class-members": "off",
// PROMISE
"promise/no-new-statics": "error",
"promise/prefer-await-to-then": "error",
// PROMISE DISABLE
"promise/param-names": "off",
"promise/no-native": "off",
"promise/no-nesting": "off",
"promise/no-promise-in-callback": "off",
"promise/no-callback-in-promise": "off",
"promise/avoid-new": "off",
"promise/no-return-in-finally": "off",
"promise/valid-params": "off",
// IMPORT
"import/no-absolute-path": "error",
"import/no-dynamic-require": "error",
"import/no-self-import": "error",
"import/no-useless-path-segments": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-deprecated": "error",
"import/no-extraneous-dependencies": "error",
"import/no-mutable-exports": "error",
"import/no-amd": "error",
"import/extensions": ["error", "always", {"ignorePackages": true}],
"import/order": ["error", {"groups": [
"builtin",
"external",
"internal",
["parent", "sibling", "index"]
]}],
"import/newline-after-import": "error",
"import/no-anonymous-default-export": "error",
// JSDOC DISABLE
"jsdoc/check-alignment": ["off"],
"jsdoc/newline-after-description": ["off"],
"jsdoc/no-undefined-types": ["off"],
"jsdoc/require-description": ["off"],
"jsdoc/require-param-description": ["off"],
"jsdoc/require-returns-description": ["off"],
"jsdoc/require-example": ["off"],
"jsdoc/require-jsdoc": ["off"],
"jsdoc/require-returns": ["off"],
// JSDOC
"jsdoc/check-examples": ["error", {
"matchingFileName": "dummy.md",
"rejectExampleCodeRegex": "^`"
}],
"jsdoc/check-param-names": ["error"],
"jsdoc/check-syntax": ["error"],
"jsdoc/check-tag-names": ["error"],
"jsdoc/check-types": ["error"],
"jsdoc/match-description": ["error"],
"jsdoc/valid-types": ["error"],
// Unicorn disable
"unicorn/catch-error-name": "off",
"unicorn/explicit-length-check": "off",
"unicorn/filename-case": "off",
"unicorn/no-unreadable-array-destructuring": "off",
"unicorn/throw-new-error": "off",
"unicorn/import-index": "off",
"unicorn/prevent-abbreviations": "off",
// UNICORN
"unicorn/custom-error-definition": "error",
"unicorn/no-unsafe-regex": "error",
// `@mysticatea`
"@mysticatea/block-scoped-var": "error",
// Adding here for comparison purposes only (already added by
// eslint:recommended and would be added by `es2019` config)
"no-label-var": "error",
// These should be inherited by `es2019` config, but we don't want to
// extend as it has other items we don't want (see comment at top)
"@mysticatea/no-literal-call": "error",
"@mysticatea/no-this-in-static": "error",
"@mysticatea/no-useless-rest-spread": "error",
// `@mysticatea` disabled
"@mysticatea/no-use-ignored-vars": "off",
"@mysticatea/prettier": "off",
"@mysticatea/prefer-for-of": "off",
// Disable mysticatea items we don't want
"func-style": "off",
"init-declarations": "off",
"multiline-comment-style": "off",
"no-invalid-this": "off",
"no-param-reassign": "off",
"no-useless-concat": "off",
"padding-line-between-statements": "off",
"max-params": "off",
"arrow-body-style": "off",
"prefer-arrow-callback": "off",
"prefer-template": "off",
"@mysticatea/no-instanceof-array": "off",
"@mysticatea/no-instanceof-wrapper": "off",
// We're directly using `eslint-comments` and without this, these will
// mistakenly show up in our @mysticatea/eslint-plugin inherited list
"@mysticatea/eslint-comments/disable-enable-pair": "off",
"@mysticatea/eslint-comments/no-aggregating-enable": "off",
"@mysticatea/eslint-comments/no-duplicate-disable": "off",
"@mysticatea/eslint-comments/no-unlimited-disable": "off",
"@mysticatea/eslint-comments/no-unused-disable": "off",
"@mysticatea/eslint-comments/no-unused-enable": "off",
"@mysticatea/eslint-comments/no-use": "off",
// eslint-comments
"eslint-comments/no-unused-disable": "error",
"eslint-comments/disable-enable-pair": ["error", {"allowWholeFile": true}],
// array-func
"array-func/prefer-array-from": "off",
// SONARJS
"sonarjs/max-switch-cases": "off",
"sonarjs/no-collapsible-if": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-identical-functions": "off",
"sonarjs/no-small-switch": "off",
"sonarjs/prefer-immediate-return": "off",
"sonarjs/cognitive-complexity": "off",
// no-use-extend-native
// Should not be needed here; see comment in `plugins`
// re: "no-use-extend-native" above
"no-use-extend-native/no-use-extend-native": "error"
}
};