Skip to content

Claude Code often writes oxlint(/oxfmt) config to .oxlintrc.json(/.oxfmtrc.json) instead of vite.config.ts #1031

Closed as duplicate

Description

@naitokosuke

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure

Explain in Detail

When using Claude Code (v2.1.78) with the CLAUDE.md generated by vp create (with Claude Code integration selected), Claude Code attempts to write oxlint rule configuration to oxlint.json or .oxlintrc.json instead of vite.config.ts lint.rules.

This happens despite the generated CLAUDE.md explicitly stating that Vite+ wraps Oxlint and that tools should not be configured directly.

Environment

  • Vite+: monorepo setup via vp create
  • CLAUDE.md: auto-generated (unmodified) with Claude Code option
  • Claude Code: v2.1.78

Your Suggestion for Changes

I'm not sure if this would fully solve the issue, but it might help to mention in the generated CLAUDE.md that lint(format) configurations should be added to vite.config.ts rather than to standalone oxlint config files.

Relevant Page

No response

Reproduction (Optional)

No response

Steps to reproduce (Optional)

  1. Create a monorepo project with vp create, selecting Claude Code integration
  2. Ask Claude Code to enable an oxlint rule
  3. Claude Code creates .oxlintrc.json at project root instead of adding it to lint.rules in vite.config.ts

Activity

  1. connorshea commented on Mar 22, 2026

    @connorshea
    Contributor

    Could potentially add optional Claude Hooks hooks to block Claude from creating the oxfmt/oxlint-specific files?

  2. connorshea commented on Apr 5, 2026

    @connorshea
    Contributor

    I put together hooks for this, plus for blocking some commands that vp should be handling (npm install, etc.) :)

    https://gist.github.com/connorshea/f2a19e955bcc54e50b33afc7e598bf97

    For the config file blocking specifically, you can add these to the repo.

    .claude/hooks/enforce-vp-config.sh in a repo:

    #!/bin/bash
    # .claude/hooks/enforce-vp-config.sh
    # Block creation/editing of standalone oxlint/oxfmt config files.
    # NOTE: Make sure to mark this script as executable with `chmod +x`.
    INPUT=$(cat)
    FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
    
    BASENAME=$(basename "$FILE_PATH" 2>/dev/null)
    
    case "$BASENAME" in
      .oxlintrc.json|.oxlintrc.jsonc|oxlint.config.ts|.oxfmtrc.json|.oxfmtrc.jsonc|oxfmt.config.ts)
        jq -n '{
          hookSpecificOutput: {
            hookEventName: "PreToolUse",
            permissionDecision: "deny",
            permissionDecisionReason: "Do not create standalone oxlint/oxfmt config files. Configure linting and formatting in `vite.config.ts` instead."
          }
        }'
        exit 0
        ;;
    esac
    
    exit 0

    And .claude/settings.json to trigger it on writes/edits:

    {
      "$schema": "https://json.schemastore.org/claude-code-settings.json",
      "hooks": {
        "PreToolUse": [
          {
            "matcher": "Write|Edit",
            "hooks": [
              {
                "type": "command",
                "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/enforce-vp-config.sh",
                "timeout": 2
              }
            ]
          }
        ]
      }
    }

    I think we could use the if syntax in settings.json to filter this down a bit more so it doesn't run unnecessarily as often, but it should be quite fast. It requires jq to be installed, but the Claude Code hooks docs use it a lot, so ¯_(ツ)_/¯

  3. naokihaba commented on May 12, 2026

    @naokihaba
    Collaborator

    As a future idea: Once the oxlint plugin (#1408) becomes available, it may be possible to automatically fix this misconfiguration, similar to the approach proposed for IDE configuration files in #1456.

    For example, a rule such as vite-plus/no-standalone-oxlint-config could detect standalone configuration files like .oxlintrc.json or oxfmt.config.ts. Then, using --fix, the configuration could be migrated into vite.config.ts and the original files deleted.

    In combination with improvements to CLAUDE.md, it would be possible to automatically correct instances where Claude Code accidentally creates these files by running vp check --fix.

  4. added this to the Beta milestone on May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions