Skip to content

docs(remark-run-javascript-examples): correct jsdoc example#12245

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-remark-jsdoc-2026-05-22
Draft

docs(remark-run-javascript-examples): correct jsdoc example#12245
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-remark-jsdoc-2026-05-22

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Resolves #12236.

Description

What is the purpose of this pull request?

This pull request:

  • Removes a spurious <section class="usage"> block from the @example JSDoc tag in remark-run-javascript-examples/lib/index.js that caused stdlib/jsdoc-main-export to fire a false positive by placing a require( "path" ) string literal after the main export's actual require() call.
  • Removes the // => 'HELLO WORLD' return-value annotation from the same example, which caused stdlib/jsdoc-doctest to assert the processor call returns a string rather than the remark processor object.

Related Issues

Does this pull request have any related issues?

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request?

Failing CI: workflow run 26260926243 (2026-05-22T00:33:27Z, branch develop).

Error 1 — stdlib/jsdoc-main-export

Symptom: "Example code of main export should require itself last."

Root cause: The str array in the example contained the string literal 'var path = require( "path" );'. The lint rule locates the main export's require() by calling lastIndexOf('require(') on the raw tag description. That substring appeared inside the string literal at a higher offset than the actual require() call for the main export, so match.index !== lastIndexOf('require(') evaluated to true and the rule erroneously flagged the file.

Fix: Removed the 14-line <section class="usage"> block containing the offending string literal.

Error 2 — stdlib/jsdoc-doctest

Symptom: "Displayed return value is 'HELLO WORLD', but expected function processor() {...}."

Root cause: The // => 'HELLO WORLD' annotation asserted that remark().use(run).process() returns the string 'HELLO WORLD'. The call actually returns the remark processor object.

Fix: Removed the // => 'HELLO WORLD' line.

Validation: Three independent review agents (two opus, one sonnet) approved the diff or returned non-blocking findings only.

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 PR was authored by Claude Code as part of an automated CI-fix routine. The fix was validated by three independent review agents (two opus, one sonnet) before committing.


@stdlib-js/reviewers


Generated by Claude Code

The lint workflow (run 26260926243, 2026-05-22) failed on develop with
two errors in the `@example` block of `index.js`.

`stdlib/jsdoc-main-export` fired because the `str` array contained the
string literal `'var path = require( "path" );'`, placing a `require(`
substring in the description text after the main export's actual
`require()` call. The rule scans with `lastIndexOf('require(')` on the
raw description, so it treated the string literal as a trailing require
and concluded the main export was not last.

`stdlib/jsdoc-doctest` fired because the `// => 'HELLO WORLD'` comment
annotated `remark().use(run).process()` as returning the string
`'HELLO WORLD'`; the actual return value is the remark processor object.

Remove the usage-section lines (eliminating the offending string
literal) and drop the incorrect annotation. The example still
demonstrates the plugin's core behaviour: processing markdown that
contains a JavaScript examples section.

Ref: https://github.com/stdlib-js/stdlib/actions/runs/26260926243
@stdlib-bot stdlib-bot added Tools Issue or pull request related to project tooling. Good First PR A pull request resolving a Good First Issue. labels May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix JavaScript lint errors

3 participants