Closed davidtheclark closed 4 years ago
I noticed that the options
object param was being labeled as optional (not required) because they had default parameters: (options = {})
. In every case, the options
object is actually required, so I removed the default parameter in https://github.com/mapbox/cloudfriend/pull/97/commits/a534c12a83f27709c8cadf12198b75caf25e5f77.
... And this broke tests. I'll think a little.
The conventional input validation approach in these functions takes that default parameter for granted. And it looks like the hope in documentation.js is that you can use the standard JSDoc @name
tag — which we could do, but that turns off all inference so we'd also have to manually add @augments
tags, instead of letting documentation.js pick up on the extends
keyword. So, a few options:
@name
to every JSDoc comment and @augments
to a bunch.options
exists at all and throw a clear error if not (e.g. if (!options) throw new Error('Options are required')
, and change tests to account for that new validation.I think that unless someone is enthusiastic about (3), I'm in favor of (2), and will give that a shot.
@mapbox/copyeditor
to help with that: fixes all the warnings it gives now and adds a documentation-building-and-copyediting step to thepretest
script.#parameters
so they point to the shortcut's top-level heading. Because that heading is the shortcut's name, it will not be duplicative, so we won't break links as we add more shortcuts. This also makes the link more predictable, which will be helpful if we try to transform those link destinations when putting these docs in order contexts.@rclark for review, please.