comments - 不要使用 JSDoc (/** … */) 来进行实现注释?

标签 comments jsdoc

我正在经历https://google.github.io/styleguide/jsguide.html#formatting-comments了解 Google 为其开发者设置的风格指南。

Google 接受以下样式:

 /*
  * This is
  * okay.
 */

// And so
// is this.

/* This is fine, too. */

但有趣的是,Google 提到不要使用 JSDoc (/** ... */) 进行实现注释。

我在过去的项目中一直使用 JSDOC 样式。

知道为什么不推荐吗?

最佳答案

Google 风格指南 Terminology Notes

The term comment always refers to implementation comments. We do not use the phrase documentation comments, instead using the common term “JSDoc” for both human-readable text and machine-readable annotations within /** … */.

/**
 * Use JSDoc for documentation comments
 * @param {type} param description
 */
function someFunction(param) {
  // Do not use JSDoc for implementation comments
  const alias = goog.require('my.long.name.alias');
  // ...
}

  [1]: https://google.github.io/styleguide/jsguide.html#terminology-notes

关于comments - 不要使用 JSDoc (/** … */) 来进行实现注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63856469/

相关文章:

Java Youtube api 评分评论

javascript - 转换时jsLint奇怪的分配错误

javascript - 有没有办法在 JS 文档中定义泛型类型?

javascript - 直接从源代码生成 JavaScript 文档

visual-studio-2012 - Visual Studio 2012 的 jsDoc 智能感知

php - 如何按其他表中的最新记录对记录进行排序

php - 发布当前评论时间

php - 哪一个代码可以更快地处理 PHP 注释?有想法吗?

syntax - 如何在 Gherkin 中屏蔽评论?

javascript - 带有松散增强模块的 JSDoc 无法解析某些项目