Skip to content

docs: improve jsdocs#4199

Open
RihanArfan wants to merge 3 commits intomainfrom
docs/jsdocs
Open

docs: improve jsdocs#4199
RihanArfan wants to merge 3 commits intomainfrom
docs/jsdocs

Conversation

@RihanArfan
Copy link
Copy Markdown
Member

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds additional jsdocs and links to docs pages.

Also corrects some old jsdocs @see links to point to new docs routes.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@RihanArfan RihanArfan requested a review from pi0 as a code owner April 10, 2026 16:27
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview, Comment Apr 10, 2026 4:40pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 29c89c81-63b4-421f-94eb-0980d4cd1c7a

📥 Commits

Reviewing files that changed from the base of the PR and between d427adc and 4b93503.

📒 Files selected for processing (1)
  • src/types/config.ts
✅ Files skipped from review due to trivial changes (1)
  • src/types/config.ts

📝 Walkthrough

Walkthrough

This PR expands JSDoc and type documentation across Nitro's type definition files, clarifying configuration, handler, module, and runtime types. One structural change: removal of an index signature from NitroMeta. All other edits are documentation-only additions and refinements to existing type declarations.

Changes

Cohort / File(s) Summary
Configuration & Route Types
src/types/config.ts, src/types/route-rules.ts, src/types/openapi.ts
Extensive JSDoc added/expanded for NitroOptions/config, route rule fields, and OpenAPI config (defaults, deprecations, semantics, cross-references). No runtime/type-signature changes.
Handler Types
src/types/handler.ts
Detailed JSDoc added to routing and handler types (NitroRouteMeta, EventHandlerFormat, NitroEventHandler, NitroDevEventHandler, NitroErrorHandler) with usage notes and examples. No signature changes.
Module Types
src/types/module.ts
JSDoc added for NitroModuleInput and NitroModule explaining accepted shapes and lifecycle/setup behavior.
Nitro Core & Runtime
src/types/nitro.ts, src/types/runtime/cache.ts, src/types/runtime/nitro.ts
Removed index signature from NitroMeta (now only version/majorVersion). Added JSDoc for Nitro instance, dynamic/build info, cached handler options, and runtime hooks. No other type changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: improve jsdocs' follows the conventional commits format with the 'docs' type prefix and provides a clear, specific description of the changes made.
Description check ✅ Passed The description clearly explains that the PR adds JSDoc documentation and corrects outdated links to documentation pages, which aligns with the changeset of documentation-only updates across multiple type definition files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/jsdocs
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch docs/jsdocs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/types/config.ts`:
- Line 455: Update the cron expression in the scheduledTasks example to the
correct syntax by replacing the invalid string "**​/5 * * * *" with "*/5 * * *
*" in the scheduledTasks documentation or example (search for the scheduledTasks
constant/type or the doc block containing that cron example in
src/types/config.ts and update the example string).

In `@src/types/nitro.ts`:
- Around line 18-21: The removal of the index signature from the NitroMeta
interface breaks assignability for consumers that add arbitrary keys; restore
backward compatibility by reintroducing the index signature (e.g., add [key:
string]: any to NitroMeta) or, if you intend this as a breaking change,
explicitly mark it in the changelog/release notes and add migration guidance
explaining how callers should migrate off storing extra keys; locate NitroMeta
in the src/types/nitro.ts file to apply one of these two remedies.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc91ea1a-75db-4cc9-9f60-37ac3fa50912

📥 Commits

Reviewing files that changed from the base of the PR and between 896186a and d427adc.

📒 Files selected for processing (8)
  • src/types/config.ts
  • src/types/handler.ts
  • src/types/module.ts
  • src/types/nitro.ts
  • src/types/openapi.ts
  • src/types/route-rules.ts
  • src/types/runtime/cache.ts
  • src/types/runtime/nitro.ts

export type { CacheEntry, CacheOptions, ResponseCacheEntry } from "ocache";

/**
* Options for `defineCachedEventHandler` and `defineCachedFunction`.
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.

Suggested change
* Options for `defineCachedEventHandler` and `defineCachedFunction`.
* Options for `defineCachedHandler` and `defineCachedFunction`.

* These are the normalized options after preset defaults and user config
* have been merged. For the user-facing input type, see {@link NitroConfig}.
*
* @see https://nitro.build/config
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 is an internal

Suggested change
* @see https://nitro.build/config

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4199

commit: d427adc

preset: PresetName;

/**
* Enable static site generation mode.
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 disables server build

/**
* Auto-import configuration.
*
* Set to `false` to disable auto-imports. Pass an object to customize.
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.

Default should be false in v3

/**
* Nitro modules to extend behavior during initialization.
*
* Accepts module path strings, {@link NitroModule} objects, or bare setup functions.
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.

Should check but iirc this option now is almost unused

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