ESLint and Prettier configuration for Vue 3 + TypeScript projects.
- Prettier owns formatting — no line length, quotes, semicolons, or indentation rules in ESLint
- ESLint owns correctness — catch bugs, enforce best practices, no pedantic preferences
- Zero conflict —
eslint-config-prettierdisables all formatting rules; saving never produces lint errors from formatting - Minimal dependencies — only what's needed for Vue 3 + TypeScript
- Near-zero consumer config — centralized configs, auto-setup script, one-line usage
# Install all dependencies
bun add -d @bagelink/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript simple-git-hooks lint-staged vue-tsc
# Auto-setup (copies config files)
bunx bagel-lint-setup
# Create eslint.config.js
echo "export { default } from '@bagelink/lint-config/eslint'" > eslint.config.js
# Setup git hooks
bun run prepare
# To update from GitHub and reapply configs (one command!)
bunx bagel-lint-setup --upgradeSee Full Setup Guide below for complete instructions.
# Bun
bun add -d @bagelink/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
# npm
npm install -D @bagelink/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript# Bun
bun add -d github:bageldb/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript
# npm
npm install -D github:bageldb/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescriptbun add -d @bagelink/lint-config eslint prettier eslint-plugin-vue eslint-config-prettier globals @typescript-eslint/eslint-plugin @typescript-eslint/parser vue-eslint-parser typescript simple-git-hooks lint-staged vue-tscbunx bagel-lint-setupThis copies the following to your project:
.prettierignore.editorconfigtsconfig.jsontsconfig.app.jsontsconfig.node.json.vscode/settings.json— Format on save, ESLint integration.vscode/extensions.json— Recommended VS Code extensions
Option A: Minimal (Recommended)
Create eslint.config.js:
export { default } from '@bagelink/lint-config/eslint'Option B: With Overrides
import bagelConfig from '@bagelink/lint-config/eslint'
export default [
...bagelConfig,
// Your project-specific overrides
{
rules: {
'no-console': 'off',
},
},
]Add these configurations:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepare": "simple-git-hooks"
},
"prettier": "@bagelink/lint-config/prettier",
"simple-git-hooks": {
"pre-commit": "bunx --bun lint-staged"
},
"lint-staged": {
"*.{js,mjs,cjs,ts,mts,cts,vue}": ["eslint --fix", "prettier --write"],
"*.{json,md,html,css,scss}": ["prettier --write"]
}
}bun run prepareWhen you open the project in VS Code, you'll be prompted to install recommended extensions:
- Prettier
- ESLint
- Vue Language Features (Volar)
Click "Install All" when prompted, or install manually:
code --install-extension esbenp.prettier-vscode
code --install-extension dbaeumer.vscode-eslint
code --install-extension vue.volar
code --install-extension vue.vscode-typescript-vue-pluginAfter installing extensions, reload VS Code for format-on-save to activate.
If you need to override Prettier settings, create prettier.config.cjs:
const bagelPrettier = require('@bagelink/lint-config/prettier')
module.exports = {
...bagelPrettier,
printWidth: 120, // Override
}See Option B in Step 3 above.
name: Lint & Format
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Check formatting
run: bun run format:check
- name: Lint
run: bun run lintAutomatically runs on every commit (configured via simple-git-hooks):
- ESLint auto-fix on JS/TS/Vue files
- Prettier format on all supported files
- Only stages changed files via
lint-staged
- ✅ Vue 3 recommended rules (including
<script setup>) - ✅ TypeScript recommended rules
- ✅ Browser, Node, and ES2021 globals
- ✅
prefer-const,no-debugger - ✅ Unused variables error (except
_prefixed) - ✅ Consistent type imports (allows splitting type and regular imports)
- ✅
consoleandanyare allowed - ❌ No formatting rules (handled by Prettier)
- ❌ No pedantic preferences
printWidth: 100singleQuote: truesemi: falsetrailingComma: 'all'arrowParens: 'always'endOfLine: 'lf'
.prettierignore— Ignore build outputs, dependencies, IDE files.editorconfig— Consistent editor settings (2 spaces, LF, UTF-8)tsconfig.json/tsconfig.app.json/tsconfig.node.json— TypeScript configuration for Vue 3 + Vite.vscode/settings.json— Format on save, ESLint auto-fix.vscode/extensions.json— Recommended VS Code extensions- Git hooks config — Auto-format and lint on commit
The included TypeScript configs are optimized for Vue 3 + Vite projects:
Key Features:
- ✅
types: []in app config — prevents @types conflicts with ESLint - ✅
lib: ["ES2022"]— modern JS features (Object.hasOwn, String.replaceAll) - ✅
exclude: ["**/.*"]— excludes hidden config files from type checking - ✅ Project references — separate configs for app code vs build tooling
- ✅ Strict mode enabled with unused variable checks
- ✅ Path aliases (
@/*→./src/*)
# Update from GitHub and reapply all configs
bunx bagel-lint-setup --upgrade
# Then test
bun run lint
bun run formatThis single command:
- ✅ Pulls latest version from GitHub
- ✅ Overwrites all config files with updates
- ✅ Auto-detects your package manager (bun/npm/yarn/pnpm)
# 1. Pull latest and reapply configs
bunx bagel-lint-setup --upgrade
# 2. Simplify eslint.config.js to one line
echo "export { default } from '@bagelink/lint-config/eslint'" > eslint.config.js
# 3. Remove old config files (if upgrading from older setup)
rm -f prettier.config.cjs .eslintrc.* .prettierrc.*
# 4. Update package.json (see Full Setup Guide)
# 5. Test
bun run lint
bun run formatIf you prefer to control each step:
# 1. Update package manually
bun update @bagelink/lint-config
# 2. Force reapply configs
bunx bagel-lint-setup --force# Reinitialize hooks
bun run prepareEnsure eslint.config.js is at your project root and uses ES module syntax.
- Install required VS Code extensions (see
.vscode/extensions.json) - Reload VS Code after installing
- Check
.vscode/settings.jsonexists with"editor.formatOnSave": true - Verify Prettier is set as default formatter:
- Right-click in a file → "Format Document With..." → "Configure Default Formatter"
- Select "Prettier - Code formatter"
Check .prettierignore is in your project root. Run bunx bagel-lint-setup to regenerate.
If you get TypeScript errors about conflicting types:
- Check that
tsconfig.app.jsonhas"types": [](prevents auto-including @types) - Ensure
exclude: ["**/.*"]is present to exclude config files - Run
bunx bagel-lint-setupto regenerate configs from the latest version
The following can be imported in your project:
@bagelink/lint-config/eslint— ESLint flat config@bagelink/lint-config/prettier— Prettier config@bagelink/lint-config/lint-staged— lint-staged config@bagelink/lint-config/git-hooks— simple-git-hooks config@bagelink/lint-config/vscode/settings— VS Code settings@bagelink/lint-config/vscode/extensions— VS Code extensions@bagelink/lint-config/prettierignore— Prettier ignore patterns@bagelink/lint-config/editorconfig— EditorConfig settings@bagelink/lint-config/tsconfig— Root TypeScript config@bagelink/lint-config/tsconfig/app— App TypeScript config@bagelink/lint-config/tsconfig/node— Node/Vite TypeScript config
MIT