A modern TypeScript template for React-Astro projects with comprehensive tooling setup.
- Install dependencies:
npm install
- Set up pre-commit hooks:
npm run prepare
This project uses several tools to ensure code quality:
eslint
: Code linting for TypeScript/JavaScriptprettier
: Code formattingtypescript
: Static type checkinghusky
: Git hookslint-staged
: Run linters on staged files
You can run these manually:
# Lint
npm run lint
# Lint with auto-fix
npm run lint:fix
# Format code
npm run format
Or let the pre-commit hook run them automatically on git commit
. If any check fails:
- The commit will be aborted
- The tools will make the necessary changes (if possible)
- Stage the changes (
git add
) and try the commit again
.
├── src/
│ └── styles/
│ └── global.css
├── .eslintrc.js
├── .prettierrc.js
├── .husky/
│ └── pre-commit
├── astro.config.mjs
├── tailwind.config.js
├── tsconfig.json
├── package.json
├── .gitignore
└── README.md
package.json
: Project metadata, dependencies, and scriptstsconfig.json
: TypeScript configuration.eslintrc.js
: ESLint rules and plugin settings.prettierrc.js
: Prettier formatting rulesastro.config.mjs
: Astro configuration with React and Tailwind integrationstailwind.config.js
: Tailwind CSS configuration
- ⚡️ React - UI library support
- 🎨 Tailwind CSS - Utility-first CSS framework
- 📝 TypeScript - Type safety and better DX
- 🔍 ESLint - Code linting
- ✨ Prettier - Code formatting
- 🪝 Husky & lint-staged - Git hooks and staged file linting
- 🚀 Astro - Static site generation
The template includes automatic code quality checks:
-
Pre-commit Hook: Runs on
git commit
- Lints staged files with ESLint
- Formats code with Prettier
- Runs type checking with TypeScript
-
Manual Commands:
# Run ESLint
npm run lint
# Fix ESLint issues
npm run lint:fix
# Format code with Prettier
npm run format
- Start the development server:
npm run dev
- Build for production:
npm run build
- Preview production build:
npm run preview
All commits will automatically trigger the pre-commit hook, ensuring code quality standards are maintained.