eslint-plugin-jsdoc 60.8.3 → 61.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,8 @@ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
8
  var _jsdoccomment = require("@es-joy/jsdoccomment");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  const digitRegex = /^(\d+(\.\d*)?|\.\d+)([eE][\-+]?\d+)?$/v;
11
+
12
+ // eslint-disable-next-line complexity -- Todo
11
13
  var _default = exports.default = (0, _iterateJsdoc.default)(({
12
14
  context,
13
15
  indent,
@@ -17,16 +19,32 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
17
19
  }) => {
18
20
  const {
19
21
  arrayBrackets = 'square',
22
+ arrowFunctionPostReturnMarkerSpacing = ' ',
23
+ arrowFunctionPreReturnMarkerSpacing = ' ',
20
24
  enableFixer = true,
25
+ functionOrClassParameterSpacing = ' ',
26
+ functionOrClassPostGenericSpacing = '',
27
+ functionOrClassPostReturnMarkerSpacing = ' ',
28
+ functionOrClassPreReturnMarkerSpacing = '',
29
+ functionOrClassTypeParameterSpacing = ' ',
30
+ genericAndTupleElementSpacing = ' ',
21
31
  genericDot = false,
32
+ keyValuePostColonSpacing = ' ',
33
+ keyValuePostKeySpacing = '',
34
+ keyValuePostOptionalSpacing = '',
35
+ keyValuePostVariadicSpacing = '',
36
+ methodQuotes = 'double',
22
37
  objectFieldIndent = '',
23
38
  objectFieldQuote = null,
24
39
  objectFieldSeparator = 'comma',
25
40
  objectFieldSeparatorOptionalLinebreak = true,
26
41
  objectFieldSeparatorTrailingPunctuation = false,
42
+ parameterDefaultValueSpacing = ' ',
43
+ postMethodNameSpacing = '',
44
+ postNewSpacing = ' ',
27
45
  // propertyQuotes = null,
28
46
  separatorForSingleObjectField = false,
29
- stringQuotes = 'single',
47
+ stringQuotes = 'double',
30
48
  typeBracketSpacing = '',
31
49
  unionSpacing = ' '
32
50
  } = context.options[0] || {};
@@ -187,7 +205,172 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
187
205
  // eslint-disable-next-line complexity -- Todo
188
206
  (0, _jsdoccomment.traverse)(parsedType, nde => {
189
207
  let errorMessage = '';
208
+
209
+ /**
210
+ * @param {Partial<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
211
+ * postNewSpacing?: string,
212
+ * postMethodNameSpacing?: string
213
+ * }} meta
214
+ * @returns {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
215
+ * postNewSpacing?: string,
216
+ * postMethodNameSpacing?: string
217
+ * }}
218
+ */
219
+ const conditionalAdds = meta => {
220
+ const typNode =
221
+ /**
222
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult|
223
+ * import('jsdoc-type-pratt-parser').CallSignatureResult|
224
+ * import('jsdoc-type-pratt-parser').ComputedMethodResult|
225
+ * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
226
+ * import('jsdoc-type-pratt-parser').MethodSignatureResult
227
+ * }
228
+ */
229
+ nde;
230
+
231
+ /**
232
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
233
+ * postNewSpacing?: string,
234
+ * postMethodNameSpacing?: string
235
+ * }}
236
+ */
237
+ const newMeta = {
238
+ parameterSpacing: meta.parameterSpacing ?? typNode.meta?.parameterSpacing ?? ' ',
239
+ postGenericSpacing: meta.postGenericSpacing ?? typNode.meta?.postGenericSpacing ?? '',
240
+ postReturnMarkerSpacing: meta.postReturnMarkerSpacing ?? typNode.meta?.postReturnMarkerSpacing ?? ' ',
241
+ preReturnMarkerSpacing: meta.preReturnMarkerSpacing ?? typNode.meta?.preReturnMarkerSpacing ?? '',
242
+ typeParameterSpacing: meta.typeParameterSpacing ?? typNode.meta?.typeParameterSpacing ?? ' '
243
+ };
244
+ if (typNode.type === 'JsdocTypeConstructorSignature') {
245
+ newMeta.postNewSpacing = meta.postNewSpacing;
246
+ }
247
+ if (typNode.type === 'JsdocTypeMethodSignature') {
248
+ newMeta.postMethodNameSpacing = meta.postMethodNameSpacing ?? typNode.meta?.postMethodNameSpacing ?? '';
249
+ }
250
+ return newMeta;
251
+ };
190
252
  switch (nde.type) {
253
+ case 'JsdocTypeConstructorSignature':
254
+ {
255
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').ConstructorSignatureResult} */nde;
256
+ /* c8 ignore next -- Guard */
257
+ if ((typeNode.meta?.postNewSpacing ?? ' ') !== postNewSpacing) {
258
+ typeNode.meta =
259
+ /**
260
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
261
+ * postNewSpacing: string,
262
+ * }}
263
+ */
264
+ conditionalAdds({
265
+ postNewSpacing
266
+ });
267
+ errorMessage = `Post-\`new\` spacing should be "${postNewSpacing}"`;
268
+ break;
269
+ }
270
+ }
271
+ case 'JsdocTypeFunction':
272
+ {
273
+ const typeNode =
274
+ /**
275
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult}
276
+ */
277
+ nde;
278
+ if ('arrow' in typeNode && typeNode.arrow) {
279
+ /* c8 ignore next -- Guard */
280
+ if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== arrowFunctionPostReturnMarkerSpacing) {
281
+ typeNode.meta =
282
+ /**
283
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
284
+ * postNewSpacing: string,
285
+ * }}
286
+ */
287
+ conditionalAdds({
288
+ postReturnMarkerSpacing: arrowFunctionPostReturnMarkerSpacing,
289
+ /* c8 ignore next -- Guard */
290
+ preReturnMarkerSpacing: typeNode.meta?.preReturnMarkerSpacing ?? ' '
291
+ });
292
+ errorMessage = `Post-return-marker spacing should be "${arrowFunctionPostReturnMarkerSpacing}"`;
293
+ break;
294
+ /* c8 ignore next -- Guard */
295
+ } else if ((typeNode.meta?.preReturnMarkerSpacing ?? ' ') !== arrowFunctionPreReturnMarkerSpacing) {
296
+ typeNode.meta =
297
+ /**
298
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
299
+ * postNewSpacing: string,
300
+ * }}
301
+ */
302
+ conditionalAdds({
303
+ /* c8 ignore next -- Guard */
304
+ postReturnMarkerSpacing: typeNode.meta?.postReturnMarkerSpacing ?? ' ',
305
+ preReturnMarkerSpacing: arrowFunctionPreReturnMarkerSpacing
306
+ });
307
+ errorMessage = `Pre-return-marker spacing should be "${arrowFunctionPreReturnMarkerSpacing}"`;
308
+ break;
309
+ }
310
+ break;
311
+ }
312
+ }
313
+ case 'JsdocTypeCallSignature':
314
+ case 'JsdocTypeComputedMethod':
315
+ case 'JsdocTypeMethodSignature':
316
+ {
317
+ const typeNode =
318
+ /**
319
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult|
320
+ * import('jsdoc-type-pratt-parser').CallSignatureResult|
321
+ * import('jsdoc-type-pratt-parser').ComputedMethodResult|
322
+ * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
323
+ * import('jsdoc-type-pratt-parser').MethodSignatureResult
324
+ * }
325
+ */
326
+ nde;
327
+ if (typeNode.type === 'JsdocTypeMethodSignature' && (typeNode.meta?.postMethodNameSpacing ?? '') !== postMethodNameSpacing) {
328
+ typeNode.meta = {
329
+ quote: typeNode.meta.quote,
330
+ ...conditionalAdds({
331
+ postMethodNameSpacing
332
+ })
333
+ };
334
+ errorMessage = `Post-method-name spacing should be "${postMethodNameSpacing}"`;
335
+ break;
336
+ } else if (typeNode.type === 'JsdocTypeMethodSignature' && typeNode.meta.quote !== undefined && typeNode.meta.quote !== methodQuotes) {
337
+ typeNode.meta = {
338
+ ...conditionalAdds({
339
+ postMethodNameSpacing: typeNode.meta.postMethodNameSpacing ?? ''
340
+ }),
341
+ quote: methodQuotes
342
+ };
343
+ errorMessage = `Method quoting style should be "${methodQuotes}"`;
344
+ break;
345
+ }
346
+ if ((typeNode.meta?.parameterSpacing ?? ' ') !== functionOrClassParameterSpacing) {
347
+ typeNode.meta = conditionalAdds({
348
+ parameterSpacing: functionOrClassParameterSpacing
349
+ });
350
+ errorMessage = `Parameter spacing should be "${functionOrClassParameterSpacing}"`;
351
+ } else if ((typeNode.meta?.postGenericSpacing ?? '') !== functionOrClassPostGenericSpacing) {
352
+ typeNode.meta = conditionalAdds({
353
+ postGenericSpacing: functionOrClassPostGenericSpacing
354
+ });
355
+ errorMessage = `Post-generic spacing should be "${functionOrClassPostGenericSpacing}"`;
356
+ } else if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== functionOrClassPostReturnMarkerSpacing) {
357
+ typeNode.meta = conditionalAdds({
358
+ postReturnMarkerSpacing: functionOrClassPostReturnMarkerSpacing
359
+ });
360
+ errorMessage = `Post-return-marker spacing should be "${functionOrClassPostReturnMarkerSpacing}"`;
361
+ } else if ((typeNode.meta?.preReturnMarkerSpacing ?? '') !== functionOrClassPreReturnMarkerSpacing) {
362
+ typeNode.meta = conditionalAdds({
363
+ preReturnMarkerSpacing: functionOrClassPreReturnMarkerSpacing
364
+ });
365
+ errorMessage = `Pre-return-marker spacing should be "${functionOrClassPreReturnMarkerSpacing}"`;
366
+ } else if ((typeNode.meta?.typeParameterSpacing ?? ' ') !== functionOrClassTypeParameterSpacing) {
367
+ typeNode.meta = conditionalAdds({
368
+ typeParameterSpacing: functionOrClassTypeParameterSpacing
369
+ });
370
+ errorMessage = `Type parameter spacing should be "${functionOrClassTypeParameterSpacing}"`;
371
+ }
372
+ break;
373
+ }
191
374
  case 'JsdocTypeGeneric':
192
375
  {
193
376
  const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */nde;
@@ -199,6 +382,57 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
199
382
  } else if (typeNode.meta.dot !== genericDot) {
200
383
  typeNode.meta.dot = genericDot;
201
384
  errorMessage = `Dot usage should be ${genericDot}`;
385
+ } else if ((typeNode.meta.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
386
+ typeNode.meta.elementSpacing = genericAndTupleElementSpacing;
387
+ errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
388
+ }
389
+ break;
390
+ }
391
+ case 'JsdocTypeKeyValue':
392
+ {
393
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').KeyValueResult} */nde;
394
+ /* c8 ignore next -- Guard */
395
+ if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
396
+ typeNode.meta = {
397
+ /* c8 ignore next -- Guard */
398
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
399
+ postKeySpacing: keyValuePostKeySpacing,
400
+ /* c8 ignore next 2 -- Guard */
401
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
402
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
403
+ };
404
+ errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
405
+ /* c8 ignore next -- Guard */
406
+ } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
407
+ typeNode.meta = {
408
+ postColonSpacing: keyValuePostColonSpacing,
409
+ /* c8 ignore next 3 -- Guard */
410
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
411
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
412
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
413
+ };
414
+ errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
415
+ /* c8 ignore next -- Guard */
416
+ } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
417
+ typeNode.meta = {
418
+ /* c8 ignore next 2 -- Guard */
419
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
420
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
421
+ postOptionalSpacing: keyValuePostOptionalSpacing,
422
+ /* c8 ignore next -- Guard */
423
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? ''
424
+ };
425
+ errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
426
+ /* c8 ignore next -- Guard */
427
+ } else if (typeNode.variadic && (typeNode.meta?.postVariadicSpacing ?? '') !== keyValuePostVariadicSpacing) {
428
+ typeNode.meta = {
429
+ /* c8 ignore next 3 -- Guard */
430
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
431
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
432
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
433
+ postVariadicSpacing: keyValuePostVariadicSpacing
434
+ };
435
+ errorMessage = `Post variadic (\`...\`) spacing should be "${keyValuePostVariadicSpacing}"`;
202
436
  }
203
437
  break;
204
438
  }
@@ -222,6 +456,24 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
222
456
  if ((objectFieldQuote || typeof typeNode.key === 'string' && (/^[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*$/v.test(typeNode.key) || digitRegex.test(typeNode.key))) && typeNode.meta.quote !== (objectFieldQuote ?? undefined) && (typeof typeNode.key !== 'string' || !digitRegex.test(typeNode.key))) {
223
457
  typeNode.meta.quote = objectFieldQuote ?? undefined;
224
458
  errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;
459
+ } else if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
460
+ typeNode.meta.postKeySpacing = keyValuePostKeySpacing;
461
+ errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
462
+ } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
463
+ typeNode.meta.postColonSpacing = keyValuePostColonSpacing;
464
+ errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
465
+ } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
466
+ typeNode.meta.postOptionalSpacing = keyValuePostOptionalSpacing;
467
+ errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
468
+ }
469
+ break;
470
+ }
471
+ case 'JsdocTypeStringValue':
472
+ {
473
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */nde;
474
+ if (typeNode.meta.quote !== stringQuotes) {
475
+ typeNode.meta.quote = stringQuotes;
476
+ errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
225
477
  }
226
478
  break;
227
479
  }
@@ -241,12 +493,27 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
241
493
  // break;
242
494
  // }
243
495
 
244
- case 'JsdocTypeStringValue':
496
+ case 'JsdocTypeTuple':
245
497
  {
246
- const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */nde;
247
- if (typeNode.meta.quote !== stringQuotes) {
248
- typeNode.meta.quote = stringQuotes;
249
- errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
498
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').TupleResult} */nde;
499
+ /* c8 ignore next -- Guard */
500
+ if ((typeNode.meta?.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
501
+ typeNode.meta = {
502
+ elementSpacing: genericAndTupleElementSpacing
503
+ };
504
+ errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
505
+ }
506
+ break;
507
+ }
508
+ case 'JsdocTypeTypeParameter':
509
+ {
510
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').TypeParameterResult} */nde;
511
+ /* c8 ignore next -- Guard */
512
+ if (typeNode.defaultValue && (typeNode.meta?.defaultValueSpacing ?? ' ') !== parameterDefaultValueSpacing) {
513
+ typeNode.meta = {
514
+ defaultValueSpacing: parameterDefaultValueSpacing
515
+ };
516
+ errorMessage = `Default value spacing should be "${parameterDefaultValueSpacing}"`;
250
517
  }
251
518
  break;
252
519
  }
@@ -302,14 +569,67 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
302
569
  enum: ['angle', 'square'],
303
570
  type: 'string'
304
571
  },
572
+ arrowFunctionPostReturnMarkerSpacing: {
573
+ description: 'The space character (if any) to use after return markers (`=>`). Defaults to " ".',
574
+ type: 'string'
575
+ },
576
+ arrowFunctionPreReturnMarkerSpacing: {
577
+ description: 'The space character (if any) to use before return markers (`=>`). Defaults to " ".',
578
+ type: 'string'
579
+ },
305
580
  enableFixer: {
306
581
  description: 'Whether to enable the fixer. Defaults to `true`.',
307
582
  type: 'boolean'
308
583
  },
584
+ functionOrClassParameterSpacing: {
585
+ description: 'The space character (if any) to use between function or class parameters. Defaults to " ".',
586
+ type: 'string'
587
+ },
588
+ functionOrClassPostGenericSpacing: {
589
+ description: 'The space character (if any) to use after a generic expression in a function or class. Defaults to "".',
590
+ type: 'string'
591
+ },
592
+ functionOrClassPostReturnMarkerSpacing: {
593
+ description: 'The space character (if any) to use after return markers (`:`). Defaults to "".',
594
+ type: 'string'
595
+ },
596
+ functionOrClassPreReturnMarkerSpacing: {
597
+ description: 'The space character (if any) to use before return markers (`:`). Defaults to "".',
598
+ type: 'string'
599
+ },
600
+ functionOrClassTypeParameterSpacing: {
601
+ description: 'The space character (if any) to use between type parameters in a function or class. Defaults to " ".',
602
+ type: 'string'
603
+ },
604
+ genericAndTupleElementSpacing: {
605
+ description: 'The space character (if any) to use between elements in generics and tuples. Defaults to " ".',
606
+ type: 'string'
607
+ },
309
608
  genericDot: {
310
609
  description: 'Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.',
311
610
  type: 'boolean'
312
611
  },
612
+ keyValuePostColonSpacing: {
613
+ description: 'The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to " ".',
614
+ type: 'string'
615
+ },
616
+ keyValuePostKeySpacing: {
617
+ description: 'The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to "".',
618
+ type: 'string'
619
+ },
620
+ keyValuePostOptionalSpacing: {
621
+ description: 'The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to "".',
622
+ type: 'string'
623
+ },
624
+ keyValuePostVariadicSpacing: {
625
+ description: 'The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to "".',
626
+ type: 'string'
627
+ },
628
+ methodQuotes: {
629
+ description: 'The style of quotation mark for surrounding method names when quoted. Defaults to `double`',
630
+ enum: ['double', 'single'],
631
+ type: 'string'
632
+ },
313
633
  objectFieldIndent: {
314
634
  description: `A string indicating the whitespace to be added on each line preceding an
315
635
  object property-value field. Defaults to the empty string.`,
@@ -346,6 +666,18 @@ will determine whether to add punctuation corresponding to the
346
666
  Defaults to \`false\`.`,
347
667
  type: 'boolean'
348
668
  },
669
+ parameterDefaultValueSpacing: {
670
+ description: 'The space character (if any) to use between the equal signs of a default value. Defaults to " ".',
671
+ type: 'string'
672
+ },
673
+ postMethodNameSpacing: {
674
+ description: 'The space character (if any) to add after a method name. Defaults to "".',
675
+ type: 'string'
676
+ },
677
+ postNewSpacing: {
678
+ description: 'The space character (if any) to add after "new" in a constructor. Defaults to " ".',
679
+ type: 'string'
680
+ },
349
681
  // propertyQuotes: {
350
682
  // description: `Whether and how namepath properties should be quoted (e.g., \`ab."cd"."ef"\`).
351
683
  // Set to \`single\`, \`double\`, or \`null\`. Defaults to \`null\` (no quotes unless
@@ -363,7 +695,7 @@ is only one property-value object field present. Defaults to \`false\`.`,
363
695
  },
364
696
  stringQuotes: {
365
697
  description: `How string literals should be quoted (e.g., \`"abc"\`). Set to \`single\`
366
- or \`double\`. Defaults to 'single'.`,
698
+ or \`double\`. Defaults to 'double'.`,
367
699
  enum: ['double', 'single'],
368
700
  type: 'string'
369
701
  },
@@ -1 +1 @@
1
- {"version":3,"file":"typeFormatting.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","digitRegex","_default","exports","iterateJsdoc","context","indent","jsdoc","settings","utils","arrayBrackets","enableFixer","genericDot","objectFieldIndent","objectFieldQuote","objectFieldSeparator","objectFieldSeparatorOptionalLinebreak","objectFieldSeparatorTrailingPunctuation","separatorForSingleObjectField","stringQuotes","typeBracketSpacing","unionSpacing","options","mode","checkTypeFormats","tag","potentialType","type","parsedType","tryParseType","parseType","fix","typeLines","stringify","split","firstTypeLine","shift","lastTypeLine","pop","beginNameOrDescIdx","source","findIndex","tokens","name","description","nameAndDesc","slice","initialNumber","number","src","length","end","postName","postType","undefined","map","typeLine","idx","delimiter","postTag","start","push","firstTagIdx","tg","initialEndSource","find","tags","flatMap","at","errorMessages","startsWith","endsWith","test","traverse","nde","errorMessage","typeNode","left","value","meta","brackets","dot","separator","propertyIndent","trailingPunctuation","replace","key","quote","spacing","differentResult","reportJSDoc","getPresentTags","iterateAllJsdocs","docs","url","fixable","schema","additionalProperties","properties","enum","module"],"sources":["../../src/rules/typeFormatting.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n stringify,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nconst digitRegex = (/^(\\d+(\\.\\d*)?|\\.\\d+)([eE][\\-+]?\\d+)?$/v);\n\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n settings,\n utils,\n}) => {\n const {\n arrayBrackets = 'square',\n enableFixer = true,\n genericDot = false,\n objectFieldIndent = '',\n objectFieldQuote = null,\n objectFieldSeparator = 'comma',\n objectFieldSeparatorOptionalLinebreak = true,\n objectFieldSeparatorTrailingPunctuation = false,\n // propertyQuotes = null,\n separatorForSingleObjectField = false,\n stringQuotes = 'single',\n typeBracketSpacing = '',\n unionSpacing = ' ',\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n /**\n * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag\n */\n const checkTypeFormats = (tag) => {\n const potentialType = tag.type;\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode);\n } catch {\n return;\n }\n\n const fix = () => {\n const typeLines = stringify(parsedType).split('\\n');\n const firstTypeLine = typeLines.shift();\n const lastTypeLine = typeLines.pop();\n\n const beginNameOrDescIdx = tag.source.findIndex(({\n tokens,\n }) => {\n return tokens.name || tokens.description;\n });\n\n const nameAndDesc = beginNameOrDescIdx === -1 ?\n null :\n tag.source.slice(beginNameOrDescIdx);\n\n const initialNumber = tag.source[0].number;\n const src = [\n // Get inevitably present tag from first `tag.source`\n {\n number: initialNumber,\n source: '',\n tokens: {\n ...tag.source[0].tokens,\n ...(typeLines.length || lastTypeLine ? {\n end: '',\n name: '',\n postName: '',\n postType: '',\n } : {}),\n type: '{' + typeBracketSpacing + firstTypeLine + (!typeLines.length && lastTypeLine === undefined ? typeBracketSpacing + '}' : ''),\n },\n },\n // Get any intervening type lines\n ...(typeLines.length ? typeLines.map((typeLine, idx) => {\n return {\n number: initialNumber + idx + 1,\n source: '',\n tokens: {\n // Grab any delimiter info from first item\n ...tag.source[0].tokens,\n delimiter: tag.source[0].tokens.delimiter === '/**' ? '*' : tag.source[0].tokens.delimiter,\n end: '',\n name: '',\n postName: '',\n postTag: '',\n postType: '',\n start: indent + ' ',\n tag: '',\n type: typeLine,\n },\n };\n }) : []),\n ];\n\n // Merge any final type line and name and description\n if (\n // Name and description may be already included if present with the tag\n nameAndDesc && beginNameOrDescIdx > 0\n ) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n type: lastTypeLine + typeBracketSpacing + '}',\n },\n });\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n } else if (nameAndDesc) {\n if (lastTypeLine) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n delimiter: nameAndDesc[0].tokens.delimiter === '/**' ? '*' : nameAndDesc[0].tokens.delimiter,\n postTag: '',\n start: indent + ' ',\n tag: '',\n type: lastTypeLine + typeBracketSpacing + '}',\n },\n });\n }\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n }\n\n tag.source = src;\n\n // Properly rewire `jsdoc.source`\n const firstTagIdx = jsdoc.source.findIndex(({\n tokens: {\n tag: tg,\n },\n }) => {\n return tg;\n });\n\n const initialEndSource = jsdoc.source.find(({\n tokens: {\n end,\n },\n }) => {\n return end;\n });\n\n jsdoc.source = [\n ...jsdoc.source.slice(0, firstTagIdx),\n ...jsdoc.tags.flatMap(({\n source,\n }) => {\n return source;\n }),\n ];\n\n if (initialEndSource && !jsdoc.source.at(-1)?.tokens?.end) {\n jsdoc.source.push(initialEndSource);\n }\n };\n\n /** @type {string[]} */\n const errorMessages = [];\n\n if (typeBracketSpacing && (!tag.type.startsWith(typeBracketSpacing) || !tag.type.endsWith(typeBracketSpacing))) {\n errorMessages.push(`Must have initial and final \"${typeBracketSpacing}\" spacing`);\n } else if (!typeBracketSpacing && ((/^\\s/v).test(tag.type) || (/\\s$/v).test(tag.type))) {\n errorMessages.push('Must have no initial spacing');\n }\n\n // eslint-disable-next-line complexity -- Todo\n traverse(parsedType, (nde) => {\n let errorMessage = '';\n\n switch (nde.type) {\n case 'JsdocTypeGeneric': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */ (nde);\n if ('value' in typeNode.left && typeNode.left.value === 'Array') {\n if (typeNode.meta.brackets !== arrayBrackets) {\n typeNode.meta.brackets = arrayBrackets;\n errorMessage = `Array bracket style should be ${arrayBrackets}`;\n }\n } else if (typeNode.meta.dot !== genericDot) {\n typeNode.meta.dot = genericDot;\n errorMessage = `Dot usage should be ${genericDot}`;\n }\n\n break;\n }\n\n case 'JsdocTypeObject': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectResult} */ (nde);\n /* c8 ignore next -- Guard */\n const separator = typeNode.meta.separator ?? 'comma';\n if (\n (separator !== objectFieldSeparator &&\n (!objectFieldSeparatorOptionalLinebreak ||\n !(objectFieldSeparator.endsWith('-linebreak') &&\n objectFieldSeparator.startsWith(separator)))) ||\n (typeNode.meta.separatorForSingleObjectField ?? false) !== separatorForSingleObjectField ||\n ((typeNode.meta.propertyIndent ?? '') !== objectFieldIndent &&\n separator.endsWith('-linebreak')) ||\n (typeNode.meta.trailingPunctuation ?? false) !== objectFieldSeparatorTrailingPunctuation\n ) {\n typeNode.meta.separator = objectFieldSeparatorOptionalLinebreak && !separator.endsWith('and-linebreak') ?\n objectFieldSeparator.replace(/-and-linebreak$/v, '') :\n objectFieldSeparator;\n typeNode.meta.separatorForSingleObjectField = separatorForSingleObjectField;\n typeNode.meta.propertyIndent = objectFieldIndent;\n typeNode.meta.trailingPunctuation = objectFieldSeparatorTrailingPunctuation;\n errorMessage = `Inconsistent ${objectFieldSeparator} separator usage`;\n }\n\n break;\n }\n\n case 'JsdocTypeObjectField': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectFieldResult} */ (nde);\n if ((objectFieldQuote ||\n (typeof typeNode.key === 'string' &&\n (\n (/^[\\p{ID_Start}$_][\\p{ID_Continue}$\\u200C\\u200D]*$/v).test(typeNode.key) ||\n digitRegex.test(typeNode.key)\n )\n )) &&\n typeNode.meta.quote !== (objectFieldQuote ?? undefined) &&\n (typeof typeNode.key !== 'string' ||\n !digitRegex.test(typeNode.key))\n ) {\n typeNode.meta.quote = objectFieldQuote ?? undefined;\n errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;\n }\n\n break;\n }\n\n // Only suitable for namepaths (and would need changes); see https://github.com/gajus/eslint-plugin-jsdoc/issues/1524\n // case 'JsdocTypeProperty': {\n // const typeNode = /** @type {import('jsdoc-type-pratt-parser').PropertyResult} */ (nde);\n\n // if ((propertyQuotes ||\n // (typeof typeNode.value === 'string' && !(/\\s/v).test(typeNode.value))) &&\n // typeNode.meta.quote !== (propertyQuotes ?? undefined)\n // ) {\n // typeNode.meta.quote = propertyQuotes ?? undefined;\n // errorMessage = `Inconsistent ${propertyQuotes} property quotes usage`;\n // }\n\n // break;\n // }\n\n case 'JsdocTypeStringValue': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */ (nde);\n if (typeNode.meta.quote !== stringQuotes) {\n typeNode.meta.quote = stringQuotes;\n errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;\n }\n\n break;\n }\n\n case 'JsdocTypeUnion': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').UnionResult} */ (nde);\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.spacing ?? ' ') !== unionSpacing) {\n typeNode.meta = {\n spacing: unionSpacing,\n };\n errorMessage = `Inconsistent \"${unionSpacing}\" union spacing usage`;\n }\n\n break;\n }\n\n default:\n break;\n }\n\n if (errorMessage) {\n errorMessages.push(errorMessage);\n }\n });\n\n const differentResult = tag.type !==\n typeBracketSpacing + stringify(parsedType) + typeBracketSpacing;\n\n if (errorMessages.length && differentResult) {\n for (const errorMessage of errorMessages) {\n utils.reportJSDoc(\n errorMessage, tag, enableFixer ? fix : null,\n );\n }\n // Stringification may have been equal previously (and thus no error reported)\n // because the stringification doesn't preserve everything\n } else if (differentResult) {\n utils.reportJSDoc(\n 'There was an error with type formatting', tag, enableFixer ? fix : null,\n );\n }\n };\n\n const tags = utils.getPresentTags([\n 'param',\n 'property',\n 'returns',\n 'this',\n 'throws',\n 'type',\n 'typedef',\n 'yields',\n ]);\n for (const tag of tags) {\n if (tag.type) {\n checkTypeFormats(tag);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Formats JSDoc type values.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n arrayBrackets: {\n description: 'Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to \"square\".',\n enum: [\n 'angle',\n 'square',\n ],\n type: 'string',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n genericDot: {\n description: 'Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.',\n type: 'boolean',\n },\n objectFieldIndent: {\n description: `A string indicating the whitespace to be added on each line preceding an\nobject property-value field. Defaults to the empty string.`,\n type: 'string',\n },\n objectFieldQuote: {\n description: `Whether and how object field properties should be quoted (e.g., \\`{\"a\": string}\\`).\nSet to \\`single\\`, \\`double\\`, or \\`null\\`. Defaults to \\`null\\` (no quotes unless\nrequired due to special characters within the field). Digits will be kept as is,\nregardless of setting (they can either represent a digit or a string digit).`,\n enum: [\n 'double',\n 'single',\n null,\n ],\n },\n objectFieldSeparator: {\n description: `For object properties, specify whether a \"semicolon\", \"comma\", \"linebreak\",\n\"semicolon-and-linebreak\", or \"comma-and-linebreak\" should be used after\neach object property-value pair.\n\nDefaults to \\`\"comma\"\\`.`,\n enum: [\n 'comma',\n 'comma-and-linebreak',\n 'linebreak',\n 'semicolon',\n 'semicolon-and-linebreak',\n ],\n type: 'string',\n },\n objectFieldSeparatorOptionalLinebreak: {\n description: `Whether \\`objectFieldSeparator\\` set to \\`\"semicolon-and-linebreak\"\\` or\n\\`\"comma-and-linebreak\"\\` should be allowed to optionally drop the linebreak.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n objectFieldSeparatorTrailingPunctuation: {\n description: `If \\`separatorForSingleObjectField\\` is not in effect (i.e., if it is \\`false\\`\nor there are multiple property-value object fields present), this property\nwill determine whether to add punctuation corresponding to the\n\\`objectFieldSeparator\\` (e.g., a semicolon) to the final object field.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n // propertyQuotes: {\n // description: `Whether and how namepath properties should be quoted (e.g., \\`ab.\"cd\".\"ef\"\\`).\n // Set to \\`single\\`, \\`double\\`, or \\`null\\`. Defaults to \\`null\\` (no quotes unless\n // required due to whitespace within the property).`,\n // enum: [\n // 'double',\n // 'single',\n // null,\n // ],\n // },\n separatorForSingleObjectField: {\n description: `Whether to apply the \\`objectFieldSeparator\\` (e.g., a semicolon) when there\nis only one property-value object field present. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n stringQuotes: {\n description: `How string literals should be quoted (e.g., \\`\"abc\"\\`). Set to \\`single\\`\nor \\`double\\`. Defaults to 'single'.`,\n enum: [\n 'double',\n 'single',\n ],\n type: 'string',\n },\n typeBracketSpacing: {\n description: `A string of spaces that will be added immediately after the type's initial\ncurly bracket and immediately before its ending curly bracket. Defaults\nto the empty string.`,\n type: 'string',\n },\n unionSpacing: {\n description: 'Determines the spacing to add to unions (`|`). Defaults to a single space (`\" \"`).',\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAK8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,UAAU,GAAI,wCAAyC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAE/C,IAAAI,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,aAAa,GAAG,QAAQ;IACxBC,WAAW,GAAG,IAAI;IAClBC,UAAU,GAAG,KAAK;IAClBC,iBAAiB,GAAG,EAAE;IACtBC,gBAAgB,GAAG,IAAI;IACvBC,oBAAoB,GAAG,OAAO;IAC9BC,qCAAqC,GAAG,IAAI;IAC5CC,uCAAuC,GAAG,KAAK;IAC/C;IACAC,6BAA6B,GAAG,KAAK;IACrCC,YAAY,GAAG,QAAQ;IACvBC,kBAAkB,GAAG,EAAE;IACvBC,YAAY,GAAG;EACjB,CAAC,GAAGhB,O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B;AACA;AACA,sBAAsB;UACVjB,IAAI,EAAE;QACR,CAAC;QACDV,uCAAuC,EAAE;UACvC2B,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXjB,IAAI,EAAE;QACR,CAAC;QACD;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACAT,6BAA6B,EAAE;UAC7B0B,WAAW,EAAE;AACzB,wEAAwE;UAC5DjB,IAAI,EAAE;QACR,CAAC;QACDR,YAAY,EAAE;UACZyB,WAAW,EAAE;AACzB,qCAAqC;UACzBuD,IAAI,EAAE,CACJ,QAAQ,EACR,QAAQ,CACT;UACDxE,IAAI,EAAE;QACR,CAAC;QACDP,kBAAkB,EAAE;UAClBwB,WAAW,EAAE;AACzB;AACA,qBAAqB;UACTjB,IAAI,EAAE;QACR,CAAC;QACDN,YAAY,EAAE;UACZuB,WAAW,EAAE,oFAAoF;UACjGjB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAyE,MAAA,CAAAjG,OAAA,GAAAA,OAAA,CAAAH,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"typeFormatting.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","digitRegex","_default","exports","iterateJsdoc","context","indent","jsdoc","settings","utils","arrayBrackets","arrowFunctionPostReturnMarkerSpacing","arrowFunctionPreReturnMarkerSpacing","enableFixer","functionOrClassParameterSpacing","functionOrClassPostGenericSpacing","functionOrClassPostReturnMarkerSpacing","functionOrClassPreReturnMarkerSpacing","functionOrClassTypeParameterSpacing","genericAndTupleElementSpacing","genericDot","keyValuePostColonSpacing","keyValuePostKeySpacing","keyValuePostOptionalSpacing","keyValuePostVariadicSpacing","methodQuotes","objectFieldIndent","objectFieldQuote","objectFieldSeparator","objectFieldSeparatorOptionalLinebreak","objectFieldSeparatorTrailingPunctuation","parameterDefaultValueSpacing","postMethodNameSpacing","postNewSpacing","separatorForSingleObjectField","stringQuotes","typeBracketSpacing","unionSpacing","options","mode","checkTypeFormats","tag","potentialType","type","parsedType","tryParseType","parseType","fix","typeLines","stringify","split","firstTypeLine","shift","lastTypeLine","pop","beginNameOrDescIdx","source","findIndex","tokens","name","description","nameAndDesc","slice","initialNumber","number","src","length","end","postName","postType","undefined","map","typeLine","idx","delimiter","postTag","start","push","firstTagIdx","tg","initialEndSource","find","tags","flatMap","at","errorMessages","startsWith","endsWith","test","traverse","nde","errorMessage","conditionalAdds","meta","typNode","newMeta","parameterSpacing","postGenericSpacing","postReturnMarkerSpacing","preReturnMarkerSpacing","typeParameterSpacing","typeNode","arrow","quote","left","value","brackets","dot","elementSpacing","postKeySpacing","postColonSpacing","postOptionalSpacing","postVariadicSpacing","variadic","separator","propertyIndent","trailingPunctuation","replace","key","defaultValue","defaultValueSpacing","spacing","differentResult","reportJSDoc","getPresentTags","iterateAllJsdocs","docs","url","fixable","schema","additionalProperties","properties","enum","module"],"sources":["../../src/rules/typeFormatting.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n stringify,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nconst digitRegex = (/^(\\d+(\\.\\d*)?|\\.\\d+)([eE][\\-+]?\\d+)?$/v);\n\n// eslint-disable-next-line complexity -- Todo\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n settings,\n utils,\n}) => {\n const {\n arrayBrackets = 'square',\n arrowFunctionPostReturnMarkerSpacing = ' ',\n arrowFunctionPreReturnMarkerSpacing = ' ',\n enableFixer = true,\n functionOrClassParameterSpacing = ' ',\n functionOrClassPostGenericSpacing = '',\n functionOrClassPostReturnMarkerSpacing = ' ',\n functionOrClassPreReturnMarkerSpacing = '',\n functionOrClassTypeParameterSpacing = ' ',\n genericAndTupleElementSpacing = ' ',\n genericDot = false,\n keyValuePostColonSpacing = ' ',\n keyValuePostKeySpacing = '',\n keyValuePostOptionalSpacing = '',\n keyValuePostVariadicSpacing = '',\n methodQuotes = 'double',\n objectFieldIndent = '',\n objectFieldQuote = null,\n objectFieldSeparator = 'comma',\n objectFieldSeparatorOptionalLinebreak = true,\n objectFieldSeparatorTrailingPunctuation = false,\n parameterDefaultValueSpacing = ' ',\n postMethodNameSpacing = '',\n postNewSpacing = ' ',\n // propertyQuotes = null,\n separatorForSingleObjectField = false,\n stringQuotes = 'double',\n typeBracketSpacing = '',\n unionSpacing = ' ',\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n /**\n * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag\n */\n const checkTypeFormats = (tag) => {\n const potentialType = tag.type;\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode);\n } catch {\n return;\n }\n\n const fix = () => {\n const typeLines = stringify(parsedType).split('\\n');\n const firstTypeLine = typeLines.shift();\n const lastTypeLine = typeLines.pop();\n\n const beginNameOrDescIdx = tag.source.findIndex(({\n tokens,\n }) => {\n return tokens.name || tokens.description;\n });\n\n const nameAndDesc = beginNameOrDescIdx === -1 ?\n null :\n tag.source.slice(beginNameOrDescIdx);\n\n const initialNumber = tag.source[0].number;\n const src = [\n // Get inevitably present tag from first `tag.source`\n {\n number: initialNumber,\n source: '',\n tokens: {\n ...tag.source[0].tokens,\n ...(typeLines.length || lastTypeLine ? {\n end: '',\n name: '',\n postName: '',\n postType: '',\n } : {}),\n type: '{' + typeBracketSpacing + firstTypeLine + (!typeLines.length && lastTypeLine === undefined ? typeBracketSpacing + '}' : ''),\n },\n },\n // Get any intervening type lines\n ...(typeLines.length ? typeLines.map((typeLine, idx) => {\n return {\n number: initialNumber + idx + 1,\n source: '',\n tokens: {\n // Grab any delimiter info from first item\n ...tag.source[0].tokens,\n delimiter: tag.source[0].tokens.delimiter === '/**' ? '*' : tag.source[0].tokens.delimiter,\n end: '',\n name: '',\n postName: '',\n postTag: '',\n postType: '',\n start: indent + ' ',\n tag: '',\n type: typeLine,\n },\n };\n }) : []),\n ];\n\n // Merge any final type line and name and description\n if (\n // Name and description may be already included if present with the tag\n nameAndDesc && beginNameOrDescIdx > 0\n ) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n type: lastTypeLine + typeBracketSpacing + '}',\n },\n });\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n } else if (nameAndDesc) {\n if (lastTypeLine) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n delimiter: nameAndDesc[0].tokens.delimiter === '/**' ? '*' : nameAndDesc[0].tokens.delimiter,\n postTag: '',\n start: indent + ' ',\n tag: '',\n type: lastTypeLine + typeBracketSpacing + '}',\n },\n });\n }\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n }\n\n tag.source = src;\n\n // Properly rewire `jsdoc.source`\n const firstTagIdx = jsdoc.source.findIndex(({\n tokens: {\n tag: tg,\n },\n }) => {\n return tg;\n });\n\n const initialEndSource = jsdoc.source.find(({\n tokens: {\n end,\n },\n }) => {\n return end;\n });\n\n jsdoc.source = [\n ...jsdoc.source.slice(0, firstTagIdx),\n ...jsdoc.tags.flatMap(({\n source,\n }) => {\n return source;\n }),\n ];\n\n if (initialEndSource && !jsdoc.source.at(-1)?.tokens?.end) {\n jsdoc.source.push(initialEndSource);\n }\n };\n\n /** @type {string[]} */\n const errorMessages = [];\n\n if (typeBracketSpacing && (!tag.type.startsWith(typeBracketSpacing) || !tag.type.endsWith(typeBracketSpacing))) {\n errorMessages.push(`Must have initial and final \"${typeBracketSpacing}\" spacing`);\n } else if (!typeBracketSpacing && ((/^\\s/v).test(tag.type) || (/\\s$/v).test(tag.type))) {\n errorMessages.push('Must have no initial spacing');\n }\n\n // eslint-disable-next-line complexity -- Todo\n traverse(parsedType, (nde) => {\n let errorMessage = '';\n\n /**\n * @param {Partial<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing?: string,\n * postMethodNameSpacing?: string\n * }} meta\n * @returns {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing?: string,\n * postMethodNameSpacing?: string\n * }}\n */\n const conditionalAdds = (meta) => {\n const typNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').FunctionResult|\n * import('jsdoc-type-pratt-parser').CallSignatureResult|\n * import('jsdoc-type-pratt-parser').ComputedMethodResult|\n * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|\n * import('jsdoc-type-pratt-parser').MethodSignatureResult\n * }\n */ (nde);\n\n /**\n * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing?: string,\n * postMethodNameSpacing?: string\n * }}\n */\n const newMeta = {\n parameterSpacing: meta.parameterSpacing ?? typNode.meta?.parameterSpacing ?? ' ',\n postGenericSpacing: meta.postGenericSpacing ?? typNode.meta?.postGenericSpacing ?? '',\n postReturnMarkerSpacing: meta.postReturnMarkerSpacing ?? typNode.meta?.postReturnMarkerSpacing ?? ' ',\n preReturnMarkerSpacing: meta.preReturnMarkerSpacing ?? typNode.meta?.preReturnMarkerSpacing ?? '',\n typeParameterSpacing: meta.typeParameterSpacing ?? typNode.meta?.typeParameterSpacing ?? ' ',\n };\n\n if (typNode.type === 'JsdocTypeConstructorSignature') {\n newMeta.postNewSpacing = meta.postNewSpacing;\n }\n\n if (typNode.type === 'JsdocTypeMethodSignature') {\n newMeta.postMethodNameSpacing = meta.postMethodNameSpacing ?? typNode.meta?.postMethodNameSpacing ?? '';\n }\n\n return newMeta;\n };\n\n switch (nde.type) {\n case 'JsdocTypeConstructorSignature': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ConstructorSignatureResult} */ (nde);\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.postNewSpacing ?? ' ') !== postNewSpacing) {\n typeNode.meta =\n /**\n * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing: string,\n * }}\n */ (conditionalAdds({\n postNewSpacing,\n }));\n errorMessage = `Post-\\`new\\` spacing should be \"${postNewSpacing}\"`;\n break;\n }\n }\n\n case 'JsdocTypeFunction': {\n const typeNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').FunctionResult}\n */ nde;\n if ('arrow' in typeNode && typeNode.arrow) {\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== arrowFunctionPostReturnMarkerSpacing) {\n typeNode.meta =\n /**\n * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing: string,\n * }}\n */ (conditionalAdds({\n postReturnMarkerSpacing: arrowFunctionPostReturnMarkerSpacing,\n /* c8 ignore next -- Guard */\n preReturnMarkerSpacing: typeNode.meta?.preReturnMarkerSpacing ?? ' ',\n }));\n errorMessage = `Post-return-marker spacing should be \"${arrowFunctionPostReturnMarkerSpacing}\"`;\n break;\n /* c8 ignore next -- Guard */\n } else if ((typeNode.meta?.preReturnMarkerSpacing ?? ' ') !== arrowFunctionPreReturnMarkerSpacing) {\n typeNode.meta =\n /**\n * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {\n * postNewSpacing: string,\n * }}\n */ (conditionalAdds({\n /* c8 ignore next -- Guard */\n postReturnMarkerSpacing: typeNode.meta?.postReturnMarkerSpacing ?? ' ',\n preReturnMarkerSpacing: arrowFunctionPreReturnMarkerSpacing,\n }));\n errorMessage = `Pre-return-marker spacing should be \"${arrowFunctionPreReturnMarkerSpacing}\"`;\n break;\n }\n\n break;\n }\n }\n\n case 'JsdocTypeCallSignature':\n case 'JsdocTypeComputedMethod':\n case 'JsdocTypeMethodSignature': {\n const typeNode =\n /**\n * @type {import('jsdoc-type-pratt-parser').FunctionResult|\n * import('jsdoc-type-pratt-parser').CallSignatureResult|\n * import('jsdoc-type-pratt-parser').ComputedMethodResult|\n * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|\n * import('jsdoc-type-pratt-parser').MethodSignatureResult\n * }\n */ (nde);\n if (typeNode.type === 'JsdocTypeMethodSignature' &&\n (typeNode.meta?.postMethodNameSpacing ?? '') !== postMethodNameSpacing\n ) {\n typeNode.meta = {\n quote: typeNode.meta.quote,\n ...conditionalAdds({\n postMethodNameSpacing,\n }),\n };\n errorMessage = `Post-method-name spacing should be \"${postMethodNameSpacing}\"`;\n break;\n } else if (typeNode.type === 'JsdocTypeMethodSignature' &&\n typeNode.meta.quote !== undefined &&\n typeNode.meta.quote !== methodQuotes\n ) {\n typeNode.meta = {\n ...conditionalAdds({\n postMethodNameSpacing: typeNode.meta.postMethodNameSpacing ?? '',\n }),\n quote: methodQuotes,\n };\n errorMessage = `Method quoting style should be \"${methodQuotes}\"`;\n break;\n }\n\n if ((typeNode.meta?.parameterSpacing ?? ' ') !== functionOrClassParameterSpacing) {\n typeNode.meta = conditionalAdds({\n parameterSpacing: functionOrClassParameterSpacing,\n });\n errorMessage = `Parameter spacing should be \"${functionOrClassParameterSpacing}\"`;\n } else if ((typeNode.meta?.postGenericSpacing ?? '') !== functionOrClassPostGenericSpacing) {\n typeNode.meta = conditionalAdds({\n postGenericSpacing: functionOrClassPostGenericSpacing,\n });\n errorMessage = `Post-generic spacing should be \"${functionOrClassPostGenericSpacing}\"`;\n } else if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== functionOrClassPostReturnMarkerSpacing) {\n typeNode.meta = conditionalAdds({\n postReturnMarkerSpacing: functionOrClassPostReturnMarkerSpacing,\n });\n errorMessage = `Post-return-marker spacing should be \"${functionOrClassPostReturnMarkerSpacing}\"`;\n } else if ((typeNode.meta?.preReturnMarkerSpacing ?? '') !== functionOrClassPreReturnMarkerSpacing) {\n typeNode.meta = conditionalAdds({\n preReturnMarkerSpacing: functionOrClassPreReturnMarkerSpacing,\n });\n errorMessage = `Pre-return-marker spacing should be \"${functionOrClassPreReturnMarkerSpacing}\"`;\n } else if ((typeNode.meta?.typeParameterSpacing ?? ' ') !== functionOrClassTypeParameterSpacing) {\n typeNode.meta = conditionalAdds({\n typeParameterSpacing: functionOrClassTypeParameterSpacing,\n });\n errorMessage = `Type parameter spacing should be \"${functionOrClassTypeParameterSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeGeneric': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */ (nde);\n if ('value' in typeNode.left && typeNode.left.value === 'Array') {\n if (typeNode.meta.brackets !== arrayBrackets) {\n typeNode.meta.brackets = arrayBrackets;\n errorMessage = `Array bracket style should be ${arrayBrackets}`;\n }\n } else if (typeNode.meta.dot !== genericDot) {\n typeNode.meta.dot = genericDot;\n errorMessage = `Dot usage should be ${genericDot}`;\n } else if ((typeNode.meta.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {\n typeNode.meta.elementSpacing = genericAndTupleElementSpacing;\n errorMessage = `Element spacing should be \"${genericAndTupleElementSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeKeyValue': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').KeyValueResult} */ (nde);\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {\n typeNode.meta = {\n /* c8 ignore next -- Guard */\n postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',\n postKeySpacing: keyValuePostKeySpacing,\n /* c8 ignore next 2 -- Guard */\n postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',\n postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',\n };\n errorMessage = `Post key spacing should be \"${keyValuePostKeySpacing}\"`;\n /* c8 ignore next -- Guard */\n } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {\n typeNode.meta = {\n postColonSpacing: keyValuePostColonSpacing,\n /* c8 ignore next 3 -- Guard */\n postKeySpacing: typeNode.meta?.postKeySpacing ?? '',\n postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',\n postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',\n };\n errorMessage = `Post colon spacing should be \"${keyValuePostColonSpacing}\"`;\n /* c8 ignore next -- Guard */\n } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {\n typeNode.meta = {\n /* c8 ignore next 2 -- Guard */\n postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',\n postKeySpacing: typeNode.meta?.postKeySpacing ?? '',\n postOptionalSpacing: keyValuePostOptionalSpacing,\n /* c8 ignore next -- Guard */\n postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',\n };\n errorMessage = `Post optional (\\`?\\`) spacing should be \"${keyValuePostOptionalSpacing}\"`;\n /* c8 ignore next -- Guard */\n } else if (typeNode.variadic && (typeNode.meta?.postVariadicSpacing ?? '') !== keyValuePostVariadicSpacing) {\n typeNode.meta = {\n /* c8 ignore next 3 -- Guard */\n postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',\n postKeySpacing: typeNode.meta?.postKeySpacing ?? '',\n postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',\n postVariadicSpacing: keyValuePostVariadicSpacing,\n };\n errorMessage = `Post variadic (\\`...\\`) spacing should be \"${keyValuePostVariadicSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeObject': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectResult} */ (nde);\n /* c8 ignore next -- Guard */\n const separator = typeNode.meta.separator ?? 'comma';\n if (\n (separator !== objectFieldSeparator &&\n (!objectFieldSeparatorOptionalLinebreak ||\n !(objectFieldSeparator.endsWith('-linebreak') &&\n objectFieldSeparator.startsWith(separator)))) ||\n (typeNode.meta.separatorForSingleObjectField ?? false) !== separatorForSingleObjectField ||\n ((typeNode.meta.propertyIndent ?? '') !== objectFieldIndent &&\n separator.endsWith('-linebreak')) ||\n (typeNode.meta.trailingPunctuation ?? false) !== objectFieldSeparatorTrailingPunctuation\n ) {\n typeNode.meta.separator = objectFieldSeparatorOptionalLinebreak && !separator.endsWith('and-linebreak') ?\n objectFieldSeparator.replace(/-and-linebreak$/v, '') :\n objectFieldSeparator;\n typeNode.meta.separatorForSingleObjectField = separatorForSingleObjectField;\n typeNode.meta.propertyIndent = objectFieldIndent;\n typeNode.meta.trailingPunctuation = objectFieldSeparatorTrailingPunctuation;\n errorMessage = `Inconsistent ${objectFieldSeparator} separator usage`;\n }\n\n break;\n }\n\n case 'JsdocTypeObjectField': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectFieldResult} */ (nde);\n if ((objectFieldQuote ||\n (typeof typeNode.key === 'string' &&\n (\n (/^[\\p{ID_Start}$_][\\p{ID_Continue}$\\u200C\\u200D]*$/v).test(typeNode.key) ||\n digitRegex.test(typeNode.key)\n )\n )) &&\n typeNode.meta.quote !== (objectFieldQuote ?? undefined) &&\n (typeof typeNode.key !== 'string' ||\n !digitRegex.test(typeNode.key))\n ) {\n typeNode.meta.quote = objectFieldQuote ?? undefined;\n errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;\n } else if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {\n typeNode.meta.postKeySpacing = keyValuePostKeySpacing;\n errorMessage = `Post key spacing should be \"${keyValuePostKeySpacing}\"`;\n } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {\n typeNode.meta.postColonSpacing = keyValuePostColonSpacing;\n errorMessage = `Post colon spacing should be \"${keyValuePostColonSpacing}\"`;\n } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {\n typeNode.meta.postOptionalSpacing = keyValuePostOptionalSpacing;\n errorMessage = `Post optional (\\`?\\`) spacing should be \"${keyValuePostOptionalSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeStringValue': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */ (nde);\n if (typeNode.meta.quote !== stringQuotes) {\n typeNode.meta.quote = stringQuotes;\n errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;\n }\n\n break;\n }\n\n // Only suitable for namepaths (and would need changes); see https://github.com/gajus/eslint-plugin-jsdoc/issues/1524\n // case 'JsdocTypeProperty': {\n // const typeNode = /** @type {import('jsdoc-type-pratt-parser').PropertyResult} */ (nde);\n\n // if ((propertyQuotes ||\n // (typeof typeNode.value === 'string' && !(/\\s/v).test(typeNode.value))) &&\n // typeNode.meta.quote !== (propertyQuotes ?? undefined)\n // ) {\n // typeNode.meta.quote = propertyQuotes ?? undefined;\n // errorMessage = `Inconsistent ${propertyQuotes} property quotes usage`;\n // }\n\n // break;\n // }\n\n case 'JsdocTypeTuple': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').TupleResult} */ (nde);\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {\n typeNode.meta = {\n elementSpacing: genericAndTupleElementSpacing,\n };\n errorMessage = `Element spacing should be \"${genericAndTupleElementSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeTypeParameter': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').TypeParameterResult} */ (nde);\n /* c8 ignore next -- Guard */\n if (typeNode.defaultValue && (typeNode.meta?.defaultValueSpacing ?? ' ') !== parameterDefaultValueSpacing) {\n typeNode.meta = {\n defaultValueSpacing: parameterDefaultValueSpacing,\n };\n errorMessage = `Default value spacing should be \"${parameterDefaultValueSpacing}\"`;\n }\n\n break;\n }\n\n case 'JsdocTypeUnion': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').UnionResult} */ (nde);\n /* c8 ignore next -- Guard */\n if ((typeNode.meta?.spacing ?? ' ') !== unionSpacing) {\n typeNode.meta = {\n spacing: unionSpacing,\n };\n errorMessage = `Inconsistent \"${unionSpacing}\" union spacing usage`;\n }\n\n break;\n }\n\n default:\n break;\n }\n\n if (errorMessage) {\n errorMessages.push(errorMessage);\n }\n });\n\n const differentResult = tag.type !==\n typeBracketSpacing + stringify(parsedType) + typeBracketSpacing;\n\n if (errorMessages.length && differentResult) {\n for (const errorMessage of errorMessages) {\n utils.reportJSDoc(\n errorMessage, tag, enableFixer ? fix : null,\n );\n }\n // Stringification may have been equal previously (and thus no error reported)\n // because the stringification doesn't preserve everything\n } else if (differentResult) {\n utils.reportJSDoc(\n 'There was an error with type formatting', tag, enableFixer ? fix : null,\n );\n }\n };\n\n const tags = utils.getPresentTags([\n 'param',\n 'property',\n 'returns',\n 'this',\n 'throws',\n 'type',\n 'typedef',\n 'yields',\n ]);\n for (const tag of tags) {\n if (tag.type) {\n checkTypeFormats(tag);\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Formats JSDoc type values.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n arrayBrackets: {\n description: 'Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to \"square\".',\n enum: [\n 'angle',\n 'square',\n ],\n type: 'string',\n },\n arrowFunctionPostReturnMarkerSpacing: {\n description: 'The space character (if any) to use after return markers (`=>`). Defaults to \" \".',\n type: 'string',\n },\n arrowFunctionPreReturnMarkerSpacing: {\n description: 'The space character (if any) to use before return markers (`=>`). Defaults to \" \".',\n type: 'string',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n functionOrClassParameterSpacing: {\n description: 'The space character (if any) to use between function or class parameters. Defaults to \" \".',\n type: 'string',\n },\n functionOrClassPostGenericSpacing: {\n description: 'The space character (if any) to use after a generic expression in a function or class. Defaults to \"\".',\n type: 'string',\n },\n functionOrClassPostReturnMarkerSpacing: {\n description: 'The space character (if any) to use after return markers (`:`). Defaults to \"\".',\n type: 'string',\n },\n functionOrClassPreReturnMarkerSpacing: {\n description: 'The space character (if any) to use before return markers (`:`). Defaults to \"\".',\n type: 'string',\n },\n functionOrClassTypeParameterSpacing: {\n description: 'The space character (if any) to use between type parameters in a function or class. Defaults to \" \".',\n type: 'string',\n },\n genericAndTupleElementSpacing: {\n description: 'The space character (if any) to use between elements in generics and tuples. Defaults to \" \".',\n type: 'string',\n },\n genericDot: {\n description: 'Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.',\n type: 'boolean',\n },\n keyValuePostColonSpacing: {\n description: 'The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to \" \".',\n type: 'string',\n },\n keyValuePostKeySpacing: {\n description: 'The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to \"\".',\n type: 'string',\n },\n keyValuePostOptionalSpacing: {\n description: 'The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to \"\".',\n type: 'string',\n },\n keyValuePostVariadicSpacing: {\n description: 'The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to \"\".',\n type: 'string',\n },\n methodQuotes: {\n description: 'The style of quotation mark for surrounding method names when quoted. Defaults to `double`',\n enum: [\n 'double',\n 'single',\n ],\n type: 'string',\n },\n objectFieldIndent: {\n description: `A string indicating the whitespace to be added on each line preceding an\nobject property-value field. Defaults to the empty string.`,\n type: 'string',\n },\n objectFieldQuote: {\n description: `Whether and how object field properties should be quoted (e.g., \\`{\"a\": string}\\`).\nSet to \\`single\\`, \\`double\\`, or \\`null\\`. Defaults to \\`null\\` (no quotes unless\nrequired due to special characters within the field). Digits will be kept as is,\nregardless of setting (they can either represent a digit or a string digit).`,\n enum: [\n 'double',\n 'single',\n null,\n ],\n },\n objectFieldSeparator: {\n description: `For object properties, specify whether a \"semicolon\", \"comma\", \"linebreak\",\n\"semicolon-and-linebreak\", or \"comma-and-linebreak\" should be used after\neach object property-value pair.\n\nDefaults to \\`\"comma\"\\`.`,\n enum: [\n 'comma',\n 'comma-and-linebreak',\n 'linebreak',\n 'semicolon',\n 'semicolon-and-linebreak',\n ],\n type: 'string',\n },\n objectFieldSeparatorOptionalLinebreak: {\n description: `Whether \\`objectFieldSeparator\\` set to \\`\"semicolon-and-linebreak\"\\` or\n\\`\"comma-and-linebreak\"\\` should be allowed to optionally drop the linebreak.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n objectFieldSeparatorTrailingPunctuation: {\n description: `If \\`separatorForSingleObjectField\\` is not in effect (i.e., if it is \\`false\\`\nor there are multiple property-value object fields present), this property\nwill determine whether to add punctuation corresponding to the\n\\`objectFieldSeparator\\` (e.g., a semicolon) to the final object field.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n parameterDefaultValueSpacing: {\n description: 'The space character (if any) to use between the equal signs of a default value. Defaults to \" \".',\n type: 'string',\n },\n postMethodNameSpacing: {\n description: 'The space character (if any) to add after a method name. Defaults to \"\".',\n type: 'string',\n },\n postNewSpacing: {\n description: 'The space character (if any) to add after \"new\" in a constructor. Defaults to \" \".',\n type: 'string',\n },\n // propertyQuotes: {\n // description: `Whether and how namepath properties should be quoted (e.g., \\`ab.\"cd\".\"ef\"\\`).\n // Set to \\`single\\`, \\`double\\`, or \\`null\\`. Defaults to \\`null\\` (no quotes unless\n // required due to whitespace within the property).`,\n // enum: [\n // 'double',\n // 'single',\n // null,\n // ],\n // },\n separatorForSingleObjectField: {\n description: `Whether to apply the \\`objectFieldSeparator\\` (e.g., a semicolon) when there\nis only one property-value object field present. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n stringQuotes: {\n description: `How string literals should be quoted (e.g., \\`\"abc\"\\`). Set to \\`single\\`\nor \\`double\\`. Defaults to 'double'.`,\n enum: [\n 'double',\n 'single',\n ],\n type: 'string',\n },\n typeBracketSpacing: {\n description: `A string of spaces that will be added immediately after the type's initial\ncurly bracket and immediately before its ending curly bracket. Defaults\nto the empty string.`,\n type: 'string',\n },\n unionSpacing: {\n description: 'Determines the spacing to add to unions (`|`). Defaults to a single space (`\" \"`).',\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAK8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,UAAU,GAAI,wCAAyC;;AAE7D;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GACe,IAAAI,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,aAAa,GAAG,QAAQ;IACxBC,oCAAoC,GAAG,GAAG;IAC1CC,mCAAmC,GAAG,GAAG;IACzCC,WAAW,GAAG,IAAI;IAClBC,+BAA+B,GAAG,GAAG;IACrCC,iCAAiC,GAAG,EAAE;IACtCC,sCAAsC,GAAG,GAAG;IAC5CC,qCAAqC,GAAG,EAAE;IAC1CC,mCAAmC,GAAG,GAAG;IACzCC,6BAA6B,GAAG,GAAG;IACnCC,UAAU,GAAG,KAAK;IAClBC,wBAAwB,GAAG,GAAG;IAC9BC,sBAAsB,GAAG,EAAE;IAC3BC,2BAA2B,GAAG,EAAE;IAChCC,2BAA2B,GAAG,EAAE;IAChCC,YAAY,GAAG,QAAQ;IACvBC,iBAAiB,GAAG,EAAE;IACtBC,gBAAgB,GAAG,IAAI;IACvBC,oBAAoB,GAAG,OAAO;IAC9BC,qCAAqC,GAAG,IAAI;IAC5CC,uCAAuC,GAAG,KAAK;IAC/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CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA0F,MAAA,CAAAlI,OAAA,GAAAA,OAAA,CAAAH,OAAA","ignoreList":[]}
package/dist/rules.d.ts CHANGED
@@ -2947,14 +2947,66 @@ export interface Rules {
2947
2947
  * Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to "square".
2948
2948
  */
2949
2949
  arrayBrackets?: "angle" | "square";
2950
+ /**
2951
+ * The space character (if any) to use after return markers (`=>`). Defaults to " ".
2952
+ */
2953
+ arrowFunctionPostReturnMarkerSpacing?: string;
2954
+ /**
2955
+ * The space character (if any) to use before return markers (`=>`). Defaults to " ".
2956
+ */
2957
+ arrowFunctionPreReturnMarkerSpacing?: string;
2950
2958
  /**
2951
2959
  * Whether to enable the fixer. Defaults to `true`.
2952
2960
  */
2953
2961
  enableFixer?: boolean;
2962
+ /**
2963
+ * The space character (if any) to use between function or class parameters. Defaults to " ".
2964
+ */
2965
+ functionOrClassParameterSpacing?: string;
2966
+ /**
2967
+ * The space character (if any) to use after a generic expression in a function or class. Defaults to "".
2968
+ */
2969
+ functionOrClassPostGenericSpacing?: string;
2970
+ /**
2971
+ * The space character (if any) to use after return markers (`:`). Defaults to "".
2972
+ */
2973
+ functionOrClassPostReturnMarkerSpacing?: string;
2974
+ /**
2975
+ * The space character (if any) to use before return markers (`:`). Defaults to "".
2976
+ */
2977
+ functionOrClassPreReturnMarkerSpacing?: string;
2978
+ /**
2979
+ * The space character (if any) to use between type parameters in a function or class. Defaults to " ".
2980
+ */
2981
+ functionOrClassTypeParameterSpacing?: string;
2982
+ /**
2983
+ * The space character (if any) to use between elements in generics and tuples. Defaults to " ".
2984
+ */
2985
+ genericAndTupleElementSpacing?: string;
2954
2986
  /**
2955
2987
  * Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.
2956
2988
  */
2957
2989
  genericDot?: boolean;
2990
+ /**
2991
+ * The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to " ".
2992
+ */
2993
+ keyValuePostColonSpacing?: string;
2994
+ /**
2995
+ * The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to "".
2996
+ */
2997
+ keyValuePostKeySpacing?: string;
2998
+ /**
2999
+ * The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to "".
3000
+ */
3001
+ keyValuePostOptionalSpacing?: string;
3002
+ /**
3003
+ * The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to "".
3004
+ */
3005
+ keyValuePostVariadicSpacing?: string;
3006
+ /**
3007
+ * The style of quotation mark for surrounding method names when quoted. Defaults to `double`
3008
+ */
3009
+ methodQuotes?: "double" | "single";
2958
3010
  /**
2959
3011
  * A string indicating the whitespace to be added on each line preceding an
2960
3012
  * object property-value field. Defaults to the empty string.
@@ -2990,6 +3042,18 @@ export interface Rules {
2990
3042
  * Defaults to `false`.
2991
3043
  */
2992
3044
  objectFieldSeparatorTrailingPunctuation?: boolean;
3045
+ /**
3046
+ * The space character (if any) to use between the equal signs of a default value. Defaults to " ".
3047
+ */
3048
+ parameterDefaultValueSpacing?: string;
3049
+ /**
3050
+ * The space character (if any) to add after a method name. Defaults to "".
3051
+ */
3052
+ postMethodNameSpacing?: string;
3053
+ /**
3054
+ * The space character (if any) to add after "new" in a constructor. Defaults to " ".
3055
+ */
3056
+ postNewSpacing?: string;
2993
3057
  /**
2994
3058
  * Whether to apply the `objectFieldSeparator` (e.g., a semicolon) when there
2995
3059
  * is only one property-value object field present. Defaults to `false`.
@@ -2997,7 +3061,7 @@ export interface Rules {
2997
3061
  separatorForSingleObjectField?: boolean;
2998
3062
  /**
2999
3063
  * How string literals should be quoted (e.g., `"abc"`). Set to `single`
3000
- * or `double`. Defaults to 'single'.
3064
+ * or `double`. Defaults to 'double'.
3001
3065
  */
3002
3066
  stringQuotes?: "double" | "single";
3003
3067
  /**
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "http://gajus.com"
6
6
  },
7
7
  "dependencies": {
8
- "@es-joy/jsdoccomment": "~0.71.0",
8
+ "@es-joy/jsdoccomment": "~0.75.0",
9
9
  "are-docs-informative": "^0.0.2",
10
10
  "comment-parser": "1.4.1",
11
11
  "debug": "^4.4.3",
@@ -15,7 +15,7 @@
15
15
  "html-entities": "^2.6.0",
16
16
  "object-deep-merge": "^1.0.5",
17
17
  "parse-imports-exports": "^0.2.4",
18
- "semver": "^7.7.2",
18
+ "semver": "^7.7.3",
19
19
  "spdx-expression-parse": "^4.0.0"
20
20
  },
21
21
  "description": "JSDoc linting rules for ESLint.",
@@ -58,7 +58,7 @@
58
58
  "glob": "^11.0.3",
59
59
  "globals": "^16.4.0",
60
60
  "husky": "^9.1.7",
61
- "jsdoc-type-pratt-parser": "^6.6.0",
61
+ "jsdoc-type-pratt-parser": "^6.9.1",
62
62
  "json-schema": "^0.4.0",
63
63
  "json-schema-to-typescript": "^15.0.4",
64
64
  "lint-staged": "^16.2.3",
@@ -178,5 +178,5 @@
178
178
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
179
179
  "test-index": "pnpm run test-no-cov test/rules/index.js"
180
180
  },
181
- "version": "60.8.3"
181
+ "version": "61.0.0"
182
182
  }
@@ -8,6 +8,7 @@ import {
8
8
 
9
9
  const digitRegex = (/^(\d+(\.\d*)?|\.\d+)([eE][\-+]?\d+)?$/v);
10
10
 
11
+ // eslint-disable-next-line complexity -- Todo
11
12
  export default iterateJsdoc(({
12
13
  context,
13
14
  indent,
@@ -17,16 +18,32 @@ export default iterateJsdoc(({
17
18
  }) => {
18
19
  const {
19
20
  arrayBrackets = 'square',
21
+ arrowFunctionPostReturnMarkerSpacing = ' ',
22
+ arrowFunctionPreReturnMarkerSpacing = ' ',
20
23
  enableFixer = true,
24
+ functionOrClassParameterSpacing = ' ',
25
+ functionOrClassPostGenericSpacing = '',
26
+ functionOrClassPostReturnMarkerSpacing = ' ',
27
+ functionOrClassPreReturnMarkerSpacing = '',
28
+ functionOrClassTypeParameterSpacing = ' ',
29
+ genericAndTupleElementSpacing = ' ',
21
30
  genericDot = false,
31
+ keyValuePostColonSpacing = ' ',
32
+ keyValuePostKeySpacing = '',
33
+ keyValuePostOptionalSpacing = '',
34
+ keyValuePostVariadicSpacing = '',
35
+ methodQuotes = 'double',
22
36
  objectFieldIndent = '',
23
37
  objectFieldQuote = null,
24
38
  objectFieldSeparator = 'comma',
25
39
  objectFieldSeparatorOptionalLinebreak = true,
26
40
  objectFieldSeparatorTrailingPunctuation = false,
41
+ parameterDefaultValueSpacing = ' ',
42
+ postMethodNameSpacing = '',
43
+ postNewSpacing = ' ',
27
44
  // propertyQuotes = null,
28
45
  separatorForSingleObjectField = false,
29
- stringQuotes = 'single',
46
+ stringQuotes = 'double',
30
47
  typeBracketSpacing = '',
31
48
  unionSpacing = ' ',
32
49
  } = context.options[0] || {};
@@ -215,7 +232,177 @@ export default iterateJsdoc(({
215
232
  traverse(parsedType, (nde) => {
216
233
  let errorMessage = '';
217
234
 
235
+ /**
236
+ * @param {Partial<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
237
+ * postNewSpacing?: string,
238
+ * postMethodNameSpacing?: string
239
+ * }} meta
240
+ * @returns {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
241
+ * postNewSpacing?: string,
242
+ * postMethodNameSpacing?: string
243
+ * }}
244
+ */
245
+ const conditionalAdds = (meta) => {
246
+ const typNode =
247
+ /**
248
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult|
249
+ * import('jsdoc-type-pratt-parser').CallSignatureResult|
250
+ * import('jsdoc-type-pratt-parser').ComputedMethodResult|
251
+ * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
252
+ * import('jsdoc-type-pratt-parser').MethodSignatureResult
253
+ * }
254
+ */ (nde);
255
+
256
+ /**
257
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
258
+ * postNewSpacing?: string,
259
+ * postMethodNameSpacing?: string
260
+ * }}
261
+ */
262
+ const newMeta = {
263
+ parameterSpacing: meta.parameterSpacing ?? typNode.meta?.parameterSpacing ?? ' ',
264
+ postGenericSpacing: meta.postGenericSpacing ?? typNode.meta?.postGenericSpacing ?? '',
265
+ postReturnMarkerSpacing: meta.postReturnMarkerSpacing ?? typNode.meta?.postReturnMarkerSpacing ?? ' ',
266
+ preReturnMarkerSpacing: meta.preReturnMarkerSpacing ?? typNode.meta?.preReturnMarkerSpacing ?? '',
267
+ typeParameterSpacing: meta.typeParameterSpacing ?? typNode.meta?.typeParameterSpacing ?? ' ',
268
+ };
269
+
270
+ if (typNode.type === 'JsdocTypeConstructorSignature') {
271
+ newMeta.postNewSpacing = meta.postNewSpacing;
272
+ }
273
+
274
+ if (typNode.type === 'JsdocTypeMethodSignature') {
275
+ newMeta.postMethodNameSpacing = meta.postMethodNameSpacing ?? typNode.meta?.postMethodNameSpacing ?? '';
276
+ }
277
+
278
+ return newMeta;
279
+ };
280
+
218
281
  switch (nde.type) {
282
+ case 'JsdocTypeConstructorSignature': {
283
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').ConstructorSignatureResult} */ (nde);
284
+ /* c8 ignore next -- Guard */
285
+ if ((typeNode.meta?.postNewSpacing ?? ' ') !== postNewSpacing) {
286
+ typeNode.meta =
287
+ /**
288
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
289
+ * postNewSpacing: string,
290
+ * }}
291
+ */ (conditionalAdds({
292
+ postNewSpacing,
293
+ }));
294
+ errorMessage = `Post-\`new\` spacing should be "${postNewSpacing}"`;
295
+ break;
296
+ }
297
+ }
298
+
299
+ case 'JsdocTypeFunction': {
300
+ const typeNode =
301
+ /**
302
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult}
303
+ */ nde;
304
+ if ('arrow' in typeNode && typeNode.arrow) {
305
+ /* c8 ignore next -- Guard */
306
+ if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== arrowFunctionPostReturnMarkerSpacing) {
307
+ typeNode.meta =
308
+ /**
309
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
310
+ * postNewSpacing: string,
311
+ * }}
312
+ */ (conditionalAdds({
313
+ postReturnMarkerSpacing: arrowFunctionPostReturnMarkerSpacing,
314
+ /* c8 ignore next -- Guard */
315
+ preReturnMarkerSpacing: typeNode.meta?.preReturnMarkerSpacing ?? ' ',
316
+ }));
317
+ errorMessage = `Post-return-marker spacing should be "${arrowFunctionPostReturnMarkerSpacing}"`;
318
+ break;
319
+ /* c8 ignore next -- Guard */
320
+ } else if ((typeNode.meta?.preReturnMarkerSpacing ?? ' ') !== arrowFunctionPreReturnMarkerSpacing) {
321
+ typeNode.meta =
322
+ /**
323
+ * @type {Required<import('jsdoc-type-pratt-parser').FunctionResult['meta']> & {
324
+ * postNewSpacing: string,
325
+ * }}
326
+ */ (conditionalAdds({
327
+ /* c8 ignore next -- Guard */
328
+ postReturnMarkerSpacing: typeNode.meta?.postReturnMarkerSpacing ?? ' ',
329
+ preReturnMarkerSpacing: arrowFunctionPreReturnMarkerSpacing,
330
+ }));
331
+ errorMessage = `Pre-return-marker spacing should be "${arrowFunctionPreReturnMarkerSpacing}"`;
332
+ break;
333
+ }
334
+
335
+ break;
336
+ }
337
+ }
338
+
339
+ case 'JsdocTypeCallSignature':
340
+ case 'JsdocTypeComputedMethod':
341
+ case 'JsdocTypeMethodSignature': {
342
+ const typeNode =
343
+ /**
344
+ * @type {import('jsdoc-type-pratt-parser').FunctionResult|
345
+ * import('jsdoc-type-pratt-parser').CallSignatureResult|
346
+ * import('jsdoc-type-pratt-parser').ComputedMethodResult|
347
+ * import('jsdoc-type-pratt-parser').ConstructorSignatureResult|
348
+ * import('jsdoc-type-pratt-parser').MethodSignatureResult
349
+ * }
350
+ */ (nde);
351
+ if (typeNode.type === 'JsdocTypeMethodSignature' &&
352
+ (typeNode.meta?.postMethodNameSpacing ?? '') !== postMethodNameSpacing
353
+ ) {
354
+ typeNode.meta = {
355
+ quote: typeNode.meta.quote,
356
+ ...conditionalAdds({
357
+ postMethodNameSpacing,
358
+ }),
359
+ };
360
+ errorMessage = `Post-method-name spacing should be "${postMethodNameSpacing}"`;
361
+ break;
362
+ } else if (typeNode.type === 'JsdocTypeMethodSignature' &&
363
+ typeNode.meta.quote !== undefined &&
364
+ typeNode.meta.quote !== methodQuotes
365
+ ) {
366
+ typeNode.meta = {
367
+ ...conditionalAdds({
368
+ postMethodNameSpacing: typeNode.meta.postMethodNameSpacing ?? '',
369
+ }),
370
+ quote: methodQuotes,
371
+ };
372
+ errorMessage = `Method quoting style should be "${methodQuotes}"`;
373
+ break;
374
+ }
375
+
376
+ if ((typeNode.meta?.parameterSpacing ?? ' ') !== functionOrClassParameterSpacing) {
377
+ typeNode.meta = conditionalAdds({
378
+ parameterSpacing: functionOrClassParameterSpacing,
379
+ });
380
+ errorMessage = `Parameter spacing should be "${functionOrClassParameterSpacing}"`;
381
+ } else if ((typeNode.meta?.postGenericSpacing ?? '') !== functionOrClassPostGenericSpacing) {
382
+ typeNode.meta = conditionalAdds({
383
+ postGenericSpacing: functionOrClassPostGenericSpacing,
384
+ });
385
+ errorMessage = `Post-generic spacing should be "${functionOrClassPostGenericSpacing}"`;
386
+ } else if ((typeNode.meta?.postReturnMarkerSpacing ?? ' ') !== functionOrClassPostReturnMarkerSpacing) {
387
+ typeNode.meta = conditionalAdds({
388
+ postReturnMarkerSpacing: functionOrClassPostReturnMarkerSpacing,
389
+ });
390
+ errorMessage = `Post-return-marker spacing should be "${functionOrClassPostReturnMarkerSpacing}"`;
391
+ } else if ((typeNode.meta?.preReturnMarkerSpacing ?? '') !== functionOrClassPreReturnMarkerSpacing) {
392
+ typeNode.meta = conditionalAdds({
393
+ preReturnMarkerSpacing: functionOrClassPreReturnMarkerSpacing,
394
+ });
395
+ errorMessage = `Pre-return-marker spacing should be "${functionOrClassPreReturnMarkerSpacing}"`;
396
+ } else if ((typeNode.meta?.typeParameterSpacing ?? ' ') !== functionOrClassTypeParameterSpacing) {
397
+ typeNode.meta = conditionalAdds({
398
+ typeParameterSpacing: functionOrClassTypeParameterSpacing,
399
+ });
400
+ errorMessage = `Type parameter spacing should be "${functionOrClassTypeParameterSpacing}"`;
401
+ }
402
+
403
+ break;
404
+ }
405
+
219
406
  case 'JsdocTypeGeneric': {
220
407
  const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */ (nde);
221
408
  if ('value' in typeNode.left && typeNode.left.value === 'Array') {
@@ -226,6 +413,58 @@ export default iterateJsdoc(({
226
413
  } else if (typeNode.meta.dot !== genericDot) {
227
414
  typeNode.meta.dot = genericDot;
228
415
  errorMessage = `Dot usage should be ${genericDot}`;
416
+ } else if ((typeNode.meta.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
417
+ typeNode.meta.elementSpacing = genericAndTupleElementSpacing;
418
+ errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
419
+ }
420
+
421
+ break;
422
+ }
423
+
424
+ case 'JsdocTypeKeyValue': {
425
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').KeyValueResult} */ (nde);
426
+ /* c8 ignore next -- Guard */
427
+ if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
428
+ typeNode.meta = {
429
+ /* c8 ignore next -- Guard */
430
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
431
+ postKeySpacing: keyValuePostKeySpacing,
432
+ /* c8 ignore next 2 -- Guard */
433
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
434
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',
435
+ };
436
+ errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
437
+ /* c8 ignore next -- Guard */
438
+ } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
439
+ typeNode.meta = {
440
+ postColonSpacing: keyValuePostColonSpacing,
441
+ /* c8 ignore next 3 -- Guard */
442
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
443
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
444
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',
445
+ };
446
+ errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
447
+ /* c8 ignore next -- Guard */
448
+ } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
449
+ typeNode.meta = {
450
+ /* c8 ignore next 2 -- Guard */
451
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
452
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
453
+ postOptionalSpacing: keyValuePostOptionalSpacing,
454
+ /* c8 ignore next -- Guard */
455
+ postVariadicSpacing: typeNode.meta?.postVariadicSpacing ?? '',
456
+ };
457
+ errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
458
+ /* c8 ignore next -- Guard */
459
+ } else if (typeNode.variadic && (typeNode.meta?.postVariadicSpacing ?? '') !== keyValuePostVariadicSpacing) {
460
+ typeNode.meta = {
461
+ /* c8 ignore next 3 -- Guard */
462
+ postColonSpacing: typeNode.meta?.postColonSpacing ?? ' ',
463
+ postKeySpacing: typeNode.meta?.postKeySpacing ?? '',
464
+ postOptionalSpacing: typeNode.meta?.postOptionalSpacing ?? '',
465
+ postVariadicSpacing: keyValuePostVariadicSpacing,
466
+ };
467
+ errorMessage = `Post variadic (\`...\`) spacing should be "${keyValuePostVariadicSpacing}"`;
229
468
  }
230
469
 
231
470
  break;
@@ -272,6 +511,25 @@ export default iterateJsdoc(({
272
511
  ) {
273
512
  typeNode.meta.quote = objectFieldQuote ?? undefined;
274
513
  errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;
514
+ } else if ((typeNode.meta?.postKeySpacing ?? '') !== keyValuePostKeySpacing) {
515
+ typeNode.meta.postKeySpacing = keyValuePostKeySpacing;
516
+ errorMessage = `Post key spacing should be "${keyValuePostKeySpacing}"`;
517
+ } else if ((typeNode.meta?.postColonSpacing ?? ' ') !== keyValuePostColonSpacing) {
518
+ typeNode.meta.postColonSpacing = keyValuePostColonSpacing;
519
+ errorMessage = `Post colon spacing should be "${keyValuePostColonSpacing}"`;
520
+ } else if ((typeNode.meta?.postOptionalSpacing ?? '') !== keyValuePostOptionalSpacing) {
521
+ typeNode.meta.postOptionalSpacing = keyValuePostOptionalSpacing;
522
+ errorMessage = `Post optional (\`?\`) spacing should be "${keyValuePostOptionalSpacing}"`;
523
+ }
524
+
525
+ break;
526
+ }
527
+
528
+ case 'JsdocTypeStringValue': {
529
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */ (nde);
530
+ if (typeNode.meta.quote !== stringQuotes) {
531
+ typeNode.meta.quote = stringQuotes;
532
+ errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
275
533
  }
276
534
 
277
535
  break;
@@ -292,11 +550,27 @@ export default iterateJsdoc(({
292
550
  // break;
293
551
  // }
294
552
 
295
- case 'JsdocTypeStringValue': {
296
- const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */ (nde);
297
- if (typeNode.meta.quote !== stringQuotes) {
298
- typeNode.meta.quote = stringQuotes;
299
- errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
553
+ case 'JsdocTypeTuple': {
554
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').TupleResult} */ (nde);
555
+ /* c8 ignore next -- Guard */
556
+ if ((typeNode.meta?.elementSpacing ?? ' ') !== genericAndTupleElementSpacing) {
557
+ typeNode.meta = {
558
+ elementSpacing: genericAndTupleElementSpacing,
559
+ };
560
+ errorMessage = `Element spacing should be "${genericAndTupleElementSpacing}"`;
561
+ }
562
+
563
+ break;
564
+ }
565
+
566
+ case 'JsdocTypeTypeParameter': {
567
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').TypeParameterResult} */ (nde);
568
+ /* c8 ignore next -- Guard */
569
+ if (typeNode.defaultValue && (typeNode.meta?.defaultValueSpacing ?? ' ') !== parameterDefaultValueSpacing) {
570
+ typeNode.meta = {
571
+ defaultValueSpacing: parameterDefaultValueSpacing,
572
+ };
573
+ errorMessage = `Default value spacing should be "${parameterDefaultValueSpacing}"`;
300
574
  }
301
575
 
302
576
  break;
@@ -377,14 +651,70 @@ export default iterateJsdoc(({
377
651
  ],
378
652
  type: 'string',
379
653
  },
654
+ arrowFunctionPostReturnMarkerSpacing: {
655
+ description: 'The space character (if any) to use after return markers (`=>`). Defaults to " ".',
656
+ type: 'string',
657
+ },
658
+ arrowFunctionPreReturnMarkerSpacing: {
659
+ description: 'The space character (if any) to use before return markers (`=>`). Defaults to " ".',
660
+ type: 'string',
661
+ },
380
662
  enableFixer: {
381
663
  description: 'Whether to enable the fixer. Defaults to `true`.',
382
664
  type: 'boolean',
383
665
  },
666
+ functionOrClassParameterSpacing: {
667
+ description: 'The space character (if any) to use between function or class parameters. Defaults to " ".',
668
+ type: 'string',
669
+ },
670
+ functionOrClassPostGenericSpacing: {
671
+ description: 'The space character (if any) to use after a generic expression in a function or class. Defaults to "".',
672
+ type: 'string',
673
+ },
674
+ functionOrClassPostReturnMarkerSpacing: {
675
+ description: 'The space character (if any) to use after return markers (`:`). Defaults to "".',
676
+ type: 'string',
677
+ },
678
+ functionOrClassPreReturnMarkerSpacing: {
679
+ description: 'The space character (if any) to use before return markers (`:`). Defaults to "".',
680
+ type: 'string',
681
+ },
682
+ functionOrClassTypeParameterSpacing: {
683
+ description: 'The space character (if any) to use between type parameters in a function or class. Defaults to " ".',
684
+ type: 'string',
685
+ },
686
+ genericAndTupleElementSpacing: {
687
+ description: 'The space character (if any) to use between elements in generics and tuples. Defaults to " ".',
688
+ type: 'string',
689
+ },
384
690
  genericDot: {
385
691
  description: 'Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.',
386
692
  type: 'boolean',
387
693
  },
694
+ keyValuePostColonSpacing: {
695
+ description: 'The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to " ".',
696
+ type: 'string',
697
+ },
698
+ keyValuePostKeySpacing: {
699
+ description: 'The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to "".',
700
+ type: 'string',
701
+ },
702
+ keyValuePostOptionalSpacing: {
703
+ description: 'The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to "".',
704
+ type: 'string',
705
+ },
706
+ keyValuePostVariadicSpacing: {
707
+ description: 'The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to "".',
708
+ type: 'string',
709
+ },
710
+ methodQuotes: {
711
+ description: 'The style of quotation mark for surrounding method names when quoted. Defaults to `double`',
712
+ enum: [
713
+ 'double',
714
+ 'single',
715
+ ],
716
+ type: 'string',
717
+ },
388
718
  objectFieldIndent: {
389
719
  description: `A string indicating the whitespace to be added on each line preceding an
390
720
  object property-value field. Defaults to the empty string.`,
@@ -431,6 +761,18 @@ will determine whether to add punctuation corresponding to the
431
761
  Defaults to \`false\`.`,
432
762
  type: 'boolean',
433
763
  },
764
+ parameterDefaultValueSpacing: {
765
+ description: 'The space character (if any) to use between the equal signs of a default value. Defaults to " ".',
766
+ type: 'string',
767
+ },
768
+ postMethodNameSpacing: {
769
+ description: 'The space character (if any) to add after a method name. Defaults to "".',
770
+ type: 'string',
771
+ },
772
+ postNewSpacing: {
773
+ description: 'The space character (if any) to add after "new" in a constructor. Defaults to " ".',
774
+ type: 'string',
775
+ },
434
776
  // propertyQuotes: {
435
777
  // description: `Whether and how namepath properties should be quoted (e.g., \`ab."cd"."ef"\`).
436
778
  // Set to \`single\`, \`double\`, or \`null\`. Defaults to \`null\` (no quotes unless
@@ -448,7 +790,7 @@ is only one property-value object field present. Defaults to \`false\`.`,
448
790
  },
449
791
  stringQuotes: {
450
792
  description: `How string literals should be quoted (e.g., \`"abc"\`). Set to \`single\`
451
- or \`double\`. Defaults to 'single'.`,
793
+ or \`double\`. Defaults to 'double'.`,
452
794
  enum: [
453
795
  'double',
454
796
  'single',
package/src/rules.d.ts CHANGED
@@ -2947,14 +2947,66 @@ export interface Rules {
2947
2947
  * Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to "square".
2948
2948
  */
2949
2949
  arrayBrackets?: "angle" | "square";
2950
+ /**
2951
+ * The space character (if any) to use after return markers (`=>`). Defaults to " ".
2952
+ */
2953
+ arrowFunctionPostReturnMarkerSpacing?: string;
2954
+ /**
2955
+ * The space character (if any) to use before return markers (`=>`). Defaults to " ".
2956
+ */
2957
+ arrowFunctionPreReturnMarkerSpacing?: string;
2950
2958
  /**
2951
2959
  * Whether to enable the fixer. Defaults to `true`.
2952
2960
  */
2953
2961
  enableFixer?: boolean;
2962
+ /**
2963
+ * The space character (if any) to use between function or class parameters. Defaults to " ".
2964
+ */
2965
+ functionOrClassParameterSpacing?: string;
2966
+ /**
2967
+ * The space character (if any) to use after a generic expression in a function or class. Defaults to "".
2968
+ */
2969
+ functionOrClassPostGenericSpacing?: string;
2970
+ /**
2971
+ * The space character (if any) to use after return markers (`:`). Defaults to "".
2972
+ */
2973
+ functionOrClassPostReturnMarkerSpacing?: string;
2974
+ /**
2975
+ * The space character (if any) to use before return markers (`:`). Defaults to "".
2976
+ */
2977
+ functionOrClassPreReturnMarkerSpacing?: string;
2978
+ /**
2979
+ * The space character (if any) to use between type parameters in a function or class. Defaults to " ".
2980
+ */
2981
+ functionOrClassTypeParameterSpacing?: string;
2982
+ /**
2983
+ * The space character (if any) to use between elements in generics and tuples. Defaults to " ".
2984
+ */
2985
+ genericAndTupleElementSpacing?: string;
2954
2986
  /**
2955
2987
  * Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.
2956
2988
  */
2957
2989
  genericDot?: boolean;
2990
+ /**
2991
+ * The amount of spacing (if any) after the colon of a key-value or object-field pair. Defaults to " ".
2992
+ */
2993
+ keyValuePostColonSpacing?: string;
2994
+ /**
2995
+ * The amount of spacing (if any) immediately after keys in a key-value or object-field pair. Defaults to "".
2996
+ */
2997
+ keyValuePostKeySpacing?: string;
2998
+ /**
2999
+ * The amount of spacing (if any) after the optional operator (`?`) in a key-value or object-field pair. Defaults to "".
3000
+ */
3001
+ keyValuePostOptionalSpacing?: string;
3002
+ /**
3003
+ * The amount of spacing (if any) after a variadic operator (`...`) in a key-value pair. Defaults to "".
3004
+ */
3005
+ keyValuePostVariadicSpacing?: string;
3006
+ /**
3007
+ * The style of quotation mark for surrounding method names when quoted. Defaults to `double`
3008
+ */
3009
+ methodQuotes?: "double" | "single";
2958
3010
  /**
2959
3011
  * A string indicating the whitespace to be added on each line preceding an
2960
3012
  * object property-value field. Defaults to the empty string.
@@ -2990,6 +3042,18 @@ export interface Rules {
2990
3042
  * Defaults to `false`.
2991
3043
  */
2992
3044
  objectFieldSeparatorTrailingPunctuation?: boolean;
3045
+ /**
3046
+ * The space character (if any) to use between the equal signs of a default value. Defaults to " ".
3047
+ */
3048
+ parameterDefaultValueSpacing?: string;
3049
+ /**
3050
+ * The space character (if any) to add after a method name. Defaults to "".
3051
+ */
3052
+ postMethodNameSpacing?: string;
3053
+ /**
3054
+ * The space character (if any) to add after "new" in a constructor. Defaults to " ".
3055
+ */
3056
+ postNewSpacing?: string;
2993
3057
  /**
2994
3058
  * Whether to apply the `objectFieldSeparator` (e.g., a semicolon) when there
2995
3059
  * is only one property-value object field present. Defaults to `false`.
@@ -2997,7 +3061,7 @@ export interface Rules {
2997
3061
  separatorForSingleObjectField?: boolean;
2998
3062
  /**
2999
3063
  * How string literals should be quoted (e.g., `"abc"`). Set to `single`
3000
- * or `double`. Defaults to 'single'.
3064
+ * or `double`. Defaults to 'double'.
3001
3065
  */
3002
3066
  stringQuotes?: "double" | "single";
3003
3067
  /**