Skip to content

[bug]: oxlint pre-commit hook fails on all JSX files — missing react-in-jsx-scope: off #8681

@darkingtail

Description

@darkingtail

Is there an existing issue for this?

No.

  • I have searched the existing issues

Current behavior

After PR #8677 (replace eslint with oxlint), any commit that touches a JSX/TSX file fails the pre-commit hook:

✖ pnpm exec oxlint --fix --deny-warnings:

  ! eslint-plugin-react(react-in-jsx-scope): `React` must be in scope when using JSX.

This blocks all local development commits on JSX files.

Expected behavior

Commits should succeed. React 17+ uses the automatic JSX runtime, so import React is not required and the react-in-jsx-scope rule should be disabled.

Root cause

.oxlintrc.json enables the react plugin with correctness: warn, which activates react-in-jsx-scope. The lint-staged config runs oxlint --fix --deny-warnings, promoting all warnings to errors.

The previous ESLint config had react/react-in-jsx-scope: off, but this was not carried over to .oxlintrc.json.

Steps to reproduce

  1. Fresh clone, pnpm install
  2. Edit any .tsx file containing JSX
  3. git commit → pre-commit hook fails

Minimal reproduction:

pnpm exec oxlint --fix --deny-warnings apps/web/app/root.tsx
# exits 1 with react-in-jsx-scope warning

Suggested fix

Add to .oxlintrc.json rules:

"react/react-in-jsx-scope": "off"

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions