Repository navigation
docs: fix JSDoc annotations - #15670
Merged
Merged
Conversation
Added the two `@throws {TypeError}` annotations for options validation
(`options argument must be an object`, `must provide valid options`), which
are present in 21 of the 23 namespace siblings having a `lib/validate.js`
(91%; 84% of all 25 members). `depList` propagates the errors returned by
`lib/validate.js` via `throw err`, and `test/test.js` already asserts both,
so the annotations were the only thing missing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014UdGBAZUyqVKsGZygrZaJk
Corrected two option types and added two missing `@throws` annotations:
- `options.dev` was annotated `{string}` while `lib/validate.js` checks
`isBoolean`, its own annotation reads `{boolean}`, and the default is
`false`; public option types agree with `lib/validate.js` in 22 of 23
siblings (96%; 88% of all 25 members).
- `options.level` was annotated `{number}` while `lib/validate.js` checks
`isPositiveInteger` and annotates it `{PositiveInteger}`.
- Added `@throws {TypeError} options argument must be an object` and
`@throws {TypeError} must provide valid options`, present in 21 of the
23 siblings having a `lib/validate.js` (91%; 84% of all members).
`namespaceDeps` propagates both via `throw err` and `test/test.js` and
`test/test.validate.js` already assert them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014UdGBAZUyqVKsGZygrZaJk
Bracketed the `options` parameter annotation. `pkgs` dispatches on `arguments.length`, treating a single argument as the callback, and both the README signature (`pkgs( [options], clbk )`) and `examples/index.js` call the function without options. The child options were already bracketed. 22 of the 23 namespace siblings taking an options argument bracket it (96%; 88% of all 25 members). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014UdGBAZUyqVKsGZygrZaJk
kgryte
marked this pull request as ready for review
September 30, 2026 06:06
kgryte
approved these changes
Sep 30, 2026
@stdlib/_tools/pkgs packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request corrects JSDoc annotations in three
@stdlib/_tools/pkgspackages whose public documentation disagrees with their own runtime behavior and with the documented conventions of their sibling packages. All changes are comment-only; no runtime code, signature, or test expectation is touched.The three packages were identified by extracting structural and semantic features from all 25 members of the
@stdlib/_tools/pkgsnamespace and flagging packages deviating from a pattern shared by at least 75% of members.Namespace summary
Members analyzed: 25 (all direct children of
lib/node_modules/@stdlib/_tools/pkgscontaining apackage.json; none are autogenerated).Features analyzed: 14 — file tree,
package.jsontop-level keys,scriptskeys,stdlibkeys,manifest.jsonkeys, README section set, README section order,test//benchmark//examples/filenames, public signature, validation prologue, error construction, JSDoc@param/@throws/@returnsshape,@examplepresence, andrequire()dependencies.Features with a clear majority (≥19/25): 9. Four of them had outliers:
@param {Options} [options]bracketed whenoptionsis optionalinstalled@throws {TypeError} options argument must be an objectlib/validate.jsdep-list,namespace-deps@throws {TypeError} must provide valid optionsdep-list,namespace-deps@paramtype agrees with the same package'slib/validate.jsnamespace-depsThe remaining five majority features (
package.jsonkey set,examples/filenames,@examplepresence,errorConstruction=format, emptyscripts) were fully conformant across all 25 members.Features without a clear majority, excluded from analysis: 5 — README
## Notessection presence (16/25, 64%), full README section order (16/25, 64%), presence oflib/sync.js(15/25, 60%),lib/async.js(15/25, 60%), andoptions.patternglob validation (15/25, 60%).@stdlib/_tools/pkgs/dep-listAdds
@throws {TypeError} options argument must be an objectand@throws {TypeError} must provide valid optionsto the public JSDoc ofdepList.depListpassesoptsandoptionstovalidateand re-throws the returned error;lib/validate.jsreturns aTypeErrorfor a non-objectoptionsargument and for an invaliddevormanifestoption, andtest/test.jsasserts both throw paths. The annotations match 21 of the 23 namespace siblings that have alib/validate.js(91%), or 84% of all 25 namespace members;dep-listwas one of two packages without them.@stdlib/_tools/pkgs/namespace-depsCorrects the JSDoc in
lib/main.jsto matchlib/validate.js. Theoptions.devtype changes from{string}to{boolean}, and theoptions.leveltype changes from{number}to{PositiveInteger}. Also adds@throws {TypeError}annotations foroptions argument must be an objectandmust provide valid options, whichnamespaceDepsre-throws fromvalidate()and whichtest/test.jsandtest/test.validate.jsalready assert. The@paramtypes now agree withlib/validate.jsin the same way as 22 of 23 sibling packages (96%), and the@throwsannotations match 21 of 23 siblings that have alib/validate.js(91%).@stdlib/_tools/pkgs/installedMarks the
optionsparameter ofpkgsas optional, changing@param {Options} optionsto@param {Options} [options].pkgsdispatches onarguments.lengthand treats a single argument as the callback, and the README documents the signature aspkgs( [options], clbk ). Both the README's first example andexamples/index.jscallpkgs( onPkgs ), and the child annotations ([options.dir],[options.depth],[options.dev=true]) were already bracketed.installedwas the only public outlier; 22 of 23 siblings taking an options argument bracket it (96%), or 88% of all members.Related Issues
No.
Questions
No.
Other
Total diff: 3 files, +7/−3 lines, all inside JSDoc comment blocks.
Validation
What was checked:
package.json/manifest.jsonkey sets, README heading sequences, andtest//benchmark//examples/filenames.require()dependencies), then re-derived directly from source. The per-package extraction initially mis-reported@parambracketing for several packages; every finding in this pull request was re-verified against the source text before being acted on, and the conformance counts above come from that re-derivation, not from the extraction pass.jsdoc-tag-orderordersparam<throws<returns, so the inserted@throwslines are correctly positioned;jsdoc-no-duplicate-tagsliststhrowsamong its exceptions, so multiple@throwstags are permitted;PositiveIntegeris in thejsdoc-typedef-typosallowlist.*.d.ts,docs/types/, ordocs/repl.txt, so no generated file now disagrees with the JSDoc.docs/usage.txtis CLI-only and untouched.node --checkpasses on all three modified files.node_modulesis not installed in the environment where these changes were prepared, so ESLint and thetapetest suites were not run locally; CI will be the first execution of either. The changes are confined to comment text, so no test expectation changes.What was deliberately excluded:
find— missingoptions.patternvalidation and its@throws {Error}annotation. 15 of the 16 packages exposing anoptions.patternoption reject a pattern not ending inpackage.json;finddoes not. Adding the check would change observable behavior, and adding only the annotation would document an error that is never thrown. Left for a maintainer to decide.installed— notest/directory (and correspondingly no"test"entry indirectories). Writing a test suite is out of scope, and adding thedirectoriesentry alone would point at a directory that does not exist.dep-list,installed,name2bucket,name2standalone,namespace-deps— nolib/sync.js. Adding a synchronous API changes the public API surface. The feature also lacks a clear majority (15/25, 60%).dep-list,namespace-deps— no### Notessection under## CLI. Present in 23/25 READMEs, but sibling content is package-specific prose, not mechanically derivable.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This pull request was written primarily by Claude Code. It ran an automated cross-package consistency audit over the
@stdlib/_tools/pkgsnamespace: feature extraction was partly performed by subagents, the resulting findings were re-derived from source and verified by three independent review passes, and the final edits, commit messages, and this description were authored by Claude Code. Reviewers should note in particular that the conformance percentages quoted above were computed programmatically from the working tree, and that ESLint and the test suites were not run locally (see Validation).@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_014UdGBAZUyqVKsGZygrZaJk
Generated by Claude Code