chore: fix JavaScript lint errors (issue #8483)#11011
Open
Sumithraju wants to merge 1 commit intostdlib-js:developfrom
Open
chore: fix JavaScript lint errors (issue #8483)#11011Sumithraju wants to merge 1 commit intostdlib-js:developfrom
Sumithraju wants to merge 1 commit intostdlib-js:developfrom
Conversation
Replace `out instanceof Error` with `isError( out )` using `@stdlib/assert/is-error` to comply with the `stdlib/doctest` linting rule. This matches the pattern used in similar packages like `@stdlib/fs/read-file`. Resolves stdlib-js#8483 Co-Authored-By: sumithraju <noreply@github.com>
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
7 tasks
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.
Summary
Replace
out instanceof ErrorwithisError( out )using@stdlib/assert/is-errorto comply with thestdlib/doctestlinting rule in the@stdlib/fs/read-direxamples file.Fixes #8483
Description
This pull request addresses a JavaScript linting error identified in issue #8483. The
stdlib/doctestrule reported a mismatch at line 33 ofexamples/index.js: "Displayed return value istrue, but expectedfalseinstead."The root cause is that
out instanceof Erroris not properly tracked by the doctest rule when the variable is reassigned. The fix replacesinstanceof Errorchecks with theisError()utility from@stdlib/assert/is-error, matching the established pattern used in similar packages like@stdlib/fs/read-file.Changes Made
lib/node_modules/@stdlib/fs/read-dir/examples/index.jsvar isError = require( '@stdlib/assert/is-error' );console.log( out instanceof Error )→console.log( isError( out ) )console.log( out instanceof Error )→console.log( isError( out ) )Related Issues
Resolves #8483
Type of Change
Testing
No functional changes required testing. The
isError()utility provides identical behavior toinstanceof Errorchecks. The doctest annotations (// => falseand// => true) remain correct.AI Assistance
AI Disclosure
"This PR was authored with AI assistance. AI analyzed the doctest linting violation, identified the root cause (instanceof operator not tracked by the doctest rule), found the established fix pattern from
@stdlib/fs/read-file, and implemented the replacement using@stdlib/assert/is-error. The proposed change maintains identical functionality and follows all contribution guidelines."Checklist