eslint-plugin-jsdoc 65.4.7 → 65.4.9
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.
package/package.json
CHANGED
|
@@ -286,11 +286,12 @@ export default {
|
|
|
286
286
|
return `/**${body.replace(/^[ \t]+/v, '')}\n${indent}`;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
// Separate a leading slash from the JSDoc star to avoid creating `*/`.
|
|
290
|
+
return `/**\n${indent}*${body.replace(/^\//v, ' /')}\n${indent}`;
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
const inner = comments.map((comment) => {
|
|
293
|
-
return `${indent}*${comment.value.trimEnd()}`;
|
|
294
|
+
return `${indent}*${comment.value.trimEnd().replace(/^\//v, ' /')}`;
|
|
294
295
|
}).join('\n');
|
|
295
296
|
|
|
296
297
|
return `/**\n${inner}\n${indent}`;
|
package/src/rules/sortTags.js
CHANGED
|
@@ -428,6 +428,9 @@ export default iterateJsdoc(({
|
|
|
428
428
|
const firstLine = utils.getFirstLine();
|
|
429
429
|
|
|
430
430
|
const fix = () => {
|
|
431
|
+
// The closing line starts with the block's indentation plus one space
|
|
432
|
+
const closingLineStart = jsdoc.source[jsdoc.source.length - 1].tokens.start;
|
|
433
|
+
|
|
431
434
|
const itemsToMoveRange = [
|
|
432
435
|
...Array.from({
|
|
433
436
|
length: jsdoc.tags.length -
|
|
@@ -449,12 +452,17 @@ export default iterateJsdoc(({
|
|
|
449
452
|
// This offset includes not only the offset from where the first tag
|
|
450
453
|
// must begin, and the additional offset of where the first changed
|
|
451
454
|
// tag begins, but it must also account for prior descriptions
|
|
452
|
-
const initialOffset =
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
const initialOffset = Math.max(
|
|
456
|
+
// A tag on the opening line (`/** @param x`) leaves that line behind,
|
|
457
|
+
// so the tags must be added after it
|
|
458
|
+
1,
|
|
459
|
+
/** @type {import('../iterateJsdoc.js').Integer} */ (
|
|
460
|
+
firstLine
|
|
461
|
+
) + /** @type {import('../iterateJsdoc.js').Integer} */ (firstChangedTagIndex) +
|
|
462
|
+
|
|
463
|
+
// May be the first tag, so don't try finding a prior one if so
|
|
464
|
+
unchangedPriorTagDescriptions,
|
|
465
|
+
);
|
|
458
466
|
|
|
459
467
|
// Use `firstChangedTagLine` for line number to begin reporting/splicing
|
|
460
468
|
for (const idx of itemsToMoveRange) {
|
|
@@ -478,6 +486,13 @@ export default iterateJsdoc(({
|
|
|
478
486
|
{
|
|
479
487
|
...changedTag.source[0].tokens,
|
|
480
488
|
|
|
489
|
+
// A tag on the opening line (`/** @param x`) carries the block's
|
|
490
|
+
// opening delimiter, which must not be copied to the new line
|
|
491
|
+
...changedTag.source[0].tokens.delimiter === '/**' ? {
|
|
492
|
+
delimiter: '*',
|
|
493
|
+
start: closingLineStart,
|
|
494
|
+
} : {},
|
|
495
|
+
|
|
481
496
|
// `comment-parser` puts the `end` within the `tags` section, so
|
|
482
497
|
// avoid adding another to jsdoc.source
|
|
483
498
|
end: '',
|