Loading...
Loading...
Set up Biome (default) or ESLint + Prettier, Vitest testing, and pre-commit hooks for any JavaScript/TypeScript project. Uses Bun as the package manager. Use this skill when initializing code quality tooling for a new project or adding linting to an existing one.
npx skill4agent add shipshitdev/library linter-formatter-init--vitest--eslint# Default setup (Biome) - RECOMMENDED
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project
# Use ESLint + Prettier instead (legacy)
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--eslint
# ESLint + Prettier with TypeScript
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--eslint \
--typescript
# Skip pre-commit hooks
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--no-hooks
# Add Vitest testing with 80% coverage threshold
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--vitest
# Full setup: Biome + Vitest + Husky
python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--vitest \
--coverage 80project/
├── biome.json # Biome config (lint + format)
├── .vscode/
│ └── settings.json # Auto-format on save
├── .husky/
│ └── pre-commit # Pre-commit hook
└── package.json # Updated with scripts + lint-stagedproject/
├── .eslintrc.json # ESLint config
├── .prettierrc # Prettier config
├── .prettierignore # Prettier ignore patterns
├── .eslintignore # ESLint ignore patterns
├── .vscode/
│ └── settings.json # Auto-format on save
├── .husky/
│ └── pre-commit # Pre-commit hook
└── package.json # Updated with scripts + lint-staged{
"scripts": {
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"format": "biome format --write .",
"format:check": "biome format .",
"check": "biome check .",
"check:fix": "biome check --write ."
}
}{
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"test:ui": "vitest --ui"
}
}{
"scripts": {
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"format": "prettier --write .",
"format:check": "prettier --check ."
}
}{
"$schema": "https://biomejs.dev/schemas/2.3.12/schema.json",
"assist": {
"actions": {
"source": { "organizeImports": "on" }
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": { "noForEach": "off" },
"style": { "noNonNullAssertion": "off" },
"suspicious": { "noArrayIndexKey": "off", "noExplicitAny": "warn" }
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5",
"semicolons": "always"
}
}
}biome.json--vitestvitest.config.tsimport { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
environment: "node", // or "jsdom" for frontend
include: ["src/**/*.{test,spec}.{ts,tsx}", "**/*.{test,spec}.{ts,tsx}"],
exclude: ["node_modules", "dist", ".next", "build"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html", "lcov"],
include: ["src/**/*.ts", "src/**/*.tsx"],
exclude: ["src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"],
thresholds: {
lines: 80,
functions: 80,
branches: 75,
statements: 80,
},
},
mockReset: true,
restoreMocks: true,
},
});python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/project \
--vitest \
--coverage 90 # Set to 90%src/test/setup.tsimport { expect, afterEach } from "vitest";
import { cleanup } from "@testing-library/react"; // For React projects
// Cleanup after each test
afterEach(() => {
cleanup();
});{
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css}": ["bunx biome check --write"]
}
}{
"lint-staged": {
"*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
"*.{json,md,yml,yaml}": ["prettier --write"]
}
}.vscode/settings.json{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}python3 ~/.claude/skills/linter-formatter-init/scripts/setup.py \
--root /path/to/monorepo \
--monorepo# Reinstall husky
bunx husky
chmod +x .husky/pre-commit--eslintnext/core-web-vitalseslint-plugin-reacteslint-plugin-react-hooksbun add -D @biomejs/biome husky lint-staged
bunx biome init
bunx huskybun add -D eslint prettier eslint-config-prettier eslint-plugin-prettier husky lint-staged
bun add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
bunx eslint --init
bunx husky~/.claude/skills/linter-formatter-init/assets/configs/