Make WordPress Core

Opened 7 years ago

Last modified 5 weeks ago

#49381 new enhancement

Add Javascript Documentation to privacy-tools.js

Reported by: garrett-eclipse Owned by:
Priority: normal Milestone: Future Release
Component: Privacy Version:
Severity: normal Keywords: needs-docs good-first-bug has-patch
Cc: Focuses: javascript, docs

Description

Stemming from a comment on #44264 the privacy-tools.js functions should be properly documented;
Javascript Documentation guidelines - https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/#functions

Change History (9)

#1 @desrosj
2 years ago

  • Keywords needs-docs good-first-bug added
  • Milestone Awaiting ReviewFuture Release

Adding the good-first-bug label since this is a good ticket to get started contributing docs.

This ticket was mentioned in PR #6690 on WordPress/wordpress-develop by @narenin.


2 years ago
#2

  • Keywords has-patch added

#3 @narenin
2 years ago

Hi @desrosj

I have added the [PR]https://github.com/WordPress/wordpress-develop/pull/6690 with patch, please check.

@narenin commented on PR #6690:


2 years ago
#4

@mukeshpanchal27 I have implemented suggestions please check.

@narenin commented on PR #6690:


2 years ago
#5

@mukeshpanchal27 Please let me know if any other changes needs to be made.

This ticket was mentioned in PR #11936 on WordPress/wordpress-develop by @swapnil1010.


3 months ago
#6

Adds inline JSDoc documentation for functions in privacy-tools.js according to the WordPress JavaScript documentation standards.

This improves code readability and developer documentation for the Privacy component.

Trac ticket: https://core.trac.wordpress.org/ticket/49381

## Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT
Model(s): GPT-5.5
Used for: Grammar improvements and guidance while preparing documentation comments. Final code and documentation were reviewed and edited manually by me.

---

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request.

This ticket was mentioned in PR #12058 on WordPress/wordpress-develop by @yusufmudagal.


2 months ago
#7

This refreshes the JavaScript documentation work for privacy-tools.js with focused JSDoc blocks for the internal privacy request helper functions.

The documented functions cover action state handling, result notice rendering, export progress, and erasure progress.

Testing:

  • node --check src/js/_enqueues/admin/privacy-tools.js
  • git diff --check -- src/js/_enqueues/admin/privacy-tools.js

Notes:

  • Full JS lint was not run because dependencies are not installed in this clean worktree.

@yusufmudagal commented on PR #12058:


2 months ago
#8

Thanks for the guidance!

This PR is linked to the Trac ticket in the description: https://core.trac.wordpress.org/ticket/49381

This is a documentation-only JavaScript change, so I did not add automated tests. I ran the following checks locally:

node --check src/js/_enqueues/admin/privacy-tools.js
git diff --check -- src/js/_enqueues/admin/privacy-tools.js

@masteradhoc commented on PR #6690:


5 weeks ago
#9

Hey @narenin
Thank you very much for this PR! I'd like to get this merged in an upcoming WordPress Release.

Thanks for adding these JSDoc blocks — nice to see this function set documented! A few things to fix before this is ready per the [JS inline documentation standards]:

1. Missing @since tags
None of the new docblocks include an @since x.x.x tag. The standard requires this for every documented function (use svn blame to find the version each function was introduced in. Please add this to all blocks.

2. Drop the dash in @param descriptions
The standard format is @param {type} var Description. — no separator between the var name and description. Right now every param uses a dash, e.g.:

@param {object} $action - jQuery object representing the action element.

should be:

@param {object} $action jQuery object representing the action element.

3. Align multi-param blocks
Where a function has more than one @param, the standard asks for the type/name/description columns to be padded so they line up. E.g. in appendResultsAfterRow:

* @param {object} $requestRow      - jQuery object representing the request row.
* @param {string} classes          - CSS classes to add to the results row.
* @param {string} summaryMessage   - Summary message to display.
* @param {array}  additionalMessages - Additional messages to display.

(this also applies to setActionState and the doNextExport/doNextErasure two-param blocks) — once the dash is removed per #2, please still pad so descriptions start in a consistent column.

4. Type casing
{array} should be {Array} to match the capitalization convention used for {object}/{Array} elsewhere (primitives like string/number stay lowercase, built-in object types like Array/Object are capitalized).

5. Following up on @VladimirAus's comments
Agreed with both — the setExportProgress summary could be more specific about what drives the update, and the exporterIndex param description should mention its valid range (0 to exportersCount). Worth applying similar clarity passes to the analogous erasure-side functions (setErasureProgress/eraserIndex) for consistency.

Happy to take another pass once these are in!

Note: See TracTickets for help on using tickets.