Skip to content

Enforce certain vite-plus imports via lint rules instead of Markdown files #1301

@connorshea

Description

@connorshea

Description

I noticed that the generated AGENTS.md/CLAUDE.md file includes this line:

- **Import JavaScript modules from `vite-plus`:** Instead of importing from `vite` or `vitest`, all modules should be imported from the project's `vite-plus` dependency. For example, `import { defineConfig } from 'vite-plus';` or `import { expect, test, vi } from 'vite-plus/test';`. You must not install `vitest` to import test utilities.

This is fine, but it would be better to enforce this properly - even better if it can get auto-fixed.

Suggested solution

We could add an oxc/vite-plus-imports lint rule in Oxlint to enforce and auto-fix these imports, potentially. And have it enabled by default as part of generating the vp config and/or running migrate.

It could alternatively be provided as a JS Plugin rule by vite-plus, if we don't want to ship it in Oxlint directly.

Alternative

Continue to rely on the AI agents to respect this and probably get it wrong sometimes/a lot of the time, especially while models haven't been trained on vite-plus yet.

Additional context

Right now this feels like an unnecessarily-painful papercut, because AI agents will continue to just use vitest or vite imports until, hopefully, they're re-trained on updated info, and a new gen of models is released in 6ish months. And human developers won't necessary know that this is a problem either until they run into issues because of it.

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