eslint-plugin-jsdoc 65.4.7 → 65.4.8

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
@@ -164,5 +164,5 @@
164
164
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
165
165
  "test-index": "pnpm run test-no-cov test/rules/index.js"
166
166
  },
167
- "version": "65.4.7"
167
+ "version": "65.4.8"
168
168
  }
@@ -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 = /** @type {import('../iterateJsdoc.js').Integer} */ (
453
- firstLine
454
- ) + /** @type {import('../iterateJsdoc.js').Integer} */ (firstChangedTagIndex) +
455
-
456
- // May be the first tag, so don't try finding a prior one if so
457
- unchangedPriorTagDescriptions;
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: '',