Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { test } from 'vitest';
test('application', () => {});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { defineConfig } from 'vite';
export default defineConfig({});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "lint-import-overrides", "private": true, "type": "module", "devDependencies": { "vite-plus": "latest" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[case]]
name = "lint_vite_plus_imports_overrides"
vp = "local"
comment = "Existing lint.overrides can disable only the import rule in templates and examples, with no migrate configuration. Other lint rules remain active."
steps = [
{ argv = ["vp", "lint", "--threads=1", "--fix", "app.test.ts", "templates/starter.test.ts", "examples/vite.config.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "app.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "templates/starter.test.ts"] },
{ argv = ["vpt", "print-file", "examples/vite.config.ts"] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# lint_vite_plus_imports_overrides

Existing lint.overrides can disable only the import rule in templates and examples, with no migrate configuration. Other lint rules remain active.

## `vp lint --threads=1 --fix app.test.ts templates/starter.test.ts examples/vite.config.ts`

**Exit code:** 1

```

× eslint(no-debugger): `debugger` statement is not allowed
╭─[templates/starter.test.ts:2:1]
1 │ import { test } from 'vitest';
2 │ debugger;
· ─────────
3 │ test('template', () => {});
╰────
help: Remove the debugger statement

Found 0 warnings and 1 error.
Finished in <duration> on 3 files with <n> rules using <n> threads.
```

## `vpt print-file app.test.ts`

```
import { test } from 'vite-plus/test';
test('application', () => {});
```

## `vpt print-file templates/starter.test.ts`

```
import { test } from 'vitest';
debugger;
test('template', () => {});
```

## `vpt print-file examples/vite.config.ts`

```
import { defineConfig } from 'vite';
export default defineConfig({});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from 'vitest';
debugger;
test('template', () => {});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'vite-plus';
export default defineConfig({
lint: {
jsPlugins: [{ name: 'vite-plus', specifier: 'vite-plus/oxlint-plugin' }],
rules: { 'vite-plus/prefer-vite-plus-imports': 'error', 'no-debugger': 'error' },
overrides: [
{
files: ['templates/**', 'examples/**'],
rules: { 'vite-plus/prefer-vite-plus-imports': 'off' },
},
],
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "standalone-template", "private": true, "type": "module", "devDependencies": { "vite": "^8.0.0", "vitest": "^4.1.11" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { expect, test } from 'vitest';
test('outside-workspace', () => expect(1).toBe(1));
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "migration-ignore-patterns",
"private": true,
"type": "module",
"devDependencies": { "vite-plus": "catalog:" },
"devEngines": { "packageManager": { "name": "pnpm", "version": "10.33.0", "onFail": "download" } }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "app", "private": true, "type": "module",
"scripts": { "build": "vite build", "test": "vitest run" },
"devDependencies": { "vite": "catalog:", "vitest": "catalog:legacy", "@vitest/coverage-v8": "catalog:legacy" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { expect, test } from 'vitest';
test('application', () => expect(1).toBe(1));
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { defineConfig } from 'vite';
export default defineConfig({});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
packages:
- packages/*
- templates/*
catalog:
vite-plus: latest
vite: ^8.0.0
catalogs:
legacy:
vitest: ^4.1.11
'@vitest/coverage-v8': ^4.1.11
overrides:
unrelated-package: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[[case]]
name = "migration_ignore_patterns_upgrade"
vp = "local"
comment = "Preserve templates and their shared catalogs and overrides, re-include one template, and leave non-workspace examples alone."
steps = [
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/starter/package.json"] },
{ argv = ["vpt", "print-file", "templates/starter/vite.config.ts"] },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "templates/starter/tsconfig.json"] },
{ argv = ["vpt", "print-file", "examples/standalone/unit.test.ts"] },
{ argv = ["vpt", "print-file", "packages/app/package.json"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
{ argv = ["vpt", "print-file", "templates/managed/unit.test.ts"] },
{ argv = ["vpt", "print-file", "pnpm-workspace.yaml"] },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "Rerunning uses the same policy and explicit managed dependency specs." },
{ argv = ["vpt", "write-file", "packages/app/unit.test.ts", "import { test } from 'vitest';\ntest('autofix', () => {});\n"] },
{ argv = ["vp", "lint", "--threads=1", "--fix", "templates/starter/unit.test.ts", "packages/app/unit.test.ts"], continue-on-failure = true, comment = "Ignored imports remain upstream; other rules still report the template's debugger statement." },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
]

[[case]]
name = "migration_ignore_patterns_fresh"
vp = "local"
comment = "Initial migration honors the same exclusions."
steps = [
{ argv = ["vpt", "json-edit", "package.json", "devDependencies", "{}"] },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/starter/package.json"] },
{ argv = ["vpt", "print-file", "templates/starter/vite.config.ts"] },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "templates/starter/tsconfig.json"] },
{ argv = ["vpt", "print-file", "examples/standalone/unit.test.ts"] },
{ argv = ["vpt", "print-file", "packages/app/package.json"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
{ argv = ["vpt", "print-file", "templates/managed/unit.test.ts"] },
{ argv = ["vpt", "print-file", "pnpm-workspace.yaml"] },
]

[[case]]
name = "migration_ignore_patterns_override_conflict"
vp = "local"
comment = "A conflicting global override is reported before project files change."
steps = [
{ argv = ["vpt", "write-file", "pnpm-workspace.yaml", "packages: ['packages/*', 'templates/*']\noverrides:\n vite: ^8.0.0\n"] },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/package.json"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
{ argv = ["vpt", "print-file", "pnpm-workspace.yaml"] },
]


[[case]]
name = "migration_ignore_patterns_full"
vp = "local"
comment = "Full setup honors exclusions, and vp check --fix keeps the import policy."
steps = [
{ argv = ["vp", "migrate", "--full", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/starter/package.json"] },
{ argv = ["vpt", "print-file", "templates/starter/vite.config.ts"] },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "templates/starter/tsconfig.json"] },
{ argv = ["vpt", "print-file", "examples/standalone/unit.test.ts"] },
{ argv = ["vpt", "print-file", "packages/app/package.json"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
{ argv = ["vpt", "print-file", "templates/managed/unit.test.ts"] },
{ argv = ["vpt", "print-file", "pnpm-workspace.yaml"] },
{ argv = ["vp", "migrate", "--full", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "Rerunning uses the same policy and explicit managed dependency specs." },
{ argv = ["vpt", "write-file", "packages/app/unit.test.ts", "import { test } from 'vitest';\ntest('autofix', () => {});\n"] },
{ argv = ["vp", "check", "--no-fmt", "--fix", "templates/starter/unit.test.ts", "packages/app/unit.test.ts"], continue-on-failure = true, comment = "Ignored imports remain upstream; other rules still report the template's debugger statement." },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
]

[[case]]
name = "migration_ignore_patterns_parent_negation"
vp = "local"
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { migrate: { ignorePatterns: ['templates/', '!templates/managed/unit.test.ts'] } };\n"] },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/managed/unit.test.ts"] },
{ argv = ["vpt", "print-file", "packages/app/unit.test.ts"] },
]

[[case]]
name = "migration_ignore_patterns_invalid"
vp = "local"
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { migrate: { ignorePatterns: 'templates/' } };\n"] },
{ argv = ["vp", "migrate", "--no-interactive"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/app/package.json"], continue-on-failure = true },
]

[[case]]
name = "migration_ignore_patterns_runtime_config"
vp = "local"
comment = "A runtime config export retains the policy, and the root config can be a plain object."
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "const excluded = ['templates/*', '!templates/managed/'];\nexport default () => ({ migrate: { ignorePatterns: excluded } });\n"] },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/starter/unit.test.ts"] },
{ argv = ["vpt", "print-file", "templates/managed/unit.test.ts"] },
]

[[case]]
name = "migration_ignore_patterns_explicit_target"
vp = "local"
comment = "An explicit non-workspace template target must not bypass the workspace policy."
steps = [
{ argv = ["vp", "migrate", "examples/standalone", "--full", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "examples/standalone/package.json"], continue-on-failure = true },
{ argv = ["vpt", "print-file", "examples/standalone/unit.test.ts"] },
]

[[case]]
name = "migration_ignore_patterns_baseurl_references"
vp = "local"
comment = "The external baseUrl fixer follows references and extends; skip it so excluded configs stay unchanged."
steps = [
{ argv = ["vpt", "write-file", "tsconfig.json", "{ \"compilerOptions\": { \"baseUrl\": \".\" }, \"references\": [{ \"path\": \"./templates/starter\" }] }\n"] },
{ argv = ["vpt", "write-file", "templates/starter/tsconfig.json", "{ \"extends\": \"../../tsconfig.json\", \"compilerOptions\": { \"baseUrl\": \".\", \"paths\": { \"@/*\": [\"src/*\"] } } }\n"] },
{ argv = ["vp", "migrate", "--full", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"] },
{ argv = ["vpt", "print-file", "templates/starter/tsconfig.json"] },
{ argv = ["vpt", "print-file", "tsconfig.json"] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# migration_ignore_patterns_baseurl_references

The external baseUrl fixer follows references and extends; skip it so excluded configs stay unchanged.

## `vpt write-file tsconfig.json '{ "compilerOptions": { "baseUrl": "." }, "references": [{ "path": "./templates/starter" }] }
'`

```
```

## `vpt write-file templates/starter/tsconfig.json '{ "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["src/*"] } } }
'`

```
```

## `vp migrate --full --no-interactive --no-hooks --no-agent --no-editor`

```
VITE+ - The Unified Toolchain for the Web

◇ Updated . to Vite+ <version>
• Node <version> pnpm <version>
• Dependencies:
vite-plus latest → <version>
vite → <version>
• 3 files had imports rewritten
• Package manager settings configured
! Warnings:
- Skipped automatic tsconfig baseUrl removal because its external fixer cannot honor migrate.ignorePatterns. Remove baseUrl manually in migrated projects to enable type-aware linting.
```

## `vpt print-file templates/starter/tsconfig.json`

```
{ "extends": "../../tsconfig.json", "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["src/*"] } } }
```

## `vpt print-file tsconfig.json`

```
{ "compilerOptions": { "baseUrl": "." }, "references": [{ "path": "./templates/starter" }] }
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# migration_ignore_patterns_explicit_target

An explicit non-workspace template target must not bypass the workspace policy.

## `vp migrate examples/standalone --full --no-interactive --no-hooks --no-agent --no-editor`

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

■ Cannot migrate examples/standalone: excluded by migrate.ignorePatterns in <workspace>/vite.config.ts. No project files were changed.
Error: Cannot migrate examples/standalone: excluded by migrate.ignorePatterns in <workspace>/vite.config.ts. No project files were changed.
```

## `vpt print-file examples/standalone/package.json`

```
{ "name": "standalone-template", "private": true, "type": "module", "devDependencies": { "vite": "^8.0.0", "vitest": "^4.1.11" } }
```

## `vpt print-file examples/standalone/unit.test.ts`

```
import { expect, test } from 'vitest';
test('outside-workspace', () => expect(1).toBe(1));
```
Loading
Loading