dx-spec icon indicating copy to clipboard operation
dx-spec copied to clipboard

Comment attachment rules

Open tmcw opened this issue 7 years ago • 0 comments
trafficstars

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.

tmcw avatar Nov 24 '17 07:11 tmcw