prettier-plugin-jsdoc
prettier-plugin-jsdoc copied to clipboard
Poor handling for @example with a JS decorator
The plugin splits up code examples that include a decorator. It seems the jsdoc parser interprets the @
as a jsdoc tag.
example 1
@example
is removed entirely because the parser thinks there is no content
before
/**
* Decorate my injectable service.
*
* @example
* @Inject()
* private readonly someService: SomeService;
*
* @example
* @Inject() private readonly someService: SomeService;
*/
export class SomeService {}
after
/**
* Decorate my injectable service.
*
* @Inject() private readonly someService: SomeService;
*
* @Inject() private readonly someService: SomeService;
*/
export class SomeService {}
example 2
I added code comments to prove my hypothesis from example 1 (above).
You can see that the @Inject
is extracted and moved down below the @example
blocks.
before
/**
* Decorate my injectable service.
*
* @example
* // example 1
* @Inject()
* private readonly someService: SomeService;
*
* @example
* // example 2
* @Inject() private readonly someService: SomeService;
*/
export class SomeService {}
after
/**
* Decorate my injectable service.
*
* @example // example 1
*
* @example // example 2
*
* @Inject() private readonly someService: SomeService;
*
* @Inject() private readonly someService: SomeService;
*/
export class SomeService {}