ViteRC โค๏ธโ€๐Ÿ”ฅ

November 29, 2023 ยท View on GitHub

A modern minimal Vite 5 + React 18 + TypeScript template with pre-configured ESLint (with Airbnb JS/React rules), Prettier, Vitest and Git hooks with Husky out of the box ๐Ÿ“ฆ

Vite React TypeScript ESLint Prettier Vitest Testing Library Commitlint

Features

  • โšก๏ธ Vite 5 - Next Generation Frontend Tooling
  • โš›๏ธ React 18 - A JavaScript library for building user interfaces
  • ๐Ÿ’Ž TypeScript - Why not?!
  • ๐Ÿ”จ EsLint - Pluggable JavaScript linter
  • ๐ŸŒ€ Prettier - Opinionated Code Formatter
  • ๐Ÿบ Husky - Native Git hooks
  • โš™๏ธ Vitest - Testing library
  • ๐Ÿ“‘ Commitlint - Linting your commits based on commit convention
  • โŒจ๏ธ Absolute Imports

Why

This template arose out of a need to unite all the above libraries, which were not found in the existing Vite templates. This template has an active contributors that will update everything on this template as needed

Usage

If you are using either Yarn or NPM run the command bellow

npx degit potreco/viterc my-app

cd my-app

# Required if you want a repository and work with Git hooks
git init

yarn install

yarn dev

If you are using Bun

bun create potreco/viterc/bun my-app

cd my-app

# Required if you want a repository and work with Git hooks
git init

bun install

bun run dev

Available commands

In this project, you can run the following scripts:

ScriptDescription
devRuns the app in the development mode.
buildBuilds the app for production to the dist folder.
lintRuns the Eslint and show code problems
formatRuns the Prettier and fix code style
previewBuilds the app for production to the dist folder, and run locally server.
testRun the app tests.
test:watchRun the app tests in watch mode.

About the absolute imports

To correctly functioning (code and tests) of absolute imports, you should add some codes in some files, like:

  • vite.config.ts
  • tsconfig.json

We already writed some absolute imports on these files, so if you wanna more paths or edit some, feel free to do it. If your not safe about it or have some question, send us a thread on Github Discussions asking for, we were happy to help

License

MIT