This repository is a TypeScript template preconfigured with:
- ESLint for linting
- Prettier for formatting
- Husky for Git hooks
- Conventional Commits validation in pre-commit
- Type checking and test scripts
- Compatible with pnpm, npm, yarn, and bun
You can use any package manager you prefer. All commands shown below work the same way across tools.
Install dependencies using your preferred package manager:
pnpm install
# or npm install
# or yarn install
# or bun installAfter installing dependencies, you must run the prepare script:
pnpm prepare
# or npm run prepare
# or yarn prepare
# or bun run prepareOnce initialized, before every commit, Husky will automatically:
- Run ESLint
- Format code with Prettier
- Check TypeScript types
- Run tests
- Validate commit messages using Conventional Commits
This ensures consistent, clean, and safe commits.
This template enforces Conventional Commits automatically during pre-commit.
If your commit message does not follow the standard, the commit will be rejected.
| Type | Purpose |
|---|---|
| feat: | A new feature |
| fix: | A bug fix |
| docs: | Documentation changes |
| style: | Formatting only (no code changes) |
| refactor: | Code refactoring without behavior changes |
| test: | Adding or updating tests |
| chore: | Maintenance tasks (configs, tooling, CI, etc.) |
You can run these commands with pnpm, npm, yarn, or bun.
Runs ESLint to detect code issues.
pnpm lint
# or npm run lint
# or yarn lint
# or bun run lintAutomatically fixes ESLint problems when possible.
pnpm lint:fix
# or npm run lint:fix
# or yarn lint:fix
# or bun run lint:fixFormats the entire codebase using Prettier.
pnpm format
# or npm run format
# or yarn format
# or bun run formatRuns TypeScript’s type checker without emitting files.
pnpm typecheck
# or npm run typecheck
# or yarn typecheck
# or bun run typecheckRuns your Node.js test suite.
pnpm test
# or npm run test
# or yarn test
# or bun run testThis project uses strict versioning (save-exact=true), so dependencies do not update automatically.
If you want to update them, you must do it manually with your package manager:
pnpm update --latest
# or npm update
# or yarn upgrade --latest
# or bun updateThis prevents inconsistent installations across machines and ensures full reproducibility.
If you plan to use React or Preact, make sure to uncomment the corresponding sections in:
eslint.config.jstsconfig.json(only required for Preact)
- Uncomment the React block in
eslint.config.js. - No TypeScript changes needed.
- Uncomment the Preact block in
eslint.config.js. - In
tsconfig.json, add or uncomment"jsxImportSource": "preact"
If your project uses React or Preact in a standard way, it’s easier and more reliable to start from an official template:
- Vite + React
- Vite + Preact
- Or any React framework template of your choice
If this template helped you, consider giving it a star.