我正在经历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/