Getting Started
Welcome to jmlweb-tooling! This guide will help you get started with our shared configuration packages for modern JavaScript and TypeScript projects.
What is jmlweb-tooling?
Section titled “What is jmlweb-tooling?”jmlweb-tooling is a collection of shared configuration packages that provide consistent, opinionated settings for popular development tools:
- Prettier - Code formatting with sensible defaults
- ESLint - Linting for JavaScript, TypeScript, React, Node.js, and Astro
- TypeScript - Strict TypeScript configurations for various project types
- Testing - Pre-configured Vitest and Jest setups
- Build Tools - Ready-to-use tsup and Vite configurations
- Commit Linting - Conventional Commits enforcement
Why Use Shared Configurations?
Section titled “Why Use Shared Configurations?”- Consistency - Same code style across all your projects
- Zero Configuration - Works out of the box with sensible defaults
- Best Practices - Based on industry standards and modern conventions
- Easy Updates - Update one package to get improvements across all projects
- Monorepo Friendly - Designed to work seamlessly in monorepo setups
Browse all available packages in the sidebar navigation or explore specific categories below.
Prerequisites
Section titled “Prerequisites”Before getting started, ensure you have:
- Node.js >= 18.0.0 (Download)
- A package manager: pnpm (recommended), npm, or yarn
Check your Node.js version:
node --versionIf you don’t have pnpm installed:
npm install -g pnpmQuick Start
Section titled “Quick Start”Let’s set up a new project with Prettier, ESLint, and TypeScript configurations.
1. Install Prettier Configuration
Section titled “1. Install Prettier Configuration”First, install the Prettier configuration and its peer dependency:
pnpm add -D @jmlweb/prettier-config-base prettierAdd the configuration to your package.json:
{ "prettier": "@jmlweb/prettier-config-base"}Or create a .prettierrc.mjs file (recommended for ES modules):
export { default } from '@jmlweb/prettier-config-base';Test it by formatting your code:
pnpm exec prettier --write "**/*.{js,ts,tsx,json,md}"2. Install ESLint Configuration
Section titled “2. Install ESLint Configuration”Install ESLint configuration for TypeScript:
pnpm add -D @jmlweb/eslint-config-base eslint typescript-eslintCreate an eslint.config.js file:
import baseConfig from '@jmlweb/eslint-config-base';
export default [...baseConfig];Run ESLint:
pnpm exec eslint .3. Install TypeScript Configuration
Section titled “3. Install TypeScript Configuration”Install the TypeScript configuration:
pnpm add -D @jmlweb/tsconfig-base typescriptCreate a tsconfig.json file:
{ "extends": "@jmlweb/tsconfig-base", "compilerOptions": { "outDir": "dist" }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]}Your project is now configured with Prettier, ESLint, and TypeScript!
Configuration Hierarchy
Section titled “Configuration Hierarchy”jmlweb-tooling packages follow a base → variant pattern, allowing you to start with sensible defaults and extend for specific use cases.
Prettier Configurations
Section titled “Prettier Configurations”@jmlweb/prettier-config-base (base formatting rules) └── @jmlweb/prettier-config-tailwind (adds Tailwind CSS class sorting)Example: Start with prettier-config-base, then switch to prettier-config-tailwind when you add Tailwind CSS to your project.
ESLint Configurations
Section titled “ESLint Configurations”@jmlweb/eslint-config-base-js (JavaScript linting) └── @jmlweb/eslint-config-base (adds TypeScript support) ├── @jmlweb/eslint-config-react (adds React and JSX rules) ├── @jmlweb/eslint-config-node (adds Node.js specific rules) └── @jmlweb/eslint-config-astro (adds Astro framework rules)Example: Use eslint-config-base for TypeScript projects, extend to eslint-config-react for React applications.
TypeScript Configurations
Section titled “TypeScript Configurations”@jmlweb/tsconfig-base (strict base configuration) ├── @jmlweb/tsconfig-node (Node.js projects) ├── @jmlweb/tsconfig-react (React libraries) ├── @jmlweb/tsconfig-nextjs (Next.js applications) └── @jmlweb/tsconfig-astro (Astro projects)Example: Extend tsconfig-node for backend services, tsconfig-nextjs for Next.js apps.
Testing Configurations
Section titled “Testing Configurations”@jmlweb/vitest-config (Vitest with TypeScript and coverage)@jmlweb/jest-config (Jest with TypeScript support)Build Tool Configurations
Section titled “Build Tool Configurations”@jmlweb/tsup-config-base (tsup for building TypeScript packages)@jmlweb/vite-config (Vite for frontend projects)Common Patterns
Section titled “Common Patterns”New TypeScript Project
Section titled “New TypeScript Project”Setting up a basic TypeScript project from scratch:
# Initialize projectmkdir my-project && cd my-projectpnpm init
# Install configurationspnpm add -D @jmlweb/prettier-config-base prettierpnpm add -D @jmlweb/eslint-config-base eslint typescript-eslintpnpm add -D @jmlweb/tsconfig-node typescript
# Create source directorymkdir srcpackage.json:
{ "name": "my-project", "type": "module", "prettier": "@jmlweb/prettier-config-base", "scripts": { "build": "tsc", "lint": "eslint .", "format": "prettier --write \"**/*.{js,ts,json,md}\"" }}eslint.config.js:
import baseConfig from '@jmlweb/eslint-config-base';
export default [...baseConfig];tsconfig.json:
{ "extends": "@jmlweb/tsconfig-node", "compilerOptions": { "outDir": "dist" }, "include": ["src/**/*"]}React TypeScript Project
Section titled “React TypeScript Project”For a React application with TypeScript:
# Install dependenciespnpm add -D @jmlweb/prettier-config-base prettierpnpm add -D @jmlweb/eslint-config-react eslint typescript-eslintpnpm add -D @jmlweb/tsconfig-react typescript
# For Vite-based projectspnpm add -D @jmlweb/vite-config viteeslint.config.js:
import reactConfig from '@jmlweb/eslint-config-react';
export default [...reactConfig];tsconfig.json:
{ "extends": "@jmlweb/tsconfig-react", "compilerOptions": { "outDir": "dist" }, "include": ["src"]}vite.config.ts (if using Vite):
import { createReactViteConfig } from '@jmlweb/vite-config';
export default createReactViteConfig();Next.js Project
Section titled “Next.js Project”For a Next.js application:
# Install configurationspnpm add -D @jmlweb/prettier-config-base prettierpnpm add -D @jmlweb/eslint-config-react eslint typescript-eslintpnpm add -D @jmlweb/tsconfig-nextjs typescripttsconfig.json:
{ "extends": "@jmlweb/tsconfig-nextjs", "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"]}Node.js API Project
Section titled “Node.js API Project”For a Node.js backend service:
# Install configurationspnpm add -D @jmlweb/prettier-config-base prettierpnpm add -D @jmlweb/eslint-config-node eslint typescript-eslintpnpm add -D @jmlweb/tsconfig-node typescriptpnpm add -D @jmlweb/vitest-config vitesteslint.config.js:
import nodeConfig from '@jmlweb/eslint-config-node';
export default [...nodeConfig];vitest.config.ts:
import { defineConfig } from 'vitest/config';import baseConfig from '@jmlweb/vitest-config';
export default defineConfig({ test: { ...baseConfig, },});Monorepo Setup
Section titled “Monorepo Setup”For workspace/monorepo dependencies, use the workspace:* protocol:
Root package.json:
{ "devDependencies": { "@jmlweb/prettier-config-base": "workspace:*", "@jmlweb/eslint-config-base": "workspace:*", "@jmlweb/tsconfig-base": "workspace:*" }}This allows all packages in the monorepo to share the same configuration versions.
Extending Configurations
Section titled “Extending Configurations”All configurations can be extended to customize for your specific needs:
Extending Prettier
Section titled “Extending Prettier”import baseConfig from '@jmlweb/prettier-config-base';
export default { ...baseConfig, printWidth: 100, // Override specific options semi: false,};Extending ESLint
Section titled “Extending ESLint”import baseConfig from '@jmlweb/eslint-config-base';
export default [ ...baseConfig, { rules: { // Override or add specific rules '@typescript-eslint/no-unused-vars': 'warn', }, },];Extending TypeScript
Section titled “Extending TypeScript”{ "extends": "@jmlweb/tsconfig-base", "compilerOptions": { "target": "ES2022", "lib": ["ES2022"], "outDir": "dist", "rootDir": "src" }}Package Manager Scripts
Section titled “Package Manager Scripts”Add these common scripts to your package.json:
{ "scripts": { "build": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", "format": "prettier --write \"**/*.{js,ts,tsx,json,md}\"", "format:check": "prettier --check \"**/*.{js,ts,tsx,json,md}\"", "test": "vitest", "type-check": "tsc --noEmit" }}Run them with:
pnpm lint # Check for linting errorspnpm lint:fix # Fix auto-fixable errorspnpm format # Format all filespnpm test # Run testsTroubleshooting
Section titled “Troubleshooting”Conflicts Between Tools
Section titled “Conflicts Between Tools”If ESLint and Prettier conflict on formatting rules:
- Ensure you’re using compatible versions
- ESLint configs already include
eslint-config-prettierto disable conflicting rules - Run Prettier first, then ESLint:
pnpm format && pnpm lint
IDE Integration
Section titled “IDE Integration”For VS Code, install these extensions:
Add to .vscode/settings.json:
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }}Package Not Found
Section titled “Package Not Found”If you see Cannot find package '@jmlweb/...':
- Ensure you’ve installed the package:
pnpm add -D @jmlweb/package-name - Check the package name is correct (all lowercase, with hyphens)
- Run
pnpm installto ensure dependencies are installed
Next Steps
Section titled “Next Steps”Now that you’re set up, explore the documentation for specific packages:
- Prettier - Code formatting options and customization
- ESLint - Linting rules and configuration
- TypeScript - Type checking and compiler options
- Testing - Test configuration and coverage
- Build Tools - Building and bundling your code
Contributing
Section titled “Contributing”Found an issue or have a suggestion? Contributions are welcome!
- Report bugs or request features: GitHub Issues
- View source code: GitHub Repository
Stay Updated
Section titled “Stay Updated”Follow semantic versioning for updates:
- Patch (1.0.x) - Bug fixes, safe to update
- Minor (1.x.0) - New features, backward compatible
- Major (x.0.0) - Breaking changes, read migration guides
Check changelogs in each package’s documentation for version history.