Repository navigation
Enable the JSDoc rule valid-types
#13486
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
Changes from all commits
bbf4573
3a7da74
5fc6bde
c952955
043dda7
5ca7201
bad3cbe
d978758
da42376
dc86b1f
a367980
9df8a69
f8c9155
550dedd
5303c3c
30d269c
d93c359
f7cfcde
8c053ec
06b5211
1201c48
373de73
43e5ea5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -812,31 +812,31 @@ wpList = { | |
| /** | ||
| * Initializes wpList object. | ||
| * | ||
| * @param {Object} settings The settings for the wpList instance. | ||
| * @param {string} settings.url URL for ajax calls. Default: ajaxurl. | ||
| * @param {string} settings.type The HTTP method to use for Ajax requests. Default: 'POST'. | ||
| * @param {string} settings.response ID of the element the parsed ajax response will be stored in. | ||
| * Default: 'ajax-response'. | ||
| * @param {Object} settings The settings for the wpList instance. | ||
| * @param {string} settings.url URL for ajax calls. Default: ajaxurl. | ||
| * @param {string} settings.type The HTTP method to use for Ajax requests. Default: 'POST'. | ||
| * @param {string} settings.response ID of the element the parsed ajax response will be stored in. | ||
| * Default: 'ajax-response'. | ||
| * | ||
| * @param {string} settings.what Default: ''. | ||
| * @param {string} settings.alt CSS class name for alternate styling. Default: 'alternate'. | ||
| * @param {number} settings.altOffset Offset to start alternate styling from. Default: 0. | ||
| * @param {string} settings.addColor Hex code or 'none' to disable animation. Default: '#ffff33'. | ||
| * @param {string} settings.delColor Hex code or 'none' to disable animation. Default: '#faafaa'. | ||
| * @param {string} settings.dimAddColor Hex code or 'none' to disable animation. Default: '#ffff33'. | ||
| * @param {string} settings.dimDelColor Hex code or 'none' to disable animation. Default: '#ff3333'. | ||
| * @param {string} settings.what Default: ''. | ||
| * @param {string} settings.alt CSS class name for alternate styling. Default: 'alternate'. | ||
| * @param {number} settings.altOffset Offset to start alternate styling from. Default: 0. | ||
| * @param {string} settings.addColor Hex code or 'none' to disable animation. Default: '#ffff33'. | ||
| * @param {string} settings.delColor Hex code or 'none' to disable animation. Default: '#faafaa'. | ||
| * @param {string} settings.dimAddColor Hex code or 'none' to disable animation. Default: '#ffff33'. | ||
| * @param {string} settings.dimDelColor Hex code or 'none' to disable animation. Default: '#ff3333'. | ||
| * | ||
| * @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. | ||
|
Comment on lines
-829
to
-839
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar with this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSDoc doesn't validate them. Not sure that |
||
| * @param {Function} settings.confirm Callback that's run before a request is made. Default: null. | ||
| * @param {Function} settings.addBefore Callback that's run before an item gets added to the list. | ||
| * Default: null. | ||
| * @param {Function} settings.addAfter Callback that's run after an item got added to the list. | ||
| * Default: null. | ||
| * @param {Function} settings.delBefore Callback that's run before an item gets deleted from the list. | ||
| * Default: null. | ||
| * @param {Function} settings.delAfter Callback that's run after an item got deleted from the list. | ||
| * Default: null. | ||
| * @param {Function} settings.dimBefore Callback that's run before an item gets dim'd. Default: null. | ||
| * @param {Function} settings.dimAfter Callback that's run after an item got dim'd. Default: null. | ||
| * @return {$.fn} wpList API function. | ||
| */ | ||
| $.fn.wpList = function( settings ) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,7 +60,7 @@ | |||||||||||
| * Determine model based on API route. | ||||||||||||
| * | ||||||||||||
| * @param {string} route The API route. | ||||||||||||
| * @return {Backbone Model} The model found at given route. Undefined if not found. | ||||||||||||
| * @return {Backbone.Model|undefined} The model found at given route. Undefined if not found. | ||||||||||||
| */ | ||||||||||||
| wp.api.getModelByRoute = function( route ) { | ||||||||||||
| return _.find( wp.api.models, function( model ) { | ||||||||||||
|
|
@@ -72,7 +72,7 @@ | |||||||||||
| * Determine collection based on API route. | ||||||||||||
| * | ||||||||||||
| * @param {string} route The API route. | ||||||||||||
| * @return {Backbone Model} The collection found at given route. Undefined if not found. | ||||||||||||
| * @return {Backbone.Collection|undefined} The collection found at given route. Undefined if not found. | ||||||||||||
| */ | ||||||||||||
| wp.api.getCollectionByRoute = function( route ) { | ||||||||||||
| return _.find( wp.api.collections, function( collection ) { | ||||||||||||
|
|
@@ -311,7 +311,7 @@ | |||||||||||
| /** | ||||||||||||
| * Add mixins and helpers to models depending on their defaults. | ||||||||||||
| * | ||||||||||||
| * @param {Backbone Model} model The model to attach helpers and mixins to. | ||||||||||||
| * @param {Backbone.Model} model The model to attach helpers and mixins to. | ||||||||||||
| * @param {string} modelClassName The classname of the constructed model. | ||||||||||||
| * @param {Object} loadingObjects An object containing the models and collections we are building. | ||||||||||||
| * @return {undefined} No return value. | ||||||||||||
|
|
@@ -868,9 +868,9 @@ | |||||||||||
| /** | ||||||||||||
| * Set nonce header before every Backbone 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 {{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. | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now less-specific than before. It seems like it should have been something like this:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see options.success or options.error here, while I do see options.complete. I will add it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are documented in Backbone's options: https://backbonejs.org/#Sync
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably, not, no. Let's just do |
||||||||||||
| * @return {*}. | ||||||||||||
| */ | ||||||||||||
| sync: function( method, model, options ) { | ||||||||||||
|
|
@@ -1033,7 +1033,7 @@ | |||||||||||
| * | ||||||||||||
| * @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. | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto above. |
||||||||||||
| * @return {*}. | ||||||||||||
| */ | ||||||||||||
| sync: function( method, model, options ) { | ||||||||||||
|
|
@@ -1108,8 +1108,9 @@ | |||||||||||
| /** | ||||||||||||
| * Fetches the next page of objects if a new page exists. | ||||||||||||
| * | ||||||||||||
| * @param {data: {page}} options An object containing the page number to fetch. If not provided, the next page will be fetched. | ||||||||||||
| * @return {*}. | ||||||||||||
| * @param {Object} [options] An object containing the page number to fetch. If not provided, the next page will be fetched. | ||||||||||||
| * @param {number} [options.data.page] The page number to fetch. | ||||||||||||
| * @return {JQuery.Promise} A promise that resolves when the fetch operation completes. | ||||||||||||
| */ | ||||||||||||
| more: function( options ) { | ||||||||||||
| options = options || {}; | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,10 +275,6 @@ themes.Collection = Backbone.Collection.extend({ | |
| * which triggers events of `query:success` or `query:fail`. | ||
| */ | ||
| query: function( request ) { | ||
| /** | ||
| * @static | ||
| * @type Array | ||
| */ | ||
|
Comment on lines
-278
to
-281
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious why this needs to be removed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, JSDoc doesn't validate this. Also, is it a static? Looks like just a local vari to me. |
||
| var queries = this.queries, | ||
| self = this, | ||
| query, isPaginated, count; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did these
@listenstags need to be removed? They seem valid: https://jsdoc.app/tags-listensThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same: JSDoc doesn't validate them. It doesn't understand this 'path'. Also, not sure what value these
@listenstag 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
@listensand not report a violation, I'm all for it.