-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix documentation lint
issues
#1544
Conversation
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.
Changes look good to me.
One thing I'll note is that I don't think documentation lint
is running on folders recursively. So there are likely to be lots of other errors in modules
, src
, etc.
No reason that that should hold up these changes, though.
src/prebid.js
Outdated
* @property {function} defaults.bidsBackHandler | ||
* @property {number} defaults.timeout | ||
* @property {Array} defaults.adUnits | ||
* @property {Array} defaults.adUnitCodes |
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.
I'm not positive, but... is this generating the right docs? I wouldn't expect to see @property
used in this way.
A sample call would look something like:
pbjs.requestBids({
timeout: ...,
adUnits: ...,
adUnitCodes: ...,
bidsBackHandler: function(bids) { ... }
});
If so, then cool ^^.
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.
I was trying to figure that out - mostly I wanted to shut up the linter. I don't think (?) it's generating the right docs - it's generating the following:
### requestBids
**Parameters**
- `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
- `$0.bidsBackHandler`
- `$0.timeout`
- `$0.adUnits`
- `$0.adUnitCodes`
- `bidsBackHandler`
- `timeout`
- `adUnits`
- `adUnitCodes`
I don't know if that is the right doc structure b/c I don't understand what this way of referring to arguments means:
requestBids = function ({ bidsBackHandler, timeout, adUnits, adUnitCodes } = {})
Does it mean that:
- This defaults to an empty object?
- That providing the object with the right keys as input is optional? Because it doesn't seem optional. (?)
- Something else?
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.
I tested a bit... I think what you want is to swap the property
tags here with param
. That makes more reasonable docs (screenshotted below)
See also: http://usejsdoc.org/tags-param.html#parameters-with-properties
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.
Ah, makes sense after reading the doc. OK, just switched back to param
.
After changing back to param
, documentation lint
still throwing one warning, but the message reads like its parser just isn't smart enough to understand the code/JSDoc, not like there is an actual problem, so it seems like we can safely ignore it:
warning An explicit parameter named defaults was specified but didn't match inferred information $0
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.
oh that's super annoying...
That sounds like an error meant to prevent mismatched names, like this:
/**
* @param e ...
*/
function handleError(error) { ... }
I looked around a bit, and found this: documentationjs/documentation#270
Sounds like $0
is just the placeholder value they assign because the fancy ES6 syntax doesn't actually give the param a name.
src/prebid.js
Outdated
* @param timeout | ||
* @param adUnits | ||
* @param adUnitCodes | ||
* @param {Object} defaults |
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.
should we call this something else? Like requestOptions
or something?
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.
Good point - changed to requestOptions
.
@@ -473,9 +473,9 @@ $$PREBID_GLOBAL$$.onEvent = function (event, handler, id) { | |||
}; | |||
|
|||
/** | |||
* @param {String} event the name of the event | |||
* @param {string} event the name of the event |
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.
so confused with the lowercase string and uppercase Object
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.
I know! The change is based on the output of documentation lint
, and also in the Google Closure Compiler JSDoc guidelines FWIW.
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.
that's why linters exist in the first place :).
Sometimes it's for consistency. Sometimes it's because your code is subtly incorrect.
My guess is that they were expecting to support Classes in the newer versions of JS, and the general principle was "primitives are lowercase. Classes are uppercase." Just speculation though.
* Fix `documentation lint` issues * Switch JSDoc tags from `property` to `param` * Call param `requestOptions` based on feedback
* Fix `documentation lint` issues * Switch JSDoc tags from `property` to `param` * Call param `requestOptions` based on feedback
* tag '0.28.0' of https://github.com/prebid/Prebid.js: (27 commits) Prebid 0.28.0 Release Revert "Upgrade sinon to 3.x (prebid#1491)" (prebid#1563) add () for correct order of operations in scaling increments for currency (prebid#1559) AppnexusAst adapter update: Added source and version to request payload (prebid#1555) remove unnecessary spread operator (prebid#1561) Adxcg adapter (prebid#1554) Upgrade sinon to 3.x (prebid#1491) Rename vastPayload to vastXml (prebid#1556) Single-size sizes array now can be taken, too (prebid#1535) Updated the istanbul-instrumenter-loader (prebid#1550) Add AerServ Adapter (prebid#1538) Fixed imports and made adform support aliasing (prebid#1518) Custom granularity fix (prebid#1546) Fix `documentation lint` issues (prebid#1544) Yieldbot adunit bidder params slot name usage fix (prebid#1394) Update serverbid adapter to use smartsync (prebid#1324) Add improvedigitalBidAdapter (prebid#1381) Fix prebid#1533 spring server typo (prebid#1542) userSync is off by default (prebid#1543) currency module (prebid#1374) ...
* Fix `documentation lint` issues * Switch JSDoc tags from `property` to `param` * Call param `requestOptions` based on feedback
….28.0 to aolgithub-master * commit '4d9ade3df767750743f8888ed9efd6c77f8d0050': (26 commits) Added changelog entry. Added new aol partners ids. Prebid 0.28.0 Release Revert "Upgrade sinon to 3.x (prebid#1491)" (prebid#1563) add () for correct order of operations in scaling increments for currency (prebid#1559) AppnexusAst adapter update: Added source and version to request payload (prebid#1555) remove unnecessary spread operator (prebid#1561) Adxcg adapter (prebid#1554) Upgrade sinon to 3.x (prebid#1491) Rename vastPayload to vastXml (prebid#1556) Single-size sizes array now can be taken, too (prebid#1535) Updated the istanbul-instrumenter-loader (prebid#1550) Add AerServ Adapter (prebid#1538) Fixed imports and made adform support aliasing (prebid#1518) Custom granularity fix (prebid#1546) Fix `documentation lint` issues (prebid#1544) Yieldbot adunit bidder params slot name usage fix (prebid#1394) Update serverbid adapter to use smartsync (prebid#1324) Add improvedigitalBidAdapter (prebid#1381) Fix prebid#1533 spring server typo (prebid#1542) ...
* Fix `documentation lint` issues * Switch JSDoc tags from `property` to `param` * Call param `requestOptions` based on feedback
Type of change
Description of change
Modify
prebid.js
to address issues found by running thedocumentation lint
command.In particular I needed to change the variable name from
cmd
tocommand
in the function starting on this line in order to address the fact that usingcmd
as the variable name and as the array on the global object was confusing JSDoc.https://github.com/prebid/Prebid.js/compare/fix-documentation-lint-issues?expand=1#diff-f8e049a1b6d4f9aa96fca41d2f7aa11dR781
I ran
gulp test
and everything passed, but I wanted to call that out just in case.Other information
Next baby step towards #1408