Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JSDoc #94

Open
zghera opened this issue Jul 22, 2020 · 2 comments
Open

Update JSDoc #94

zghera opened this issue Jul 22, 2020 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@zghera
Copy link
Collaborator

zghera commented Jul 22, 2020

Issue summary

Update JSDoc to follow the standards outlined in the Google JS StyleGuide and the JSDoc documentation (cheat-sheet too).

Expected behavior

Good looking JSDoc when generated with jsdoc path/to/file.js. Also add a script in package.json (such as the one here) as well as a conf.json file like the one here.

Actual behavior

Current correct JSDoc usage is flaky.

@zghera zghera added the documentation Improvements or additions to documentation label Jul 22, 2020
@zghera zghera added the enhancement New feature or request label Jul 22, 2020
@zghera
Copy link
Collaborator Author

zghera commented Jul 22, 2020

@ananyeet 's initial comment in chat for reference:

if you're making a type (i.e. trip, activity), make a typedef:

/**
 * An activity object. 
 * @typedef {Object} ActivityInfo
 * @property {string} id The activity's ID in the database.
 * @property {string} tripId The activity's tripId in the database.
 * @property {string} title The activity's title.
 * @property {long} start_time Number of seconds since epoch of activity's start time.
 * @property {long} end_time Number of seconds since epoch of activity's end time.
 * @property {string} [description] The activity's description.
 */

1D arrays marked as string[] and 2D marked as Array.<string[]> but this could be optional, just nice to read. Like I have an array that's marked as {Array.<string, ActivityInfo[]>}

btw code with the single ticks ` doesn't work, use and

code on a new line uses

 and 

props look really nice like this:


/**
 * React component for a single day of activities. 
 * 
 * @property {Object} props ReactJS props. 
 * @property {ActivityInfo[]} props.activities The list of activities for 'today'.
 * @property {string} props.date The date, formatted as 'MM/DD/YYYY'.
 */

and the real tag is @return not @returns

oh yeah and https://devhints.io/jsdoc this site is nice

@zghera
Copy link
Collaborator Author

zghera commented Jul 22, 2020

Found another thing here, the @OverRide annotation is preferred over @inheritdoc. Especially so when you are including other documentation in the same JSDoc comment like here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants