Skip to content

docs: fix @returns annotation in fs/read-file-list - #15900

Draft
Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-ngge4u
Draft

Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-ngge4u

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • fixes the JSDoc @returns annotation of the synchronous export of @stdlib/fs/read-file-list. readFileListSync returns an error object when a file read fails, but the annotation declared only ObjectArray. The annotation now reads (ObjectArray|Error), consistent with the package's TypeScript declaration (Array<File> | Error), REPL text, and README. Among @stdlib/fs sync exports which return an error object on failure, 11 of 12 (92%) already include Error in the @returns type.

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Identified by a cross-package consistency check over the 16 packages in @stdlib/fs. Documentation-only change; no change in behavior or test expectations.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code, which ran an automated cross-package API drift analysis over @stdlib/fs and applied the resulting documentation fix.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01KahG1EgmN7tCZG6qiYMmTG


Generated by Claude Code

The synchronous export returns an error object when a file read fails. Updated the JSDoc `@returns` type from `ObjectArray` to `(ObjectArray|Error)`, matching the TypeScript declaration, REPL text, and README. The `@returns` type of every other error-returning sync export in `@stdlib/fs` (11 of 12, 92%) already includes `Error`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KahG1EgmN7tCZG6qiYMmTG
@stdlib-bot

stdlib-bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
fs/read-file-list $\\color{green}480/480$
$\\color{green}+100.00\\%$
$\\color{green}46/46$
$\\color{green}+100.00\\%$
$\\color{green}8/8$
$\\color{green}+100.00\\%$
$\\color{green}480/480$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

Replaces `new Array( len )` with an array literal and `push`, resolving the `stdlib/no-new-array` lint error reported for this file. Files are read sequentially, so the output order is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KahG1EgmN7tCZG6qiYMmTG

Copy link
Copy Markdown
Member Author

CI status on this PR:

  • Lint Changed Files: failed on an existing stdlib/no-new-array error in fs/read-file-list/lib/sync.js, which lint checks because this PR touches the file. Fixed in 97b5071 (array literal + push; output unchanged because the reads are sequential).
  • Run affected tests: fails in @stdlib/_tools/search/pkg-index/test/test.js (two returns expected value asserts at lines 130 and 165). This failure is not caused by this PR. It runs only because pkg-index depends on fs/read-file-list. The test proxyquires ./../lib/index.js to stub @stdlib/_tools/pkgs/readmes and @stdlib/fs/read-file-list, but lib/main.js is the module that requires them, so the stubs never take effect. The function then runs against the real fixture directory and calls back with null. No fix exists yet. Proposed patch (separate PR, not included here):
-	pkgIndex = proxyquire( './../lib/index.js', {
+	pkgIndex = proxyquire( './../lib/main.js', {

applied to both error-path tests in _tools/search/pkg-index/test/test.js.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants