Skip to content
Merged
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
Expand Up @@ -28,9 +28,9 @@ steps = [
{ argv = ["vp", "fmt", "index.js"], cwd = "src" },
{ argv = ["vpt", "print-file", "src/index.js"], comment = "The root fmt settings apply from a subdirectory too." },
{ argv = ["vpt", "write-file", "src/vite.config.ts", "export default { lint: { rules: { 'no-console': 'off' } }, fmt: { singleQuote: false, semi: true } };\n"] },
{ argv = ["vp", "lint", "index.js"], cwd = "src", comment = "The root lint config still applies when the working directory has its own lint settings.", continue-on-failure = true },
{ argv = ["vp", "lint", "index.js"], cwd = "src", comment = "Oxlint discovers the lint settings in the working directory.", continue-on-failure = true },
{ argv = ["vp", "fmt", "index.js"], cwd = "src" },
{ argv = ["vpt", "print-file", "src/index.js"], comment = "The root fmt settings still apply when the working directory has its own fmt block." },
{ argv = ["vpt", "print-file", "src/index.js"], comment = "Oxfmt discovers the fmt settings in the working directory." },
{ argv = ["vp", "lint", "src/index.js"], comment = "Running from the root keeps per-file nested lint configs disabled.", continue-on-failure = true },
{ argv = ["vp", "fmt", "src/index.js"] },
{ argv = ["vpt", "print-file", "src/index.js"], comment = "Running from the root keeps per-file nested fmt configs disabled." },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,10 @@ console.log('hello')

## `cd src && vp lint index.js`

The root lint config still applies when the working directory has its own lint settings.

**Exit code:** 1
Oxlint discovers the lint settings in the working directory.

```

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

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

Expand All @@ -72,10 +62,10 @@ Finished in <duration> on 1 files using <n> threads.

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

The root fmt settings still apply when the working directory has its own fmt block.
Oxfmt discovers the fmt settings in the working directory.

```
console.log('hello')
console.log("hello");
```

## `vp lint src/index.js`
Expand All @@ -88,7 +78,7 @@ Running from the root keeps per-file nested lint configs disabled.

× eslint(no-console): Unexpected console statement.
╭─[src/index.js:1:1]
1 │ console.log('hello')
1 │ console.log("hello");
· ───────────
╰────
help: Delete this console statement.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[[case]]
name = "root_format_options"
name = "discovered_format_options"
vp = ["local", "global"]
cwd = "packages/app"
steps = [
{ argv = ["vp", "fmt", "--check", "index.js"], comment = "The package format settings cannot replace the root settings.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-lint", "index.js"], comment = "The formatting phase of check uses the same root config.", continue-on-failure = true },
{ argv = ["vp", "fmt", "--check", "index.js"], comment = "Oxfmt discovers the package format settings.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-lint", "index.js"], comment = "The check command keeps the root format settings.", continue-on-failure = true },
{ argv = ["vp", "fmt", "index.js"] },
{ argv = ["vpt", "print-file", "index.js"], comment = "The root single-quote and semicolon settings apply without changing the package working directory." },
{ argv = ["vp", "check", "--no-lint", "index.js"] },
{ argv = ["vpt", "print-file", "index.js"], comment = "The package double-quote and semicolon settings apply with package-relative file paths." },
{ argv = ["vp", "check", "--no-lint", "index.js"], comment = "Direct formatting does not change the root settings used by check.", continue-on-failure = true },
]

[[case]]
name = "explicit_format_config"
vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vp", "fmt", "-c", "vite.config.ts", "--check", "index.js"], comment = "An explicit package config takes precedence without a duplicate automatic config argument." },
{ argv = ["vp", "fmt", "-c", "vite.config.ts", "--check", "index.js"], comment = "An explicit package config matches native discovery." },
{ argv = ["vp", "fmt", "--config", "vite.config.ts", "--check", "index.js"] },
{ argv = ["vp", "fmt", "--config=vite.config.ts", "--check", "index.js"] },
{ argv = ["vp", "fmt", "-c", "../../vite.config.ts", "--check", "index.js"], comment = "Selecting the root config explicitly detects the conflicting format.", continue-on-failure = true },
Expand All @@ -30,3 +30,24 @@ steps = [
{ argv = ["vpt", "print-file", "fix.js"], comment = "Formatting after the curly lint fix also uses root quotes and semicolons." },
{ argv = ["vp", "check", "fix.js"] },
]

[[case]]
name = "check_without_root_format"
vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vpt", "write-file", "../../vite.config.ts", "export default { lint: {} };\n"], snapshot = false },
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { fmt: { singleQuote: true, semi: false } };\n"], snapshot = false },
{ argv = ["vpt", "write-file", "index.js", "export const message = 'hello'\n"], snapshot = false },
{ argv = ["vp", "check", "--no-lint", "index.js"], comment = "Without a root fmt block, check lets Oxfmt discover the package format settings." },
]

[[case]]
name = "check_explicit_format_config"
vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vp", "check", "--no-lint", "--", "-c", "vite.config.ts", "index.js"], comment = "An explicit config passed through check still takes precedence over the root config." },
{ argv = ["vp", "check", "--no-lint", "--", "--config", "vite.config.ts", "index.js"] },
{ argv = ["vp", "check", "--no-lint", "--", "--config=vite.config.ts", "index.js"] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# check_explicit_format_config

## `vp check --no-lint -- -c vite.config.ts index.js`

An explicit config passed through check still takes precedence over the root config.

```
pass: All 1 file are correctly formatted (<duration>, <n> threads)
```

## `vp check --no-lint -- --config vite.config.ts index.js`

```
pass: All 1 file are correctly formatted (<duration>, <n> threads)
```

## `vp check --no-lint -- --config=vite.config.ts index.js`

```
pass: All 1 file are correctly formatted (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# check_without_root_format

## `vpt write-file ../../vite.config.ts 'export default { lint: {} };
'`


## `vpt write-file vite.config.ts 'export default { fmt: { singleQuote: true, semi: false } };
'`


## `vpt write-file index.js 'export const message = '\''hello'\''
'`


## `vp check --no-lint index.js`

Without a root fmt block, check lets Oxfmt discover the package format settings.

```
pass: All 1 file are correctly formatted (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# root_format_options
# discovered_format_options

## `vp fmt --check index.js`

The package format settings cannot replace the root settings.

**Exit code:** 1
Oxfmt discovers the package format settings.

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

Checking formatting...

index.js (<duration>)

Format issues found in above 1 files. Run without `--check` to fix.
All matched files use the correct format.
Finished in <duration> on 1 files using <n> threads.
```

## `vp check --no-lint index.js`

The formatting phase of check uses the same root config.
The check command keeps the root format settings.

**Exit code:** 1

Expand All @@ -42,16 +38,23 @@ Finished in <duration> on 1 files using <n> threads.

## `vpt print-file index.js`

The root single-quote and semicolon settings apply without changing the package working directory.
The package double-quote and semicolon settings apply with package-relative file paths.

```
export const message = 'hello'
export const message = "hello";
```

## `vp check --no-lint index.js`

Direct formatting does not change the root settings used by check.

**Exit code:** 1

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

pass: All 1 file are correctly formatted (<duration>, <n> threads)
error: Formatting issues found
index.js (<duration>)

Found formatting issues in 1 file (<duration>, <n> threads). Run `vp check --fix` to fix them.
```
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# root_format_options
# discovered_format_options

## `vp fmt --check index.js`

The package format settings cannot replace the root settings.

**Exit code:** 1
Oxfmt discovers the package format settings.

```
Checking formatting...

index.js (<duration>)

Format issues found in above 1 files. Run without `--check` to fix.
All matched files use the correct format.
Finished in <duration> on 1 files using <n> threads.
```

## `vp check --no-lint index.js`

The formatting phase of check uses the same root config.
The check command keeps the root format settings.

**Exit code:** 1

Expand All @@ -36,14 +32,21 @@ Finished in <duration> on 1 files using <n> threads.

## `vpt print-file index.js`

The root single-quote and semicolon settings apply without changing the package working directory.
The package double-quote and semicolon settings apply with package-relative file paths.

```
export const message = 'hello'
export const message = "hello";
```

## `vp check --no-lint index.js`

Direct formatting does not change the root settings used by check.

**Exit code:** 1

```
pass: All 1 file are correctly formatted (<duration>, <n> threads)
error: Formatting issues found
index.js (<duration>)

Found formatting issues in 1 file (<duration>, <n> threads). Run `vp check --fix` to fix them.
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## `vp fmt -c vite.config.ts --check index.js`

An explicit package config takes precedence without a duplicate automatic config argument.
An explicit package config matches native discovery.

```
Checking formatting...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[[case]]
name = "root_rules_and_typecheck"
name = "discovered_rules_and_typecheck"
vp = ["local", "global"]
cwd = "packages/app"
steps = [
{ argv = ["vp", "lint", "index.ts"], comment = "The root lint rules and type-check options apply even when the package has its own lint block.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "index.ts"], comment = "The check wrapper and Oxlint both use the root config.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "--no-lint", "index.ts"], comment = "Type-check-only mode reports the same type error without lint rules.", continue-on-failure = true },
{ argv = ["vp", "lint", "-c", "../../vite.config.ts", "index.ts"], comment = "Explicit root selection has the same result and preserves package-relative file paths.", continue-on-failure = true },
{ argv = ["vp", "lint", "index.ts"], comment = "Oxlint discovers the package lint block without the root rules or type-check options.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "index.ts"], comment = "The check command keeps the root lint rules and type-check options.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "--no-lint", "index.ts"], comment = "Type-check-only mode still reports the type error without lint rules.", continue-on-failure = true },
{ argv = ["vp", "lint", "-c", "../../vite.config.ts", "index.ts"], comment = "Explicit root selection enables the root rules and type checking while preserving package-relative file paths.", continue-on-failure = true },
]

[[case]]
Expand All @@ -15,9 +15,29 @@ vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { lint: { options: { typeAware: false, typeCheck: false }, rules: { 'no-console': 'off' } } };\n"], snapshot = false },
{ argv = ["vp", "lint", "index.ts"], comment = "Package options cannot disable the root rules or type checking.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "index.ts"], continue-on-failure = true },
{ argv = ["vp", "lint", "-c", "vite.config.ts", "index.ts"], comment = "An explicit package config overrides the root config without a duplicate config argument." },
{ argv = ["vp", "lint", "index.ts"], comment = "Oxlint uses the package rules and type-check options.", continue-on-failure = true },
{ argv = ["vp", "check", "--no-fmt", "index.ts"], comment = "Package options cannot disable the root rules or type checking in check.", continue-on-failure = true },
{ argv = ["vp", "lint", "-c", "vite.config.ts", "index.ts"], comment = "An explicit package config matches native discovery." },
{ argv = ["vp", "lint", "--config", "vite.config.ts", "index.ts"] },
{ argv = ["vp", "lint", "--config=vite.config.ts", "index.ts"] },
]

[[case]]
name = "check_without_root_lint"
vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vpt", "write-file", "../../vite.config.ts", "export default { fmt: {} };\n"], snapshot = false },
{ argv = ["vpt", "write-file", "vite.config.ts", "export default { lint: { rules: { 'no-console': 'error' } } };\n"], snapshot = false },
{ argv = ["vp", "check", "--no-fmt", "index.ts"], comment = "Without a root lint block, check lets Oxlint discover the package lint rules.", continue-on-failure = true },
]

[[case]]
name = "check_explicit_lint_config"
vp = "local"
cwd = "packages/app"
steps = [
{ argv = ["vp", "check", "--no-fmt", "--", "-c", "vite.config.ts", "index.ts"], comment = "An explicit config passed through check still takes precedence over the root config." },
{ argv = ["vp", "check", "--no-fmt", "--", "--config", "vite.config.ts", "index.ts"] },
{ argv = ["vp", "check", "--no-fmt", "--", "--config=vite.config.ts", "index.ts"] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# check_explicit_lint_config

## `vp check --no-fmt -- -c vite.config.ts index.ts`

An explicit config passed through check still takes precedence over the root config.

```
pass: Found no warnings, lint errors, or type errors in 1 file (<duration>, <n> threads)
```

## `vp check --no-fmt -- --config vite.config.ts index.ts`

```
pass: Found no warnings, lint errors, or type errors in 1 file (<duration>, <n> threads)
```

## `vp check --no-fmt -- --config=vite.config.ts index.ts`

```
pass: Found no warnings, lint errors, or type errors in 1 file (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# check_without_root_lint

## `vpt write-file ../../vite.config.ts 'export default { fmt: {} };
'`


## `vpt write-file vite.config.ts 'export default { lint: { rules: { '\''no-console'\'': '\''error'\'' } } };
'`


## `vp check --no-fmt index.ts`

Without a root lint block, check lets Oxlint discover the package lint rules.

**Exit code:** 1

```
error: Lint issues found
× eslint(no-console): Unexpected console statement.
╭─[index.ts:2:1]
1 │ export const value: number = "not a number";
2 │ console.log(value);
· ───────────
╰────
help: Delete this console statement.

Found 1 error and 0 warnings in 1 file (<duration>, <n> threads)
```
Loading
Loading