This is a Next.js boilerplate that comes with the following features:
- Vitest for testing
- React Testing Library for testing React components
- Tailwind CSS for styling
- ESLint for linting
- Prettier for code formatting
- Husky for Git hooks (like pre-commit for automatically lint your commit messages, code, and run tests upon committing or pushing).
- Commitlint for commit message linting
- Configure TypeScript and Vitest to accept Jest DOM useful matchers like toBeInTheDocument, toHaveClass, toBeDisabled, toHaveAttribute, etc. (see @testing-library/jest-dom for more details).
- Runs every commit (in order) to ensure code quality and consistency:
- commitlint (for commit message linting)
- npm test (for running tests)
- npm run lint (for linting the codebase)
- npm run format (for formatting the codebase with Prettier only if needed)
- npm script
formatis added to format the codebase with Prettier just when there's unformatted files (runs--checkbefore--write). - Better integration with ESLint using
eslint-config-prettier. - Intentional config options (e.g.,
tabWidth,semi,singleQuote) are set to ensure consistency.
- Automatically sorts classes based on TailwindCSS team's recommended class order with prettier plugin (prettier-plugin-tailwindcss)
- Configured to work with compatible @types/node v22.12.0 (
create-next-app@latest(version v16) starts with incompatible v20). - Globals enabled with typescript support (like Jest does automatically).
- The test environment is set to
jsdomfor testing React components. - Use the new tsconfigPaths native option instead of deprecated
vite-tsconfig-pathsplugin for path aliasing.