Problem statement
When formatting a JSDoc block where the trailing description (e.g., "Dialog DOM references.") appears after a type definition in a @returns annotation, the formatter introduces a bug:
- On each format, the trailing text is moved to a new line.
- Reapplying formatting splits this text further, creating additional lines.
- Repeated formatting results in infinite duplication of these lines.
Example JSDoc (before formatting)
/**
* Creates the restore dialog and its controls.
* @returns {{
* fileInput: HTMLInputElement,
* mergeCheckbox: HTMLInputElement,
* overlay: HTMLDivElement,
* }} Dialog DOM references.
*/
Result after formatting (problematic behavior)
See attached image. The formatter duplicates lines containing the trailing description each time formatting is applied.
Expected behavior
- The formatter should keep the trailing description on a single line after the type definition and not duplicate or split it after repeated formatting.
Environment
- Repository: hosseinmd/prettier-plugin-jsdoc
- Version: [1.8.0]
- Prettier version: [3.8.1]
- Node version: [25.9.0]
Steps to reproduce
- Use the JSDoc block shown above.
- Format the file using this plugin.
- Observe how the trailing description is split and duplicated with each additional format.
References
Problem statement
When formatting a JSDoc block where the trailing description (e.g., "Dialog DOM references.") appears after a type definition in a
@returnsannotation, the formatter introduces a bug:Example JSDoc (before formatting)
Result after formatting (problematic behavior)
See attached image. The formatter duplicates lines containing the trailing description each time formatting is applied.
Expected behavior
Environment
Steps to reproduce
References