Skip to content

Conversation

@colinhacks
Copy link
Owner

@colinhacks colinhacks commented Apr 8, 2025

Announcement post: v4.zod.dev/v4
Release notes / breaking changes: v4.zod.dev/v4/changelog

Summary by CodeRabbit

  • New Features

    • Launched a modern documentation site with comprehensive guides, API references, error handling, and migration resources for Zod 4.
    • Added extensive benchmarking tools and scripts comparing Zod versions and alternative validation libraries.
    • Implemented new configuration files for workspace, formatting, linting, and editor support.
    • Introduced new schema methods and validation features, including template literals, advanced string formats, and improved error customization.
    • Added rich ecosystem resource listings with live GitHub star counts and support indicators.
    • Provided new React components for documentation layout, sidebar, headings, featured sponsors, and navigation enhancements.
    • Enhanced CI/CD workflows with updated branch triggers and package manager usage.
  • Bug Fixes

    • Updated workflow triggers and package manager commands to ensure compatibility with the latest tooling and branch naming conventions.
  • Documentation

    • Replaced legacy documentation with new, structured content covering usage, migration, metadata, ecosystem, and library author guidance.
    • Added detailed API documentation and migration guides for Zod 4, with improved navigation and metadata.
    • Introduced new error formatting and customization documentation.
    • Added comprehensive docs on JSON Schema conversion, metadata registries, and parsing strategies.
  • Chores

    • Migrated the project to a pnpm monorepo structure with workspace and package management enhancements.
    • Removed deprecated configuration files, test suites, and legacy documentation.
    • Updated copyright and license information.
    • Switched package manager from Yarn to pnpm across CI and development scripts.
  • Refactor

    • Transitioned from legacy tools (Jest, Babel, ESLint, Prettier) to Biome, Vitest, and pnpm.
    • Streamlined and modernized build, test, and linting scripts.
    • Removed or replaced outdated or redundant files and scripts.
    • Simplified internal module exports and reorganized source structure.
  • Style

    • Introduced new formatting and linting standards across the codebase.
  • Tests

    • Removed legacy test suites and introduced new benchmarking and validation tests for current and future development.

@netlify
Copy link

netlify bot commented Apr 8, 2025

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit 4a25968
🔍 Latest deploy log https://app.netlify.com/projects/guileless-rolypoly-866f8a/deploys/682b2b258a0a780008a84225
😎 Deploy Preview https://deploy-preview-4074--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 8, 2025

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • README.md

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a new monorepo structure using pnpm workspaces, modernizes the build and test pipelines, and adds a comprehensive documentation system for the Zod library. Legacy files, Deno support, and older configurations are removed. Extensive new benchmarking, documentation content, and utility scripts are added, with a focus on Zod v4 and improved developer experience.

Changes

Files/Paths Change Summary
.changeset/README.md, .changeset/config.json Added introductory and configuration files for Changesets versioning tool.
.configs/rollup.config.js, .configs/tsconfig.base.json Introduced Rollup and TypeScript base configuration files for building and compiling the project.
.dependency-cruiser.js, .eslintrc.js, .prettierrc.yaml, CHANGELOG.md, ERROR_HANDLING.md, MIGRATION.md, README_ZH.md, _redirects, index.html Deleted legacy configuration, documentation, and redirect files.
.devcontainer/devcontainer.json, .husky/pre-commit, .husky/pre-push Updated devcontainer and husky hooks to use pnpm and simplify pre-commit/push steps.
.gitignore Expanded ignored files and directories; removed .vscode, .eslintcache, and some legacy entries.
.github/pull_request_template.md, .github/workflows/release.yml, .github/workflows/test.yml, .github/workflows/release-canary.yml Updated PR instructions, switched CI from Yarn to pnpm, changed branch triggers, removed Deno steps, and commented out some publishing steps.
.npmrc, .nvmrc Added npm and Node version management settings for workspace linking and Node 22.
LICENSE Updated copyright year to 2025.
CONTRIBUTING.md Updated contribution instructions for pnpm and Vitest; expanded testing command documentation.
package.json Transformed to a pnpm monorepo config; removed single-package fields, added workspace, scripts, and new dev dependencies.
jest.config.json, configs/*, deno/*, index.d.ts, rollup.config.js Removed legacy Jest, Babel, SWC, TypeScript, Rollup, and Deno files.
packages/bench/*, packages/bench/package.json Added new benchmarking suite, utility scripts, and package config for comparing Zod versions and other libraries.
packages/docs/app/*, packages/docs/components/*, packages/docs/content/* Introduced a new documentation system with custom React components, layouts, dynamic OG image generation, and extensive API, migration, and usage docs for Zod v4.
README.md Major documentation update: added new API docs, clarified method behaviors, documented new features (e.g., .json(), .e164(), .file(), .unique(), template literals), and renamed types/methods for v4.
packages/docs/content/packages/v3.mdx Replaced legacy v3 docs with a brief note and updated ecosystem/integration links.
packages/docs/content/packages/mini.mdx, packages/docs/content/packages/core.mdx, packages/docs/content/packages/zod.mdx Added new docs for Zod Mini, Core, and main Zod v4 package, detailing API differences and extensibility.
packages/docs/content/api.mdx, basics.mdx, error-customization.mdx, error-formatting.mdx, json-schema.mdx, metadata.mdx, parsing.mdx, library-authors.mdx, v4/changelog.mdx Added comprehensive API, migration, error handling, JSON Schema, metadata, and authoring documentation for Zod v4.
packages/docs/content/meta.json Added documentation navigation metadata file.
packages/docs/README.md Added a minimal README with tabbed UI placeholder.
.vscode/launch.json, .vscode/settings.json Added VS Code debugging and editor settings for TypeScript and formatting.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Repo as Monorepo
    participant Docs as Docs System
    participant CI as CI/CD
    participant Bench as Benchmarks

    Dev->>Repo: Adds/updates code, docs, benchmarks
    Repo->>CI: Triggers on push/PR (pnpm, Vitest, Biome)
    CI->>Repo: Reports status (test, lint, build)
    Dev->>Docs: Writes/updates MDX docs, React components
    Dev->>Bench: Adds new benchmarks (Zod v3/v4, others)
    Bench->>Repo: Runs performance comparisons
    Docs->>Repo: Generates static docs (Next.js, MDX)
Loading

Poem

In the land of Zod, a fresh breeze blows,
Monorepo roots and pnpm flows.
Old configs gone, new docs arise,
Benchmarks sprint—performance-wise!
From v3 to v4, the future’s bright,
TypeScript-first, with schemas light.
Cheers to the code, and docs that gleam—
Zod marches on, the validation dream!

 🚀📚✨
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch v4
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel vercel bot temporarily deployed to Production April 8, 2025 18:19 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 18:24 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 18:47 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 20:19 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 20:30 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 20:46 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 21:27 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 21:53 Inactive
z.prettifyError(myError);
```

The returns the following pretty-printable multi-line string:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The returns the following pretty-printable multi-line string:
This returns the following pretty-printable multi-line string:

@vercel vercel bot temporarily deployed to Production April 8, 2025 22:22 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 23:15 Inactive
@vercel vercel bot temporarily deployed to Production April 8, 2025 23:28 Inactive
Copy link
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: 4

♻️ Duplicate comments (13)
packages/docs/content/packages/mini.mdx (2)

13-13: Simplify wording – drop “exact”
Per previous feedback, “exact same” can be trimmed to “same” for a snappier sentence.

- It implements the exact same functionality as `zod`, but using a *functional*, *tree-shakable* API.
+ It implements the same functionality as `zod`, but using a *functional*, *tree-shakable* API.
🧰 Tools
🪛 LanguageTool

[style] ~13-~13: ‘exact same’ might be wordy. Consider a shorter alternative.
Context: ...tall zod@^3.25.0 ``` It implements the exact same functionality as zod, but using a *fu...

(EN_WORDINESS_PREMIUM_EXACT_SAME)


68-68: Add missing comma after “Instead”
A quick comma after “Instead” will smooth the read.

- In `zod/v4-mini` such methods aren't implemented. Instead you pass these checks into schemas using the `.check()` method:
+ In `zod/v4-mini` such methods aren't implemented. Instead, you pass these checks into schemas using the `.check()` method:
🧰 Tools
🪛 LanguageTool

[uncategorized] ~68-~68: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...-mini` such methods aren't implemented. Instead you pass these checks into schemas usin...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

packages/docs/app/layout.tsx (2)

1-11: 🧹 Nitpick (assertive)

Group those imports for better readability!

You've got a mix of component imports, CSS imports, and utilities all jumbled together. Consider organizing them for clarity:

  1. External packages (@vercel/analytics/react, next/font/google, etc.)
  2. Global styles (./global.css)
  3. Local components (@/components/*)

This makes it way easier to scan the dependencies at a glance.

-import { InkeepBubble } from "@/components/inkeep-bubble";
-import InkeepSearchBox from "@/components/inkeep-search";
-
-import "./global.css";
-import Scroller from "@/components/scroller";
-import { Analytics } from "@vercel/analytics/react";
-import { Banner } from "fumadocs-ui/components/banner";
-import { RootProvider } from "fumadocs-ui/provider";
-import { Inter } from "next/font/google";
-import { type ReactNode, Suspense } from "react";
+import { Analytics } from "@vercel/analytics/react";
+import { Inter } from "next/font/google";
+import { type ReactNode, Suspense } from "react";
+import { RootProvider } from "fumadocs-ui/provider";
+
+import "./global.css";
+
+import { InkeepBubble } from "@/components/inkeep-bubble";
+import InkeepSearchBox from "@/components/inkeep-search";
+import Scroller from "@/components/scroller";
🧰 Tools
🪛 Biome (1.9.4)

[error] 7-7: This import is unused.

Unused imports might be the result of an incomplete refactoring.

(lint/correctness/noUnusedImports)


33-33: 🧹 Nitpick (assertive)

Drop the empty theme object.

That empty theme={{}} prop isn't doing anything. Unless you're planning to add theme values soon, you can safely remove it.

-          theme={{}}
packages/docs/app/(doc)/layout.tsx (2)

31-36: 🧹 Nitpick (assertive)

Consider hosting the Zod 3 logo locally.

Using a raw GitHub URL for the Zod 3 logo could break if the repo structure changes. For better reliability, save the logo locally in your public directory.

- <img
-   src="https://raw.githubusercontent.com/colinhacks/zod/3782fe29920c311984004c350b9fefaf0ae4c54a/logo.svg"
-   alt="Zod 3"
-   className="h-4"
- />
+ <img
+   src="/logo/logo-v3.svg" 
+   alt="Zod 3"
+   className="h-4"
+ />

48-59: 🧹 Nitpick (assertive)

Add aria-label to the GitHub icon link.

The SVG icon has a title, but adding an aria-label to the link itself would improve accessibility for screen readers.

    {
      type: "icon",
      url: "https://github.com/colinhacks/zod",
      text: "GitHub",
+     aria-label: "GitHub repository",
      icon: (
        <svg role="img" viewBox="0 0 24 24" fill="currentColor">
          <title>github logo</title>
          <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
        </svg>
      ),
      external: true,
    },
packages/docs/content/index.mdx (7)

6-7: 🧹 Nitpick (assertive)

Remove unused imports.

You're importing Accordion, Accordions, and Tabs components that aren't being used in this file. Let's clean that up!

-import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
-import { Tabs } from 'fumadocs-ui/components/tabs';

18-19: 🛠️ Refactor suggestion

Fix Tailwind important modifier syntax.

The Tailwind important modifier is in the wrong spot - it should be before the class name, not after it.

-    <img  className="block dark:hidden mx-auto my-0! h-full" alt="zod logo" src="/logo/logo-glow.png"  />
-    <img  className="hidden dark:block mx-auto my-0! h-full" alt="zod logo" src="/logo/logo-glow.png"  />
+    <img  className="block dark:hidden mx-auto !my-0 h-full" alt="zod logo" src="/logo/logo-glow.png"  />
+    <img  className="hidden dark:block mx-auto !my-0 h-full" alt="zod logo" src="/logo/logo-glow.png"  />

25-38: 🛠️ Refactor suggestion

Fix Tailwind important modifier in badge images.

Same issue with the Tailwind important modifiers across all these badge images - the ! should go before the class name.

-      <img className="h-[20px] m-0!" src="https://github.com/colinhacks/zod/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Zod CI status" />
+      <img className="h-[20px] !m-0" src="https://github.com/colinhacks/zod/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Zod CI status" />

(Apply similar fix to all other badge images)


52-53: 🧹 Nitpick (assertive)

Replace
with Tailwind spacing.

Using <br/> tags for spacing is a bit old-school. Tailwind's margin utilities would give you more consistent spacing control.

-<br/>
+<div className="my-8"></div>

54-64: 🧹 Nitpick (assertive)

Remove commented-out ParamField block.

This large commented-out block of example code isn't serving any purpose. If you're not planning to use it soon, best to remove it to keep the file clean.


66-70: 🧹 Nitpick (assertive)

Remove or fix the commented-out announcement block.

If you're not planning to use this announcement, you should remove it. If you do plan to use it, the alt attribute on the anchor tag is invalid HTML - use aria-label or title instead.

-{/* <div className="mt-5 font-gray-100 mx-auto text-center pt-12">
-  <span className="">
-    Zod 4 is now stable! <a rel="noopener noreferrer" href="/v4" alt="zod 4 release notes">Click here</a> to read the release notes.
-  </span>
-</div> */}

72-72: 🧹 Nitpick (assertive)

Replace triple
with margin.

These consecutive line breaks should be replaced with a proper margin utility class for better maintainability.

-<br /><br /><br />
+<div className="my-16"></div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 6f3b518 and 1f2dcda.

📒 Files selected for processing (4)
  • packages/docs/app/(doc)/layout.tsx (1 hunks)
  • packages/docs/app/layout.tsx (1 hunks)
  • packages/docs/content/index.mdx (1 hunks)
  • packages/docs/content/packages/mini.mdx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/docs/app/layout.tsx (3)
packages/docs/components/inkeep-bubble.tsx (1)
  • InkeepBubble (6-58)
packages/docs/components/inkeep-search.tsx (1)
  • InkeepSearchBox (7-46)
packages/docs/components/scroller.tsx (1)
  • Scroller (7-32)
🪛 Biome (1.9.4)
packages/docs/app/layout.tsx

[error] 7-7: This import is unused.

Unused imports might be the result of an incomplete refactoring.

(lint/correctness/noUnusedImports)

🪛 LanguageTool
packages/docs/content/index.mdx

[uncategorized] ~141-~141: Possible missing comma found.
Context: ...v5.5* and later. Older versions may work but are not officially supported. You must...

(AI_HYDRA_LEO_MISSING_COMMA)

packages/docs/content/packages/mini.mdx

[style] ~13-~13: ‘exact same’ might be wordy. Consider a shorter alternative.
Context: ...tall zod@^3.25.0 ``` It implements the exact same functionality as zod, but using a *fu...

(EN_WORDINESS_PREMIUM_EXACT_SAME)


[uncategorized] ~68-~68: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...-mini` such methods aren't implemented. Instead you pass these checks into schemas usin...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

🔇 Additional comments (5)
packages/docs/app/layout.tsx (2)

20-25: LGTM - good call commenting out the banner.

The banner would be redundant once Zod 4 is stable and widely used. Commenting it out keeps the code clean while preserving it for reference.


37-39: Good use of Suspense for the Scroller!

Wrapping the Scroller component in Suspense with a null fallback is a smart approach - it prevents layout shifts during loading.

packages/docs/app/(doc)/layout.tsx (1)

12-39: Nice sidebar configuration!

The sidebar setup with configurable components, tabs for different Zod versions, and proper navigation is well-structured. Good job disabling collapsibility for a cleaner UI.

packages/docs/content/index.mdx (2)

86-101: Great code example!

This is a nice, clean example that quickly demonstrates how to use Zod for validation. The import path zod/v4 clearly indicates this is for the new version.


119-135: Comprehensive installation instructions!

Nice job covering all the major package managers (npm, deno, yarn, bun, pnpm) for both stable and canary versions. This makes it easy for users regardless of their preferred tools.

Comment on lines +9 to +11
```sh
npm install zod@^3.25.0
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix installation instructions for Zod 4 mini
The “Try it” snippet is pointing people to v3 (^3.25.0), but the mini variant lives in Zod 4. Let’s bump this so folks actually get the v4 package.

- npm install zod@^3.25.0
+ npm install zod@^4.0.0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```sh
npm install zod@^3.25.0
```
🤖 Prompt for AI Agents
In packages/docs/content/packages/mini.mdx around lines 9 to 11, the
installation command for Zod is incorrectly set to version 3 (^3.25.0). Update
the npm install command to specify a version from Zod 4 to ensure users install
the correct mini variant. Replace the version number with an appropriate Zod 4
version, such as ^4.x.x.

import "./global.css";
import Scroller from "@/components/scroller";
import { Analytics } from "@vercel/analytics/react";
import { Banner } from "fumadocs-ui/components/banner";
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove the unused Banner import.

The Banner component is imported but commented out in the actual layout. Let's keep things tidy!

-import { Banner } from "fumadocs-ui/components/banner";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Banner } from "fumadocs-ui/components/banner";
-import { Banner } from "fumadocs-ui/components/banner";
🧰 Tools
🪛 Biome (1.9.4)

[error] 7-7: This import is unused.

Unused imports might be the result of an incomplete refactoring.

(lint/correctness/noUnusedImports)

🤖 Prompt for AI Agents
In packages/docs/app/layout.tsx at line 7, the Banner component is imported but
not used in the code since it is commented out. Remove the import statement for
Banner to clean up unused imports and keep the code tidy.

};
export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout {...layoutProps} containerProps={{}}>
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Is the empty containerProps necessary?

You're passing containerProps={{}} to DocsLayout, but if you're not customizing container properties, you could omit this prop entirely.

-    <DocsLayout {...layoutProps} containerProps={{}}>
+    <DocsLayout {...layoutProps}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<DocsLayout {...layoutProps} containerProps={{}}>
<DocsLayout {...layoutProps}>
🤖 Prompt for AI Agents
In packages/docs/app/(doc)/layout.tsx at line 64, the prop containerProps is
being passed as an empty object to DocsLayout. Since no container properties are
being customized, remove the containerProps={{}} prop entirely from the
DocsLayout component to clean up the code.


## Requirements

Zod is tested against *TypeScript v5.5* and later. Older versions may work but are not officially supported.
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add comma in requirements section.

There should be a comma after "Older versions may work" for better readability.

-Zod is tested against *TypeScript v5.5* and later. Older versions may work but are not officially supported.
+Zod is tested against *TypeScript v5.5* and later. Older versions may work, but are not officially supported.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~141-~141: Possible missing comma found.
Context: ...v5.5* and later. Older versions may work but are not officially supported. You must...

(AI_HYDRA_LEO_MISSING_COMMA)

🤖 Prompt for AI Agents
In packages/docs/content/index.mdx at line 141, add a comma after "Older
versions may work" in the sentence to improve readability. The corrected
sentence should read: "Older versions may work, but are not officially
supported."

Copy link
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: 1

♻️ Duplicate comments (3)
packages/docs/app/(doc)/layout.tsx (3)

31-36: 🧹 Nitpick (assertive)

Consider hosting the Zod 3 logo locally instead of using an external URL.

Hey there! Loading the Zod 3 logo from a GitHub raw URL could break if the repo structure changes or if GitHub changes how they serve raw content. It'd be safer to save this logo in your local public directory:

- <img
-   src="https://raw.githubusercontent.com/colinhacks/zod/3782fe29920c311984004c350b9fefaf0ae4c54a/logo.svg"
-   alt="Zod 3"
-   className="h-6"
- />
+ <img
+   src="/logo/logo-v3.svg" 
+   alt="Zod 3"
+   className="h-6"
+ />

This would make your docs more resilient and load faster too!


48-59: 🛠️ Refactor suggestion

Enhance accessibility for the GitHub icon link.

The SVG has a <title> tag, but wrapping it in a link without an aria-label can be confusing for screen readers. Add an aria-label to make this link more accessible:

  {
    type: "icon",
    url: "https://github.com/colinhacks/zod",
    text: "GitHub",
+   aria-label: "GitHub repository",
    icon: (
      <svg role="img" viewBox="0 0 24 24" fill="currentColor">
        <title>github logo</title>
        <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
      </svg>
    ),
    external: true,
  },

64-64: 🧹 Nitpick (assertive)

Is the empty containerProps necessary?

Looks like you're passing containerProps={{}} to DocsLayout, but since it's empty, you could just remove it to clean up the code:

- <DocsLayout {...layoutProps} containerProps={{}}>
+ <DocsLayout {...layoutProps}>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1f2dcda and 75d40c7.

📒 Files selected for processing (1)
  • packages/docs/app/(doc)/layout.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/docs/app/(doc)/layout.tsx (3)
packages/docs/app/layout.config.tsx (1)
  • baseOptions (19-30)
packages/docs/loaders/source.ts (1)
  • source (8-19)
packages/docs/components/sidebar-item.tsx (2)
  • SidebarItem (16-42)
  • SidebarSeparator (44-58)
🔇 Additional comments (1)
packages/docs/app/(doc)/layout.tsx (1)

1-68: Nice work on the docs layout structure!

The overall structure of the layout looks good! You've set up a clean navigation system with tabs for different Zod versions, added GitHub links, and configured the sidebar properly. The use of custom sidebar components will help maintain consistent styling throughout the docs.

title: "Zod 4",
description: "The latest version of Zod",
url: "/",
icon: <img src="/logo/logo.png" alt="Zod 4" className="h-5" />,
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Make logo heights consistent between tabs.

The Zod 4 logo uses className="h-5" while the Zod 3 logo uses className="h-6". This might make the tabs look unbalanced. Consider using the same height value for both logos for visual consistency.

- <img src="/logo/logo.png" alt="Zod 4" className="h-5" />
+ <img src="/logo/logo.png" alt="Zod 4" className="h-6" />

Also applies to: 34-34

🤖 Prompt for AI Agents
In packages/docs/app/(doc)/layout.tsx at lines 24 and 34, the logo images have
inconsistent height classes: one uses "h-5" and the other "h-6". To fix this,
update both logo img elements to use the same className height value, either
"h-5" or "h-6", ensuring visual consistency between tabs.

Copy link
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

♻️ Duplicate comments (3)
packages/docs/app/layout.tsx (3)

1-11: Let's organize these imports for better readability.

The imports could be grouped more logically to make it easier to scan:

  1. External packages (@vercel/analytics/react, next/font/google)
  2. Global CSS (./global.css)
  3. Local components (@/components/*, fumadocs-ui/*)
+import { Analytics } from "@vercel/analytics/react";
+import { Inter } from "next/font/google";
+import { type ReactNode, Suspense } from "react";
+
+import "./global.css";
+
+// import { Banner } from "fumadocs-ui/components/banner";
+import { RootProvider } from "fumadocs-ui/provider";
 import { InkeepBubble } from "@/components/inkeep-bubble";
 import InkeepSearchBox from "@/components/inkeep-search";
-
-import "./global.css";
 import Scroller from "@/components/scroller";
-import { Analytics } from "@vercel/analytics/react";
-// import { Banner } from "fumadocs-ui/components/banner";
-import { RootProvider } from "fumadocs-ui/provider";
-import { Inter } from "next/font/google";
-import { type ReactNode, Suspense } from "react";

7-7: Drop the unused Banner import.

The Banner component is imported but commented out in the JSX. Since it's not being used, we should remove the import entirely.

-// import { Banner } from "fumadocs-ui/components/banner";

33-33: That empty theme object isn't doing anything.

The empty theme prop isn't adding any value here. You can safely remove it unless you're planning to add theme values later.

-          theme={{}}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 663dc81 and 961e2b4.

📒 Files selected for processing (1)
  • packages/docs/app/layout.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/docs/app/layout.tsx (3)
packages/docs/components/inkeep-bubble.tsx (1)
  • InkeepBubble (6-58)
packages/docs/components/inkeep-search.tsx (1)
  • InkeepSearchBox (7-46)
packages/docs/components/scroller.tsx (1)
  • Scroller (7-32)
🔇 Additional comments (1)
packages/docs/app/layout.tsx (1)

18-41: Overall structure looks clean and well-organized.

The layout provides a solid foundation with proper HTML semantics, language attributes, and responsive structure. The integration of Inkeep for search and chat functionality is implemented correctly, and wrapping everything in the RootProvider ensures consistent theming and functionality.

Comment on lines +37 to +39
<Suspense fallback={null}>
<Scroller />
</Suspense>
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Nice use of Suspense for the Scroller.

Wrapping the Scroller component in Suspense with a null fallback is a good approach for async components. Looking at the Scroller component code snippet, you might want to clean up the console.dir statement in the handleScroll function before going to production.

🤖 Prompt for AI Agents
In packages/docs/app/layout.tsx around lines 37 to 39, the Suspense wrapper for
the Scroller component is correctly implemented, but the handleScroll function
inside the Scroller component contains a console.dir statement used for
debugging. Remove or comment out this console.dir statement to clean up the code
before production deployment.

Comment on lines +20 to +25
{/* <Banner id="zod4">
💎 Zod 4 is now stable! <span>&nbsp;</span>
<a className="underline" href="/v4">
Read the announcement.
</a>
</Banner> */}
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider whether you still need this Banner component.

The Banner is commented out - if you're keeping it for later, that's cool, but if you're done with it, you might want to remove it completely to keep things clean.

-        {/* <Banner id="zod4">
-          💎 Zod 4 is now stable! <span>&nbsp;</span>
-          <a className="underline" href="/v4">
-            Read the announcement.
-          </a>
-        </Banner> */}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* <Banner id="zod4">
💎 Zod 4 is now stable! <span>&nbsp;</span>
<a className="underline" href="/v4">
Read the announcement.
</a>
</Banner> */}
// (The commented-out Banner block has been removed)
🤖 Prompt for AI Agents
In packages/docs/app/layout.tsx around lines 20 to 25, the Banner component is
commented out. Decide if this Banner is still needed; if it is no longer
required, remove the commented-out code entirely to keep the file clean and
maintainable. If you plan to use it later, you can leave it as is.

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.