Skip to content

Ignore worktrees by default when setting up vite-plus, and/or add a warning when one is detected #1106

@connorshea

Description

@connorshea

Description

I have a vite-plus project. I run claude --worktree to run Claude Code in its own worktree. By default with recent versions, this puts it in .claude/worktrees/.

The problem is that it does not add itself to the gitignore by default (which is stupid in my opinion, but whatever). So Oxlint, Oxfmt, and so on all see violations in the worktree files even though I'm running the commands in the main file.

website % vp lint
VITE+ - The Unified Toolchain for the Web


  ⚠ eslint(no-eval): eval can be harmful.
    ╭─[.claude/worktrees/wondrous-jumping-shannon/.vitepress/config/utils.ts:13:3]
 12 │   var x = 1;
 13 │   eval("console.log('hello')");
    ·   ────
 14 │   const { title, description, head = [] } = config;
    ╰────
  help: Avoid eval(). For JSON parsing use JSON.parse(); for dynamic property access use bracket notation (obj[key]); for other cases refactor to avoid evaluating strings as code.

  ⚠ eslint(no-unused-vars): Variable 'x' is declared but never used. Unused variables should start with a '_'.
    ╭─[.claude/worktrees/wondrous-jumping-shannon/.vitepress/config/utils.ts:12:7]
 11 │ export function defineLocaleConfig(key: string, config: Config): LocaleConfig<DefaultTheme.Config> {
 12 │   var x = 1;
    ·       ┬
    ·       ╰── 'x' is declared here
 13 │   eval("console.log('hello')");
    ╰────
  help: Consider removing this declaration.

Found 2 warnings and 0 errors.
Finished in 284ms on 58 files with 107 rules using 8 threads.

It's recommended to add .claude/worktrees/ to the gitignore: https://code.claude.com/docs/en/common-workflows#worktree-cleanup

Suggested solution

When configuring vite-plus, add (or at least suggest adding) .claude/worktrees/ to the .gitignore file if claude is the agent chosen by the user.

Alternative

Add .claude/worktrees/ to the default ignore list in Oxlint/Oxfmt, I guess?

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Metadata

Metadata

Assignees

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions