docs(context-storage): fix broken example in JSDoc#5039
Open
patrickwehbe wants to merge 1 commit into
Open
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
yusukebe
reviewed
Jun 26, 2026
| * }) | ||
| * | ||
| * app.get('/', async (c) => { c.text(getMessage()) }) | ||
| * app.get('/', async (c) => { return c.text(getMessage()) }) |
Member
There was a problem hiding this comment.
It's a nitpick. But how about writing this?
app.get('/', async (c) => c.text(getMessage()))
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.
The JSDoc
@exampleforcontextStoragedoes 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
returnso the example is valid and does what the surrounding text describes. No code or runtime behavior changes, only the doc comment.