@sorafujitani/vp-config
v0.1.3
Published
Vite Plus configuration for @sorafujitani
Readme
@sorafujitani/vp-config
Reusable vite-plus configuration providing shared format, lint, and test presets.
Install
vp add -D @sorafujitani/vp-configUsage
Basic — use all presets
// vite.config.ts
import { defineConfig } from "vite-plus";
import { fmt, lint, test } from "@sorafujitani/vp-config";
export default defineConfig({
fmt,
lint,
test,
});With staged (pre-commit auto-fix)
// vite.config.ts
import { defineConfig } from "vite-plus";
import { fmt, lint, test } from "@sorafujitani/vp-config";
export default defineConfig({
staged: {
"*": "vp check --fix",
},
fmt,
lint,
test,
});Cherry-pick individual presets
You can import only the presets you need:
import { defineConfig } from "vite-plus";
import { fmt } from "@sorafujitani/vp-config";
export default defineConfig({
fmt,
// bring your own lint / test config
});Override or extend a preset
Spread the preset and override specific fields:
import { defineConfig } from "vite-plus";
import { fmt, lint, test } from "@sorafujitani/vp-config";
export default defineConfig({
fmt: {
...fmt,
printWidth: 120,
singleQuote: true,
},
lint: {
...lint,
rules: {
...lint.rules,
"no-magic-numbers": "off",
},
},
test: {
...test,
include: [...test.include, "tests/**/*.test.ts"],
},
});With vp pack (library build)
If you are also building a library with vp pack, combine with a tsdown config:
// vite.config.ts
import { defineConfig } from "vite-plus";
import { fmt, lint, test } from "@sorafujitani/vp-config";
import tsdownConfig from "./tsdown.config.ts";
export default defineConfig({
fmt,
lint,
test,
pack: tsdownConfig,
});Preset Details
fmt — Format
Opinionated Prettier-compatible defaults:
- Double quotes, semicolons, trailing commas (
"all") - 2-space indent, 80 char print width, LF line endings
- Auto-sorted imports and
package.json
lint — Lint
OxLint configuration with TypeScript-first rules:
- Plugins:
typescript,unicorn,oxc,import,promise - Type-aware checking enabled (
typeAware: true,typeCheck: true) - Categories:
correctness→ error,pedantic/perf/style/suspicious→ warn - Strict TypeScript rules (
no-explicit-anyas error, consistent type imports/exports) - Import hygiene (
no-cycle,no-duplicates,no-self-import) - CJS overrides for
.cjsfiles
test — Test
Vitest include pattern:
src/**/*.test.tsindex.test.ts
Development
vp pack # Build
vp pack --watch # Build in watch mode
vp test # Run tests
vp check # Format, lint, and type check
vp exec bumpp # Release with bumpp