@@ -6,6 +6,7 @@ const jsdoc = require("eslint-plugin-jsdoc");
6
6
const prettierConfig = require ( "eslint-config-prettier" ) ;
7
7
const globals = require ( "globals" ) ;
8
8
9
+ const nodeConfig = n . configs [ "flat/recommended" ] ;
9
10
const jsdocConfig = jsdoc . configs [ "flat/recommended-typescript-flavor-error" ] ;
10
11
11
12
module . exports = [
@@ -36,16 +37,60 @@ module.exports = [
36
37
// Ignore precompiled schemas
37
38
"schemas/**/*.check.js" ,
38
39
40
+ // Auto generation
41
+ "lib/util/semver.js" ,
42
+
39
43
// Ignore some examples files
40
44
"examples/**/*.js" ,
41
45
"examples/**/*.mjs" ,
42
46
"!examples/*/webpack.config.js"
43
47
]
44
48
} ,
45
49
js . configs . recommended ,
46
- n . configs [ "flat/recommended" ] ,
50
+ {
51
+ ...nodeConfig ,
52
+ rules : {
53
+ ...nodeConfig . rules ,
54
+ "n/no-missing-require" : [ "error" , { allowModules : [ "webpack" ] } ] ,
55
+ "n/no-unsupported-features/node-builtins" : [
56
+ "error" ,
57
+ {
58
+ ignores : [ "zlib.createBrotliCompress" , "zlib.createBrotliDecompress" ]
59
+ }
60
+ ] ,
61
+ "n/exports-style" : "error"
62
+ }
63
+ } ,
47
64
{
48
65
...jsdocConfig ,
66
+ settings : {
67
+ jsdoc : {
68
+ mode : "typescript" ,
69
+ // supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
70
+ tagNamePreference : {
71
+ ...[ "implements" , "const" , "memberof" , "yields" ] . reduce (
72
+ ( acc , tag ) => {
73
+ acc [ tag ] = {
74
+ message : `@${ tag } currently not supported in TypeScript`
75
+ } ;
76
+ return acc ;
77
+ } ,
78
+ { }
79
+ ) ,
80
+ extends : "extends" ,
81
+ return : "returns" ,
82
+ constructor : "constructor" ,
83
+ prop : "property" ,
84
+ arg : "param" ,
85
+ augments : "extends" ,
86
+ description : false ,
87
+ desc : false ,
88
+ inheritdoc : false ,
89
+ class : "constructor"
90
+ } ,
91
+ overrideReplacesDocs : false
92
+ }
93
+ } ,
49
94
rules : {
50
95
...jsdocConfig . rules ,
51
96
// Override recommended
@@ -98,10 +143,17 @@ module.exports = [
98
143
"no-use-before-define" : "off" ,
99
144
"no-unused-vars" : [
100
145
"error" ,
101
- { caughtErrors : "none" , args : "none" , ignoreRestSiblings : true }
146
+ {
147
+ vars : "all" ,
148
+ varsIgnorePattern : "^_" ,
149
+ args : "none" ,
150
+ argsIgnorePattern : "^_" ,
151
+ caughtErrors : "none" ,
152
+ caughtErrorsIgnorePattern : "^_" ,
153
+ ignoreRestSiblings : true
154
+ }
102
155
] ,
103
156
"no-inner-declarations" : "error" ,
104
- "no-loop-func" : "off" ,
105
157
"prefer-const" : [
106
158
"error" ,
107
159
{
@@ -113,47 +165,110 @@ module.exports = [
113
165
"no-else-return" : "error" ,
114
166
"no-lonely-if" : "error" ,
115
167
"no-undef-init" : "error" ,
116
- "n/no-missing-require" : [ "error" , { allowModules : [ "webpack" ] } ] ,
117
- "n/no-unsupported-features/node-builtins" : [
168
+ // Disallow @ts -ignore directive. Use @ts-expect-error instead
169
+ "no-warning-comments" : [
170
+ "error" ,
171
+ { terms : [ "@ts-ignore" ] , location : "start" }
172
+ ] ,
173
+ "no-constructor-return" : "error" ,
174
+ "symbol-description" : "error" ,
175
+ "array-callback-return" : [
118
176
"error" ,
119
177
{
120
- ignores : [ "zlib.createBrotliCompress" , "zlib.createBrotliDecompress" ]
178
+ allowImplicit : true
121
179
}
122
180
] ,
123
- "n/exports-style" : "error" ,
124
- // Disallow @ts -ignore directive. Use @ts-expect-error instead
125
- "no-warning-comments" : [
181
+ "no-promise-executor-return" : "error" ,
182
+ "no-undef" : "error" ,
183
+ "guard-for-in" : "error" ,
184
+ "no-constant-condition" : "error" ,
185
+ camelcase : [
126
186
"error" ,
127
- { terms : [ "@ts-ignore" ] , location : "start" }
128
- ]
129
- } ,
130
- settings : {
131
- jsdoc : {
132
- mode : "typescript" ,
133
- // supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
134
- tagNamePreference : {
135
- ...[ "implements" , "const" , "memberof" , "yields" ] . reduce (
136
- ( acc , tag ) => {
137
- acc [ tag ] = {
138
- message : `@${ tag } currently not supported in TypeScript`
139
- } ;
140
- return acc ;
141
- } ,
142
- { }
143
- ) ,
144
- extends : "extends" ,
145
- return : "returns" ,
146
- constructor : "constructor" ,
147
- prop : "property" ,
148
- arg : "param" ,
149
- augments : "extends" ,
150
- description : false ,
151
- desc : false ,
152
- inheritdoc : false ,
153
- class : "constructor"
154
- } ,
155
- overrideReplacesDocs : false
156
- }
187
+ {
188
+ allow : [
189
+ "__webpack_require__" ,
190
+ "__webpack_public_path__" ,
191
+ "__webpack_base_uri__" ,
192
+ "__webpack_modules__" ,
193
+ "__webpack_chunk_load__" ,
194
+ "__non_webpack_require__" ,
195
+ "__webpack_nonce__" ,
196
+ "__webpack_hash__" ,
197
+ "__webpack_chunkname__" ,
198
+ "__webpack_get_script_filename__" ,
199
+ "__webpack_runtime_id__" ,
200
+ "__system_context__" ,
201
+ "__webpack_share_scopes__" ,
202
+ "__webpack_init_sharing__" ,
203
+ "__webpack_require_module__" ,
204
+ "_stream_duplex" ,
205
+ "_stream_passthrough" ,
206
+ "_stream_readable" ,
207
+ "_stream_transform" ,
208
+ "_stream_writable" ,
209
+ "string_decoder"
210
+ ]
211
+ }
212
+ ] ,
213
+ "prefer-exponentiation-operator" : "error" ,
214
+ "no-useless-return" : "error" ,
215
+ "no-return-assign" : "error" ,
216
+ "default-case-last" : "error" ,
217
+ "default-param-last" : "error" ,
218
+ "dot-notation" : "error" ,
219
+ "grouped-accessor-pairs" : "error" ,
220
+ "id-match" : [
221
+ "error" ,
222
+ "^[$a-zA-Z_][$a-zA-Z0-9_]*$" ,
223
+ {
224
+ properties : true
225
+ }
226
+ ] ,
227
+ "no-extra-label" : "error" ,
228
+ "no-label-var" : "error" ,
229
+ "no-lone-blocks" : "error" ,
230
+ "no-multi-str" : "error" ,
231
+ "no-new-func" : "error" ,
232
+ "no-unneeded-ternary" : [ "error" , { defaultAssignment : false } ] ,
233
+ "no-useless-call" : "error" ,
234
+ "no-useless-concat" : "error" ,
235
+ "prefer-object-spread" : "error" ,
236
+ "prefer-regex-literals" : "error" ,
237
+ "prefer-rest-params" : "error" ,
238
+
239
+ // TODO Enable
240
+ "no-sequences" : "off" ,
241
+ "prefer-spread" : "off" ,
242
+ "default-case" : "off" ,
243
+ "new-cap" : [
244
+ "off" ,
245
+ {
246
+ newIsCap : true ,
247
+ newIsCapExceptions : [ ] ,
248
+ capIsNew : true ,
249
+ capIsNewExceptions : [ ] ,
250
+ properties : true
251
+ }
252
+ ] ,
253
+ "no-loop-func" : "off" ,
254
+ "no-implicit-coercion" : "off" ,
255
+ "arrow-body-style" : "off" ,
256
+ "no-shadow" : "off" ,
257
+ "prefer-template" : "off" ,
258
+ "prefer-destructuring" : "off" ,
259
+ "func-style" : "off" ,
260
+ "no-plusplus" : "off" ,
261
+ "no-param-reassign" : "off" ,
262
+ "no-var" : "off" ,
263
+ "one-var" : "off" ,
264
+ "vars-on-top" : "off" ,
265
+ "no-unreachable-loop" : "off" ,
266
+ "no-unmodified-loop-condition" : "off" ,
267
+ "@stylistic/lines-between-class-members" : "off" ,
268
+ "@stylistic/quotes" : "off" ,
269
+ "@stylistic/spaced-comment" : "off" ,
270
+ // TODO Disable everywhere?
271
+ "no-useless-constructor" : "off"
157
272
}
158
273
} ,
159
274
{
@@ -225,19 +340,14 @@ module.exports = [
225
340
allowExperimental : true
226
341
}
227
342
] ,
228
- "object-shorthand" : "off"
343
+ "object-shorthand" : "off" ,
344
+ camelcase : "off"
229
345
}
230
346
} ,
231
347
{
232
348
files : [ "examples/**/*.js" ] ,
233
349
rules : {
234
350
"n/no-missing-require" : "off"
235
351
}
236
- } ,
237
- {
238
- files : [ "lib/util/semver.js" ] ,
239
- rules : {
240
- "n/exports-style" : "off"
241
- }
242
352
}
243
353
] ;
0 commit comments