8000 docs: enhance jsdoc comments by shunkica · Pull Request #511 · xmldom/xmldom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: enhance jsdoc comments #511

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

Merged
merged 33 commits into from
Aug 8, 2023
Merged

docs: enhance jsdoc comments #511

merged 33 commits into from
Aug 8, 2023

Conversation

shunkica
Copy link
Collaborator
@shunkica shunkica commented Jul 14, 2023

This PR aims to add comprehensive JSDoc annotations to dom.js, based on XML DOM spec. The main goal of this enhancement is to improve readability, maintainability, and to provide a more in-depth understanding of the code.

The functionality of the library is unaffected.

Copy link
@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@shunkica shunkica self-assigned this Jul 14, 2023
@shunkica shunkica added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file spec:DOM Level 3 https://www.w3.org/TR/DOM-Level-3-Core/ code style types Anything regarding Typescript labels Jul 14, 2023
@karfau
Copy link
Member
karfau commented Jul 19, 2023

@shunkica Can you help me to understand why you are adding jsdoc for interfaces that are not implemented by xmldom?

From my understanding just adding the jsdoc without implementing those interfaces only increases the bundle size of the package without providing any value fro the consumers.

If you are planning to use them in some way, I would prefer, if possible, having small PRs that add usage and jsdoc one at a time.

@shunkica
Copy link
Collaborator Author

If you are planning to use them in some way, I would prefer, if possible, having small PRs that add usage and jsdoc one at a time.

Ok. I will keep this PR strictly related to adding jsdoc for functionality which already exists in the lib.

@shunkica
Copy link
Collaborator Author
shunkica commented Jul 25, 2023 via email

@karfau
Copy link
Member
karfau commented Aug 8, 2023

@shunkica I'm planning to release 0.9.0 soon, since all things that were planned for it are ready.
Can you provide a rough ETA for this PR?
Not that it's needed for the release, just to know whether it makes sense to wait a bit longer.

@shunkica
Copy link
Collaborator Author
shunkica commented Aug 8, 2023 via email

@karfau
Copy link
Member
karfau commented Aug 8, 2023

What do you think about landing this PR now and you can file the next one once you have time for it?

I mean as in "I fix this PR and land it".

@shunkica
Copy link
Collaborator Author
shunkica commented Aug 8, 2023 via email

@karfau
Copy link
Member
karfau commented Aug 8, 2023

well, currently this PR does to many things at once.

I thought it would only add jsdoc, but that wouldn't explain failing tests.

I would go ahead and revert all changes not related to jsdoc and would be able to land the PR this way. Would that work for you?
(Especially cleaning up all those node type and error code variables should be at least one separate PR. changing the prototype chain of the DOMException should also be an extra PR, and might be considered a breaking one.)

One aspect I'm not sure about is whether it really makes sense to use the type alias DOMString for string. Since the library doesn't have any extra handling for the things mentioned in https://infra.spec.whatwg.org/#string or https://webidl.spec.whatwg.org/#idl-DOMString I find it more confusing then helpful to use a type alias.
So I would also have to undo the changes related to that, also because it was not applied everywhere consistently.

And last but not least: I don't like the usage of @todo tags in doc comments.
I started documenting the difference to the specified behavior as part of the text in a reasonable way and prefer to keep that style. (Also the todo has a different audience then the docstring, so I wouldn't want to mix those up.)

TODOs should ideally be tracked as GitHub issues, so they can prioritized.
(But of course it would be nice to not go ahead and create an issue for every todo in the code base. There might already be tickets for some of them, in which case the todo should be dropped from the code. And it's most likely possible to group some of them into a lower amount of issues.)

Those are quite some changes, but I have them ready.
If it's OK for you I will push them to your branch, and land it.

@shunkica
Copy link
Collaborator Author
shunkica commented Aug 8, 2023 via email

@karfau karfau changed the title Enhancement: Addition of JSDoc to dom.js docs: enhance jsdoc comments Aug 8, 2023
@codecov
Copy link
codecov bot commented Aug 8, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (3e59ac1) 92.77% compared to head (e2779bd) 92.77%.

❗ Current head e2779bd differs from pull request most recent head f73d711. Consider uploading reports for the commit f73d711 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #511   +/-   ##
=======================================
  Coverage   92.77%   92.77%           
=======================================
  Files           7        7           
  Lines        2036     2036           
  Branches      530      530           
=======================================
  Hits         1889     1889           
  Misses        147      147           
Files Changed Coverage Δ
lib/conventions.js 100.00% <ø> (ø)
lib/dom-parser.js 93.52% <ø> (ø)
lib/dom.js 88.50% <ø> (ø)
lib/sax.js 98.16% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karfau karfau marked this pull request as ready for review August 8, 2023 21:14
@karfau
Copy link
Member
karfau commented Aug 8, 2023

Thank you for your efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code style dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation spec:DOM Level 3 https://www.w3.org/TR/DOM-Level-3-Core/ types Anything regarding Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0