所有的官方JSDoc例子有天真简单的文档字符串,如下所示:什么是长JSDoc行的正确/规范格式?
/**
* @param {string} author - The author of the book.
*/
的问题是,在现实生活中的文档中,你往往有较长的文档字符串:
/**
* @param {string} author - The author of the book, presumably some person who writes well
*/
但由于大多数公司(出于合法的可读性原因)具有线路长度限制,上述情况通常是不可接受的。但是,我无法弄清楚的是分拆这些生产线的“正确”方式应该是什么。
我可以这样做:
/**
* @param {string} author - The author of the book, presumably some
* person who writes well
*/
但是,这是难以阅读。我可以改为做:
/**
* @param {string} author - The author of the book, presumably some
* person who writes well
*/
这看起来更好,但它会导致吨线,特别是如果该参数有一个长的名字:
/**
* @param {string} personWhoIsTheAuthorOfTheBook - The author of the
* book, presumably
* some person who
* writes well
*/
所以我的问题是,什么是正确/官方/规范的方式来格式化长@param
行(在代码中,而不是在生成的JSDoc中)......或者真正的任何长注释行。