Javascript: Distinguish doc-comments from other comments

Created on 25 Dec 2017  Â·  11Comments  Â·  Source: airbnb/javascript

https://github.com/airbnb/javascript#comments--multiline
recommend /** ... */ without even mentioning /* ... */. The former should only be used for doc-comments. The latter should be used for all comments that are not doc-comments, even if they are multiline.

editorial

All 11 comments

I'm not sure I understand; what our guide requires is to use /* */ for any multiline comment, full stop.

Look at the example comment.

On Dec 25, 2017 1:24 PM, "Jordan Harband" notifications@github.com wrote:

I'm not sure I understand; what our guide requires is to use /* */ for
any multiline comment, full stop.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/airbnb/javascript/issues/1679#issuecomment-353883845,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAQtzO44MUeVtb6ZWlafdsjjRErzg1Ciks5tD-h1gaJpZM4RMWFb
.

The first one is marked "bad" (because it uses // and is multiline), the second one is marked "good" (because it uses /* and is multiline).

@ljharb: Created a PR to illustrate the issue @erights mentioned.

I still don’t understand. Two stars should be used in any and all multiline comment beginnings.

Then maybe it's something else, let's hear from @erights. Closed the PR.

I’m also not sure what a “doc-comment” is - do you mean JSDoc? We more or less ban JSDoc entirely; we just haven’t put it in the guide yet, so i wouldn’t want to call them out specifically here.

Why does your example comment begin with "/*" rather than "/"?

The extra * is intentionally required so all the *s can be aligned, as in the "good" examples.

/*
 * make() returns a new element
 * based on the passed-in tag name
 */

aligns the *s without beginning with a /**.

Then the inner stars are only indented by one space, instead of two.

However, i do think i see what you mean - the “good” example doesn’t do this alignment. I’ll clean up this section.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surfaceowl picture surfaceowl  Â·  3Comments

ar
mbifulco picture mbifulco  Â·  3Comments

mismith picture mismith  Â·  3Comments

brendanvinson picture brendanvinson  Â·  4Comments

weihongyu12 picture weihongyu12  Â·  3Comments