Skip to content

docs(context-storage): fix broken example in JSDoc#5039

Open
patrickwehbe wants to merge 1 commit into
honojs:mainfrom
patrickwehbe:fix-context-storage-example
Open

docs(context-storage): fix broken example in JSDoc#5039
patrickwehbe wants to merge 1 commit into
honojs:mainfrom
patrickwehbe:fix-context-storage-example

Conversation

@patrickwehbe

Copy link
Copy Markdown

The JSDoc @example for contextStorage does not compile or run as written.

Two problems in the snippet:

  • c.set('message', 'Hono is hot!!) has an unterminated string literal (missing the closing quote).
  • app.get('/', async (c) => { c.text(getMessage()) }) builds the response but never returns it, so the route would respond with a 404 instead of the text.

This is the example that shows up in editor tooltips and on the docs page for the middleware. Closed the string and added the missing return so the example is valid and does what the surrounding text describes. No code or runtime behavior changes, only the doc comment.

The @example for contextStorage had an unterminated string literal
('Hono is hot!!) and a handler that never returned its response, so the
snippet does not compile or behave as documented. Close the string and
return c.text() so the example is valid.
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.09%. Comparing base (97c6fe1) to head (218e2ad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5039   +/-   ##
=======================================
  Coverage   79.09%   79.09%           
=======================================
  Files         154      154           
  Lines       10727    10727           
  Branches     2238     2238           
=======================================
  Hits         8484     8484           
  Misses       2243     2243           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* })
*
* app.get('/', async (c) => { c.text(getMessage()) })
* app.get('/', async (c) => { return c.text(getMessage()) })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nitpick. But how about writing this?

app.get('/', async (c) => c.text(getMessage()))

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.

2 participants