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

Jsdoc #82

Merged
merged 22 commits into from
Sep 2, 2019
Merged

Jsdoc #82

merged 22 commits into from
Sep 2, 2019

Conversation

mroderick
Copy link
Member

@mroderick mroderick commented Aug 26, 2019

This PR is, an exploration of how we might go about solving sinonjs/sinon#2003

Purpose (TL;DR)

Cover all of the public methods, and most of the internals (not anonymous functions) with JSDoc comments.

This allows us to generate API documentation, as requested in sinonjs/sinon#2003 and will also allow us to publish API documentation as suggested in sinonjs/sinon#1651.

It will also allow users of advanced IDEs to use the JSDoc for autocompletion and type checking. See Type Safe JavaScript with JSDoc

Solution

  • Add jsdoc to generate documentation site
  • Add eslint-plugin-jsdoc
  • Add jsdoc to functions

How to verify

  1. Check out this branch
  2. npm install
  3. npm run lint
  4. Observe only one lint warning (I don't yet know how to model that one, nor am I sure we should worry about it, since it's in eslint-local-rules.js, which should be in shared package sometime soon)
  5. npm run jsdoc
  6. Open out/index.html
  7. Observe some API documentation, that only lists the public methods currently exposed by samsam.

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

@mroderick
Copy link
Member Author

I can confirm that VSCode is able to read these annotations just fine.

"javascript.implicitProjectConfig.checkJs": true

Result

2019-08-28 at 22 02

@codecov
Copy link

codecov bot commented Aug 31, 2019

Codecov Report

Merging #82 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
- Coverage   98.52%   98.51%   -0.01%     
==========================================
  Files          17       17              
  Lines         473      472       -1     
==========================================
- Hits          466      465       -1     
  Misses          7        7
Flag Coverage Δ
#unit 98.51% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
lib/identical.js 100% <ø> (ø) ⬆️
lib/is-subset.js 100% <ø> (ø) ⬆️
lib/is-object.js 100% <ø> (ø) ⬆️
lib/is-date.js 100% <ø> (ø) ⬆️
lib/get-class.js 100% <ø> (ø) ⬆️
lib/samsam.js 100% <ø> (ø) ⬆️
lib/match.js 96.77% <ø> (ø) ⬆️
lib/create-set.js 100% <ø> (ø) ⬆️
lib/deep-equal.js 97% <ø> (ø) ⬆️
lib/is-arguments.js 92.3% <ø> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04dfbbc...a104b10. Read the comment docs.

Copy link
Member

@mantoni mantoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mroderick mroderick merged commit 18ce530 into sinonjs:master Sep 2, 2019
@mroderick mroderick deleted the jsdoc branch September 2, 2019 09:50
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.

2 participants