Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
649d54c to
d9ad597
Compare
d9ad597 to
06b5211
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Enables the JSDoc rule `valid-types` and fixes all the reported violations. Part of the effort to improve JS inline documentation for 7.2. Developed in #13486 See #66033. git-svn-id: https://develop.svn.wordpress.org/trunk@63766 602fd350-edb4-49c9-b593-d223f7449a82
Enables the JSDoc rule `valid-types` and fixes all the reported violations. Part of the effort to improve JS inline documentation for 7.2. Developed in WordPress/wordpress-develop#13486 See #66033. Built from https://develop.svn.wordpress.org/trunk@63766 git-svn-id: http://core.svn.wordpress.org/trunk@62938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Committed in https://core.trac.wordpress.org/changeset/63766 |
westonruter
left a comment
There was a problem hiding this comment.
@afercia A post-commit review for you.
| * @param {wpList~confirm} settings.confirm Callback that's run before a request is made. Default: null. | ||
| * @param {wpList~addBefore} settings.addBefore Callback that's run before an item gets added to the list. | ||
| * Default: null. | ||
| * @param {wpList~addAfter} settings.addAfter Callback that's run after an item got added to the list. | ||
| * Default: null. | ||
| * @param {wpList~delBefore} settings.delBefore Callback that's run before an item gets deleted from the list. | ||
| * Default: null. | ||
| * @param {wpList~delAfter} settings.delAfter Callback that's run after an item got deleted from the list. | ||
| * Default: null. | ||
| * @param {wpList~dimBefore} settings.dimBefore Callback that's run before an item gets dim'd. Default: null. | ||
| * @param {wpList~dimAfter} settings.dimAfter Callback that's run after an item got dim'd. Default: null. |
There was a problem hiding this comment.
I'm not familiar with this ~ syntax. It does seem unnecessary regardless. However, with TypeScript we could potentially re-introduce some flavor of that.
There was a problem hiding this comment.
JSDoc doesn't validate them. Not sure that ~ syntax is still valid. JSDoc can't understand it anyways. After all these are all callback functions. We will see when you will extend TypeScript to this file.
| /** | ||
| * Adds event that opens the time stamp form if the form is hidden. | ||
| * | ||
| * @listens $edittimestamp:click |
There was a problem hiding this comment.
Why did these @listens tags need to be removed? They seem valid: https://jsdoc.app/tags-listens
There was a problem hiding this comment.
Same: JSDoc doesn't validate them. It doesn't understand this 'path'. Also, not sure what value these @listens tag may add because the function is self-explanatory.... when I read:
$edittimestamp.on( 'click', ....
I already see what I need to know.
That said, if you can find a way to make JSDoc understand these @listens and not report a violation, I'm all for it.
| * @param {{beforeSend}, *} options Additional options for the sync. | ||
| * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. | ||
| * @param {Backbone.Model} model The model to be synced. | ||
| * @param {Object} options Additional options for the sync. |
There was a problem hiding this comment.
This is now less-specific than before. It seems like it should have been something like this:
| * @param {Object} options Additional options for the sync. | |
| * @param {Object} options Additional options for the sync. | |
| * @param {Function} [options.beforeSend] Callback to run before sending. | |
| * @param {Function} [options.success] Callback executed on a successful request. | |
| * @param {Function} [options.error] Callback executed on a failed request. |
There was a problem hiding this comment.
I don't see options.success or options.error here, while I do see options.complete. I will add it.
There was a problem hiding this comment.
They are documented in Backbone's options: https://backbonejs.org/#Sync
There was a problem hiding this comment.
I see and all other jQuery request options
Does that mean we should really document ALL those options? I'd say no, and maybe we should just keep the main options object.
There was a problem hiding this comment.
Probably, not, no. Let's just do beforeSend.
| * @param {string} method The CRUD method ("create", "read", "update", or "delete") to be performed. | ||
| * @param {Backbone.Model} model The model to be synced. | ||
| * @param {{success}, *} options Additional options for the sync. | ||
| * @param {Object} options Additional options for the sync. |
| /** | ||
| * @static | ||
| * @type Array | ||
| */ |
There was a problem hiding this comment.
Curious why this needs to be removed?
There was a problem hiding this comment.
Again, JSDoc doesn't validate this. Also, is it a static? Looks like just a local vari to me.
| /** | ||
| * @static | ||
| * @type Array | ||
| */ |
There was a problem hiding this comment.
Also curious about this removal.
| * @fires wp.media.controller.MediaLibrary#attachment:details:shift-tab | ||
| * @fires wp.media.controller.MediaLibrary#attachment:keydown:arrow |
There was a problem hiding this comment.
Why remove these here but they are kept elsehwere?
There was a problem hiding this comment.
Because these ones aren't validated by JSDoc :)
There was a problem hiding this comment.
Also, I don't understand the value added by these @fires tags. I can see what the function triggers... .trigger( 'attachment:details:shift-tab', event ); by just looking sat the code.
| * handlers to prevent duplicate listeners. | ||
| * | ||
| * @since 4.0.0 | ||
| * Listens for the `window:resize` event. |
There was a problem hiding this comment.
Same as above. JSDoc doesn't understand @listens window:resize and honestly these listens tags are useless.
| * in the options. | ||
| * | ||
| * @since 3.5.0 | ||
| * Fires `collection:reset`. |
See https://core.trac.wordpress.org/ticket/66033
jsdoc/valid-types.There are 69 violations of the
valid-typesrule. @westonruter since you are the types master, would you like to take care of this fix? Just runnpm run lint:jsdocand fix all the reported violations.Use of AI Tools
AI assistance: Yes
Tool(s): Local Ollama service with Continue in VSCode
Model(s): qwen3.8:27b-mlx
Used for: Research JSDoc fixes. Final implementation checked 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. See GitHub Pull Requests for Code Review in the Core Handbook for more details.