Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#65951 closed defect (bug) (fixed)

Fix all the JSDocs

Reported by: afercia Owned by: afercia
Priority: normal Milestone: 7.2
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses: javascript, docs, coding-standards

Description

After the JSDoc ESLint script is fixed in #65939, all the 37 errors and 3 warnings reported by JSDoc across the Core JS files should be fixed.

Attachments (1)

65951-jsdoc.patch​ (231.4 KB ) - added by sachinrajcp123 3 months ago.

Download all attachments as: .zip

Change History (23)

This ticket was mentioned in ​PR #13251 on ​WordPress/wordpress-develop by ​@afercia.


3 months ago
#1

  • Keywords has-patch added

​@afercia commented on ​PR #13251:


3 months ago
#2

Regarding the optional hyphen before the param description, it can be disallowed or required via the ​jsdoc/require-hyphen-before-param-description rule.

However, as mentioned in the review comments, making it required would need a proposal to change the JS docs coding standards.

​@afercia commented on ​PR #13251:


3 months ago
#3

The missing param types were not flagged because of a typo in the new configuration I'm using to lint the files, where ​jsdoc/require-param-type was duplicated and ultimately set to 'off'.

​@afercia commented on ​PR #13251:


3 months ago
#4

Now thaat the new JSDoc configuration has been merged in core, I rebased this PR on top of trunk. Running:

npm run lint:jsdoc

should now report no errors.

​@westonruter commented on ​PR #13251:


3 months ago
#5

Per ​https://github.com/WordPress/wordpress-develop/pull/13251#discussion_r3883382337, I'll adopt all of the Customizer changes to work on separately for Core-40831 to merge with ​https://github.com/WordPress/wordpress-develop/pull/10743.

​@afercia commented on ​PR #13251:


3 months ago
#6

@westonruter thank you for all the feedback and assistance on this PR. It's a pleasure and an excellent learning opportunity for me.

On the other hand, I feel like we are loosing focus on the main goal of this PR. We're not aiming at perfection in documenting all these docblocks. Rather, this is a necessary step to solve all the errors reported so far by the minimal, temporary, JSDoc configuration that was updated in ​https://github.com/WordPress/wordpress-develop/pull/13237.

Once we have a clean JSDoc report, we can enforce the script on CI. Then, starting from there, a collective effort should start to introduce new rules and adjust accordingly to revive the ​the ​JavaScript Inline Docs Initiative which is a needed long-term project.

I'm also concerned about the size of this PR. While it's not that huge in terms of size of the diff, it touches more than 100 files. I'm not that comfortable with an SVN commit that touches such a large number of files. I will probably try to split it in chunks. But at this point It would be nice to not make it even larger. Is it good enough to be committed in your opinion?

​@westonruter commented on ​PR #13251:


3 months ago
#7

@afercia:

On the other hand, I feel like we are loosing focus on the main goal of this PR. We're not aiming at perfection in documenting all these docblocks. Rather, this is a necessary step to solve all the errors reported so far by the minimal, temporary, JSDoc configuration that was updated in #13237.

Yeah, good point. You're right. It could be an endless rabbithole.

Once we have a clean JSDoc report, we can enforce the script on CI. Then, starting from there, a collective effort should start to introduce new rules and adjust accordingly to revive the ​the ​JavaScript Inline Docs Initiative which is a needed long-term project.

I've just filed Core-65997 as the umbrella ticket for further improvements to the TypeScript as the continuation of the initial fixing of the JSDoc you've done here.

I'm also concerned about the size of this PR. While it's not that huge in terms of size of the diff, it touches more than 100 files. I'm not that comfortable with an SVN commit that touches such a large number of files. I will probably try to split it in chunks. But at this point It would be nice to not make it even larger. Is it good enough to be committed in your opinion?

Remember you can revert the Customizer changes since those are being done in ​https://github.com/WordPress/wordpress-develop/pull/10743. So that's one of these such chunks that I'll take care of once you approve.

​@afercia commented on ​PR #13251:


3 months ago
#8

As a first next step after this is merged, and to help revive the ​the ​JavaScript Inline Docs Initiative, I'd suggest to update the configuration to detect all the places where a docblock is missing entirely.

In a first phase, set jsdoc/require-jsdoc to warn, to not block CI;

By default, it reports 79 violations for FunctionDeclaration missing docblocks.
Including FunctionExpression, the errors are 1098.

​@westonruter commented on ​PR #13251:


3 months ago
#9

In d84afe0 I've fixed the merge conflict in src/js/_enqueues/lib/embed-template.js by opting for what is now in trunk after r63400, r63402, and r63403.

And in 8f1a06b I've reverted the changes to the Customizer JS files since those changes have been extracted into a separate PR: ​https://github.com/WordPress/wordpress-develop/pull/10743.

​@afercia commented on ​PR #13251:


3 months ago
#10

I've reverted the changes to the Customizer JS files

@westonruter thank you.
Just noting that this PR now triggers 144 errors when running npm run lint:jsdoc while the goal was to have a clean report. It will need to wait for ​https://github.com/WordPress/wordpress-develop/pull/10743 to be merged first.

​@afercia commented on ​PR #13251:


3 months ago
#15

Note that, in preparation of the SVN commit to bring in this change, I split this pull request into 4 smaller ones (listed above). I will commit them separately to not touch a large amount of files at the same time.

#16 @afercia
3 months ago

  • Component Build/Test Tools → General
  • Focuses docs coding-standards added
  • Owner set to afercia
  • Status new → assigned

#17 @afercia
3 months ago

all the 37 errors and 3 warnings reported by JSDoc

Note for history: after the JSDoc configuration was refined, the actual amount of errors was way higher than 37. They where a few hundreds.

I split the PR linked above into 4 smaller ones to avoid touching a large amount of files in a single SVN commit:

#18 @afercia
3 months ago

In 63406:

General: Improve JavaScript inline code documentation part 1.

Fixes the JSDoc violations reported by the lint:jsdoc updated configuraiton after [63392]. First part,

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13251

Props afercia, westonruter.
See #65951, #65939.

#19 @afercia
3 months ago

In 63407:

General: Improve JavaScript inline code documentation part 2.

Fixes the JSDoc violations reported by the lint:jsdoc updated configuraiton after [63392]. Second part,

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13251

Props afercia, westonruter.
See #65951, #65939.

#20 @afercia
3 months ago

In 63408:

General: Improve JavaScript inline code documentation part 3.

Fixes the JSDoc violations reported by the lint:jsdoc updated configuraiton after [63392]. Third part,

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13251

Props afercia, westonruter.
See #65951, #65939.

#21 @afercia
3 months ago

  • Resolution → fixed
  • Status assigned → closed

In 63409:

General: Improve JavaScript inline code documentation part 4.

Fixes the JSDoc violations reported by the lint:jsdoc updated configuraiton after [63392]. Last part,

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13251

Props afercia, westonruter.
See #65939.
Fixes #65951.

#22 @afercia
3 months ago

The remaining JSDoc for the files belonging to the Customizer will be fixed in #40831.

Note: See TracTickets for help on using tickets.