tmcw / dx-spec

Issue (and spec) repository for the development of a spec that would succeed JSDoc.
27 stars 0 forks source link

Comment attachment rules #20

Open tmcw opened 6 years ago

tmcw commented 6 years ago

When do comments attach to content, and when do they not attach?

For instance:

// does this comment need to be right next to
function theFunction() {}

// does the linebreak below detach this comment? would 2 linebreaks detach it?

function theFunction() {}

My 2c: no whitespace should not be permitted. However, babylon attaches a leadingComment in either case, so the raw AST wouldn't make this obvious - you'd have to compare the comment's ending line versus the node's starting line.