airbnb / javascript

JavaScript Style Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiline comments

thomasttvo opened this issue · comments

The multiline comment section says all multiline comments need to use the jsdoc syntax /** */. Is this right? Does the author mean "All jsdoc comments" instead of "multiline"?

Otherwise, it doesn't really make sense if we use jsdoc where we're not documenting a variable, class, or function

/** 
 * This function does XYZ
 */ 
function xyz() {
  /**
   * This chunk of code does this because we don't like to do it the other way.
   * Otherwise, zombie apocalypse.
   */ 
 const a = b + 1;
 doSomething(a);

 /**
  * Here we're just having fun if nothing happens
  * Busines continues as usual
  */
 doSomething(b)
}

It refers to all multiline comments, and the guide assumes you are not using jsdoc at all.

that's quite strange, would you say my above code is correct? Shouldn't it be like below?

/** 
 * This function does XYZ
 */ 
function xyz() {
  // This chunk of code does this because we don't like to do it the other way.
  // Otherwise, zombie apocalypse. 
 const a = b + 1;
 doSomething(a);

 // Here we're just having fun if nothing happens
 // Busines continues as usual
 doSomething(b)
}

No, I’d say both are fine.