Package Exports
- @configurajs/vite-plus
Readme
@configurajs/vite-plus
Opinionated Oxlint + Oxfmt configuration preset for Vite+ projects.
Features
- TypeScript (enabled by default)
- Vue 3 (enabled by default)
- React (opt-in)
- Vitest (enabled by default)
- Type-aware linting
- Oxfmt formatting with import sorting and Tailwind CSS class sorting
Install
pnpm add -D @configurajs/vite-plusUsage
Oxc Configuration File
Create oxlint.config.ts in your project root:
// oxlint.config.ts
import { lint } from '@configurajs/vite-plus'
export default lint()Create oxfmt.config.ts in your project root:
// oxfmt.config.ts
import { fmt } from '@configurajs/vite-plus'
export default fmt()Vite+ Configuration File
If you are using Vite+, you can configure lint and fmt in vite.config.ts directly:
// vite.config.ts
import { defineConfig } from 'vite'
import { lint, fmt } from '@configurajs/vite-plus'
export default defineConfig({
lint: lint(),
fmt: fmt(),
})Note: The Oxc VSCode extension currently cannot recognize the Vite+ configuration file (
vite.config.ts) for linting. Use standaloneoxlint.config.ts/oxfmt.config.tsfiles if you need VSCode integration, or wait for the official fix.
Lint Options
lint({
// Enable TypeScript support (default: true)
ts: true,
// Enable Vue support, version 3 by default (default: true)
vue: true, // or { version: 2 }
// Enable React support (default: false)
react: false,
// Enable Vitest support (default: true)
vitest: true,
// Custom rules
rules: {
'no-console': 'error',
},
// Additional overrides
overrides: [
{
files: ['scripts/**'],
rules: { 'no-console': 'off' },
},
],
})VSCode Settings
Add the following to .vscode/settings.json:
{
"prettier.enable": false,
"eslint.enable": false,
"editor.defaultFormatter": "oxc.oxc-vscode",
}License
MIT