Skip to content
Open
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
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ PUNICODE = "PUNICODE"
Jod = "Jod" # Node.js v22 LTS codename
flate = "flate" # flate2 crate name (gzip/deflate compression)
fpr = "fpr" # GPG colon-format record name for a key fingerprint
sigle = "sigle" # Ecosystem repository name used in migration regression fixtures

[default.extend-identifiers]
# Yarn Plug'n'Play — tokenizer splits `PnP` into the word `Pn`, which typos
# otherwise wants to autocorrect to `On`. Whitelist the full identifier so
# the parts aren't tokenized.
PnP = "PnP"
# Tests pass an attached config path: `-c` followed by `custom.json`.
ccustom = "ccustom"

[files]
extend-exclude = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ vp = "local"
steps = [
{ argv = ["vp", "create", "starter", "--no-interactive", "--no-agent", "--", "--directory", "my-app"], comment = "run the local create.templates entry; generated pkg declares fmt/lint via shorthand", continue-on-failure = true },
{ argv = ["vpt", "print-file", "packages/my-app/vite.config.ts"], comment = "fmt/lint stay shorthand only, no injected duplicate inline fmt:/lint: blocks (#1836)", continue-on-failure = true },
{ argv = ["vpt", "stat-file", "packages/my-app/.oxlintrc.json", "--assert-not", "file"], comment = "standalone lint config merge-skipped and removed", continue-on-failure = true },
{ argv = ["vpt", "stat-file", "packages/my-app/.oxfmtrc.json", "--assert-not", "file"], comment = "standalone fmt config merge-skipped and removed", continue-on-failure = true },
{ argv = ["vpt", "stat-file", "packages/my-app/.oxlintrc.json", "--assert", "file"], comment = "standalone lint config preserved", continue-on-failure = true },
{ argv = ["vpt", "stat-file", "packages/my-app/.oxfmtrc.json", "--assert", "file"], comment = "standalone fmt config preserved", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ cloned starter-template to my-app

Monorepo integration...

lint config already present in packages/my-app/vite.config.ts — removed redundant packages/my-app/.oxlintrc.json

fmt config already present in packages/my-app/vite.config.ts — removed redundant packages/my-app/.oxfmtrc.json

Formatting code...

Code formatted
Expand Down Expand Up @@ -44,18 +40,18 @@ export default defineConfig(({ mode }) => {
});
```

## `vpt stat-file packages/my-app/.oxlintrc.json --assert-not file`
## `vpt stat-file packages/my-app/.oxlintrc.json --assert file`

standalone lint config merge-skipped and removed
standalone lint config preserved

```
packages/my-app/.oxlintrc.json: missing
packages/my-app/.oxlintrc.json: file
```

## `vpt stat-file packages/my-app/.oxfmtrc.json --assert-not file`
## `vpt stat-file packages/my-app/.oxfmtrc.json --assert file`

standalone fmt config merge-skipped and removed
standalone fmt config preserved

```
packages/my-app/.oxfmtrc.json: missing
packages/my-app/.oxfmtrc.json: file
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "migration-existing-oxc-configs",
"private": true,
"type": "module",
"packageManager": "pnpm@12.3.4",
"devDependencies": {
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[[case]]
name = "migration_existing_oxc_configs"
vp = "global"
steps = [
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "finish a leftover Oxfmt config even when Vite+ is already installed" },
["vpt", "print-file", "vite.config.ts"],
["vpt", "stat-file", ".oxfmtrc.json", "--assert-not", "file"],
{ argv = ["vp", "fmt", "src/index.ts"], comment = "the migrated options must affect formatting" },
["vpt", "print-file", "src/index.ts"],
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "a completed migration should be a no-op on retry" },
["vpt", "print-file", "vite.config.ts"],
["vpt", "stat-file", "AGENTS.md", "--assert-not", "file"],
["vpt", "stat-file", ".vite-hooks", "--assert-not", "dir"],
["vpt", "stat-file", ".vscode", "--assert-not", "dir"],
]

[[case]]
name = "migration_existing_oxc_configs_unreferenced_lint"
vp = "global"
steps = [
{ argv = ["vpt", "write-file", ".oxlintrc.json", "{\"rules\":{\"no-console\":\"error\"},\"options\":{\"typeAware\":false,\"typeCheck\":false}}\n"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "finish both unreferenced Oxc configs in a project that already uses Vite+" },
["vpt", "stat-file", ".oxlintrc.json", "--assert-not", "file"],
["vpt", "stat-file", ".oxfmtrc.json", "--assert-not", "file"],
["vpt", "print-file", "vite.config.ts"],
["vp", "fmt", "src/index.ts"],
["vpt", "print-file", "src/index.ts"],
["vp", "lint", "src/index.ts"],
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "the restored finalization must remain a no-op on retry" },
["vpt", "print-file", "vite.config.ts"],
["vp", "fmt", "--check", "src/index.ts"],
{ argv = ["vpt", "write-file", "src/index.ts", "console.log('hello')\n"], snapshot = false },
{ argv = ["vp", "lint", "src/index.ts"], comment = "the merged lint rule must apply after the JSON config is removed", continue-on-failure = true },
]

[[case]]
name = "migration_existing_oxc_configs_inline_fmt"
vp = "global"
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { fmt: { singleQuote: false, semi: false } };\n"], snapshot = false },
{ argv = ["vp", "fmt", "src/index.ts"], comment = "the existing inline fmt config takes precedence over the standalone config" },
["vpt", "print-file", "src/index.ts"],
{ argv = ["vpt", "write-file", "src/index.ts", "export const message = \"preserved\";\n"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "keep the standalone config when fmt is already configured" },
["vpt", "print-file", "vite.config.ts"],
["vpt", "stat-file", ".oxfmtrc.json", "--assert", "file"],
{ argv = ["vp", "fmt", "src/index.ts"], comment = "formatting must still use the existing inline options after migration" },
["vpt", "print-file", "src/index.ts"],
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "retrying the completed migration should be a no-op" },
["vpt", "print-file", "vite.config.ts"],
]

[[case]]
name = "migration_existing_oxc_configs_imported"
vp = "global"
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "import fmt from './.oxfmtrc.json' with { type: 'json' };\nimport { readFileSync } from 'node:fs';\nconst lint = JSON.parse(readFileSync(new URL('./.oxlintrc.json', import.meta.url), 'utf8'));\nexport default { fmt, lint };\n"], snapshot = false },
{ argv = ["vpt", "write-file", ".oxlintrc.json", "{\"rules\":{\"no-debugger\":\"error\"}}\n"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "preserve JSON configs loaded with imports and readFileSync" },
["vpt", "print-file", ".oxfmtrc.json"],
["vpt", "print-file", ".oxlintrc.json"],
["vp", "fmt", "src/index.ts"],
["vpt", "print-file", "src/index.ts"],
["vp", "lint", "src/index.ts"],
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "retry preserves both imported configs" },
["vp", "fmt", "--check", "src/index.ts"],
["vp", "lint", "src/index.ts"],
]

[[case]]
name = "migration_existing_oxc_configs_script"
vp = "global"
steps = [
{ argv = ["vpt", "json-edit", "package.json", "scripts.fmt", "vp fmt -c .oxfmtrc.json src/index.ts"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "preserve the config passed explicitly by a package script" },
["vpt", "stat-file", ".oxfmtrc.json", "--assert", "file"],
["vpt", "print-file", "vite.config.ts"],
["vp", "run", "fmt"],
["vpt", "print-file", "src/index.ts"],
]

[[case]]
name = "migration_existing_oxc_configs_extends"
vp = "global"
steps = [
{ argv = ["vpt", "write-file", ".oxlintrc.json", "{\"extends\":[\"./lint-base.json\"]}\n"], snapshot = false },
{ argv = ["vpt", "write-file", "lint-base.json", "{\"rules\":{\"no-console\":\"error\"}}\n"], snapshot = false },
{ argv = ["vpt", "write-file", "src/index.ts", "console.log('hello');\n"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "preserve JSON inheritance instead of copying file paths into inline lint.extends" },
["vpt", "print-file", ".oxlintrc.json"],
{ argv = ["vp", "lint", "-c", ".oxlintrc.json", "src/index.ts"], comment = "the retained JSON config must still load the inherited no-console rule", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# migration_existing_oxc_configs

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

finish a leftover Oxfmt config even when Vite+ is already installed

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

◇ Updated . to Vite+ <version>
• Node <version> pnpm <version>
• Dependencies:
vite-plus latest → <version>
vite → <version>
• 1 config update applied
• Package manager settings configured
```

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

```
export default {
fmt: {
"singleQuote": true,
"semi": false
},

}
```

## `vpt stat-file .oxfmtrc.json --assert-not file`

```
.oxfmtrc.json: missing
```

## `vp fmt src/index.ts`

the migrated options must affect formatting

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

Finished in <duration> on 1 files using <n> threads.
```

## `vpt print-file src/index.ts`

```
export const message = 'preserved'
```

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

a completed migration should be a no-op on retry

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

This project is already using Vite+! Happy coding!
```

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

```
export default {
fmt: {
"singleQuote": true,
"semi": false
},

}
```

## `vpt stat-file AGENTS.md --assert-not file`

```
AGENTS.md: missing
```

## `vpt stat-file .vite-hooks --assert-not dir`

```
.vite-hooks: missing
```

## `vpt stat-file .vscode --assert-not dir`

```
.vscode: missing
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# migration_existing_oxc_configs_extends

## `vpt write-file .oxlintrc.json '{"extends":["./lint-base.json"]}
'`


## `vpt write-file lint-base.json '{"rules":{"no-console":"error"}}
'`


## `vpt write-file src/index.ts 'console.log('\''hello'\'');
'`


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

preserve JSON inheritance instead of copying file paths into inline lint.extends

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

◇ Updated . to Vite+ <version>
• Node <version> pnpm <version>
• Dependencies:
vite-plus latest → <version>
vite → <version>
• 1 config update applied
• Package manager settings configured
```

## `vpt print-file .oxlintrc.json`

```
{"extends":["./lint-base.json"]}
```

## `vp lint -c .oxlintrc.json src/index.ts`

the retained JSON config must still load the inherited no-console rule

**Exit code:** 1

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

× eslint(no-console): Unexpected console statement.
╭─[src/index.ts:1:1]
1 │ console.log('hello');
· ───────────
╰────
help: Delete this console statement.

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