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

chore: add js documentation contributing guidelines #474

Merged

Conversation

vasco-santos
Copy link
Member

Per sync discussion, this PR adds JS documentation contributing guidelines based on JSDoc based types.

The general decision is that type definition should be placed on the top of JS files.

cc @ipfs/js-core-team

@Gozala
Copy link

Gozala commented Dec 2, 2020

The only reason I was advocating for putting typedefs at the bottom as opposed to top is because it improves readability of the code (in my opinion anyway). You can get a general idea / bigger picture of what the code does and lookup additional details by scrolling to references (types or not). Putting all the jsdoc typedefs (which are ofter verbose in jsdoc style) in my experience creates opposite effect where I have to scroll quite a bit before I can get to read what the primary piece of code and then have scroll back up to lookup details.

Here is the discussion thread we had before on this (quoting for convenience here):

@hugomrdias: sorry i have been away for a while, did we set a convention to put typedefs at the bottom ? i personally prefer to open a file and go through the types before looking at the code.
@Gozala: I don't think we had conversation about it, so it end up according to my preference. Which is all the main stuff is at the top and all the things it's using is down below. I find that to be a better pattern as starts with a bigger / general picture and details follow. When you put all the nitty gritty at the top it tends to dilute what the primary thing done.

But again that just my personal preference. Maybe we should have a separate conversation to arrive to the consensus on this.

@hugomrdias: its fine and i have seem issues with jsdoc at the top

If this is just me, I have no reason to object to this. Furthermore I think we have general consensus towards defining types and interfaces in the .ts files (as per ipfs/js-ipfs#3413). So maybe it would make more sense to reword this to capture that, e.g:

Typedefs and interfaces should go into .ts files or be inline (function, method, class, etc..) anotations

@jacobheun
Copy link

Typedefs and interfaces should go into .ts files or be inline (function, method, class, etc..) annotations

I have no objections to this.

@vasco-santos
Copy link
Member Author

Typedefs and interfaces should go into .ts files or be inline (function, method, class, etc..) anotations

This seems good. @Gozala can you suggest a change regarding this?

@vasco-santos
Copy link
Member Author

Merging this. We can iterate on it afterward

@vasco-santos vasco-santos merged commit e0812a3 into master Dec 18, 2020
@vasco-santos vasco-santos deleted the chore/add-js-documentation-contributing-guidelines branch December 18, 2020 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants