syavorsky/comment-parser

Default value quotes should not be stripped

jaydenseric opened this issue · 1 comments

At the moment, parsing strips the quotes wrapping default values:

default: 'yay!',

This is problematic, because it makes it impossible to tell the difference between a string literal default value, or a namepath reference.

E.g.

/**
 * The description.
 * @kind constant
 * @name FOO
 * @type {string}
 */
const FOO = 'FOO'

/**
 * @kind function
 * @name bar
 * @param {string} [foo=FOO] The description.
 */
function bar(foo = FOO) {}

Vs:

/**
 * The description.
 * @kind function
 * @name bar
 * @param {string} [foo='FOO'] The description.
 */
function bar(foo = 'FOO') {}

I need to be able to tell the difference in jsdoc-md, so that for default values I can create a link around a namepath reference vs an inline code display of a string literal.

+ comment-parser@0.7.5