| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Check Config | ||
|
|
||
| `vp check` runs format, lint, and type checks together. The `check` block in `vite.config.ts` sets defaults for the composite command, mirroring the `--no-fmt` and `--no-lint` CLI flags. | ||
|
|
||
| This is useful when a project wants to keep most of the toolchain but skip one step by default. For example, a team that lints but does not format can disable `check.fmt` so a plain `vp check` (the command agents and contributors run most) only lints, without anyone needing to remember `--no-fmt`. | ||
|
|
||
| ## Example | ||
|
|
||
| ```ts [vite.config.ts] | ||
| import { defineConfig } from 'vite-plus'; | ||
|
|
||
| export default defineConfig({ | ||
| check: { | ||
| // Skip the format step in `vp check`. Defaults to true. | ||
| fmt: false, | ||
| // Skip lint rules in `vp check`. Type-check still runs when both | ||
| // `lint.options.typeAware` and `lint.options.typeCheck` are enabled. | ||
| // Defaults to true. | ||
| lint: true, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| When a step is disabled here, `vp check` prints a short `note:` line so it is clear why the step did not run. With the `check.fmt: false` config above: | ||
|
|
||
| ```bash | ||
| $ vp check | ||
| note: Format skipped (check.fmt: false in vite.config.ts) | ||
| pass: Found no warnings or lint errors in 1 file (12ms, 8 threads) | ||
| ``` | ||
|
|
||
| ## Scope and precedence | ||
|
|
||
| - These options only affect the composite `vp check`. Standalone [`vp fmt`](/config/fmt) and [`vp lint`](/config/lint) are unaffected, so you can still run a disabled tool directly when you need it once. Note that any `vp check` invocation honors these defaults, including one run from a pre-commit hook: if your [`staged`](/config/staged) tasks call `vp check`, that step is skipped there too. | ||
| - A step is skipped if the config disables it **or** the matching CLI flag is passed. There is no flag to re-enable a step disabled in config; run `vp fmt` or `vp lint` directly instead. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| [1]> vp check --no-fmt --no-lint | ||
| error: No checks enabled | ||
|
|
||
| Enable `lint.options.typeCheck` in vite.config.ts to use `vp check --no-fmt --no-lint` for type-check only, or drop a flag to re-enable fmt/lint. | ||
| Enable `lint.options.typeCheck` in vite.config.ts for type-check only, drop a `--no-fmt`/`--no-lint` flag, or re-enable `check.fmt`/`check.lint` in vite.config.ts. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "check-config-flag-precedence", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| > vp check --no-fmt | ||
| pass: Found no warnings or lint errors in 2 files (<variable>ms, <variable> threads) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function hello() { | ||
| return "hello"; | ||
| } | ||
|
|
||
| export { hello }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "env": { | ||
| "VITE_DISABLE_AUTO_INSTALL": "1" | ||
| }, | ||
| "commands": ["vp check --no-fmt"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| check: { | ||
| fmt: true, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "check-config-no-fmt", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| > vp check | ||
| note: Format skipped (check.fmt: false in vite.config.ts) | ||
| pass: Found no warnings or lint errors in 2 files (<variable>ms, <variable> threads) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function hello() { | ||
| return "hello"; | ||
| } | ||
|
|
||
| export { hello }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "env": { | ||
| "VITE_DISABLE_AUTO_INSTALL": "1" | ||
| }, | ||
| "commands": ["vp check"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| check: { | ||
| fmt: false, | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "check-config-no-lint", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| > vp check | ||
| note: Lint skipped (check.lint: false in vite.config.ts) | ||
| pass: All 4 files are correctly formatted (<variable>ms, <variable> threads) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function hello() { | ||
| return "hello"; | ||
| } | ||
|
|
||
| export { hello }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "env": { | ||
| "VITE_DISABLE_AUTO_INSTALL": "1" | ||
| }, | ||
| "commands": ["vp check"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| check: { | ||
| lint: false, | ||
| }, | ||
| }; |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.