Skip to content

Bug: Support Zod v4 in eslint-plugin-react-hooks #34701

@RampantDespair

Description

@RampantDespair

React version:
N/A (ESLint issue)

Steps To Reproduce

  1. Install eslint@9.36.0 with eslint-plugin-react-hooks@6.1.0 in a project that also uses zod@4.x.
  2. Run ESLint on any file.
  3. Observe the crash.

Link to code example:

Minimal reproduction:

npm init -y
npm i -D eslint@9.36.0 eslint-plugin-react-hooks@6.1.0 zod@4
npx eslint --init
npx eslint index.js

The current behavior

ESLint crashes with:

TypeError: zod.z.function(...).args is not a function
    at eslint-plugin-react-hooks.development.js:32075:57

This happens because eslint-plugin-react-hooks is written against Zod v3, where z.function(...).args(...) exists. In Zod v4, that API changed, so the plugin immediately fails when loaded.

The expected behavior

eslint-plugin-react-hooks should work with Zod v4, or at least specify a peer dependency constraint to prevent incompatible installs. Ideally the schema validation should be updated to use Zod v4’s function API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions