Giter Site home page Giter Site logo

okradze / vite-react Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 175 KB

A modern React + TypeScript + Vite starter with pre-configured ESLint, Prettier, Git hooks, Commitlint, React Testing Library, Vitest and GitHub Actions out of the box ๐Ÿ“ฆ

Shell 0.87% HTML 2.07% JavaScript 0.67% TypeScript 80.32% SCSS 16.06%
ci commitlint eslint husky prettier react testing-library typescript vite vitest

vite-react's Introduction

React + TypeScript Starter

A modern React + TypeScript + Vite starter with pre-configured ESLint, Prettier, Git hooks, Commitlint, React Testing Library, Vitest and GitHub Actions out of the box ๐Ÿ“ฆ

Vite React TypeScript ESLint Prettier Commitlint Testing Library GitHub Actions

Features

  • โšก๏ธ Vite - Next Generation Frontend Tooling
  • โš›๏ธ React 18 - A JavaScript library for building user interfaces
  • ๐Ÿ’Ž TypeScript - Why not?!
  • ๐Ÿ”จ ESLint - JavaScript linter
  • ๐ŸŒ€ Prettier - Code Formatter
  • ๐Ÿบ Husky - Native Git hooks
  • ๐Ÿบ Lint Staged - Run Linters On Staged Files
  • ๐Ÿ“‘ Commitlint - Linting your commits based on commit convention
  • โš™๏ธ Vitest - Unit Testing Framework
  • โš™๏ธ Testing Library - Test UI components in a user-centric way
  • ๐Ÿ”ฌ GitHub Actions - CI with GitHub Actions
  • โŒจ๏ธ Alias Imports

IDE

We encourage you to use Visual Studio Code

Please install the following plugins:

  • Code Spell Checker
  • ESLint
  • EditorConfig
  • Prettier

Optional plugins:

  • GitLens
  • TODO Highlight

React Folder Structure

components # Reusable components used in multiple pages.
โ””โ”€โ”€ Button # One example of component
    โ”œโ”€โ”€ __tests__ # All test files related to Button
    โ”‚   โ””โ”€โ”€ Button.test.tsx # Component Unit Test
    โ”œโ”€โ”€ Button.module.scss # Button styles
    โ”œโ”€โ”€ Button.tsx # Component file
    โ””โ”€โ”€ index.tsx # Exports component outside
pages
โ””โ”€โ”€ Counter # One example of page
    โ”œโ”€โ”€ __tests__ # All test files related to Counter page
    โ”‚   โ””โ”€โ”€ Counter.test.tsx # Component Unit Test
    โ”œโ”€โ”€ hooks # Hooks related only to Counter page
    โ”‚   โ”œโ”€โ”€ __tests__
    โ”‚   โ”‚   โ””โ”€โ”€ useCounter.test.ts
    โ”‚   โ””โ”€โ”€ useCounter.ts
    โ”œโ”€โ”€ components # You could have components related only to Counter page.
    โ”œโ”€โ”€ utils # You could have utils related only to Counter page.
    โ”œโ”€โ”€ Counter.module.scss
    โ”œโ”€โ”€ Counter.tsx
    โ””โ”€โ”€ index.tsx # Exports page component
routes # All the routes
hooks # You may have hooks folder used in multiple pages or components in top level directory
โ”œโ”€โ”€ __tests__
โ”‚   โ”œโ”€โ”€ useSomeHook.test.ts
โ”‚   โ””โ”€โ”€ useOtherHook.test.ts
โ”œโ”€โ”€ useSomeHook
โ””โ”€โ”€ useOtherHook

Idea is to have related files in one place.

By this every component or page has its own folder with its own tests and styles. Every page has its own components, hooks, utils.

Node Version

We use NVM to manage the Node version. You can install it NVM

Version is specified in .nvmrc file.

After installing NVM, run the following command to install the Node version used in this project:

nvm install
nvm use

Install Dependencies

We use yarn to manage the dependencies. You can install it by running the following command and then install dependencies:

npm install -g yarn
yarn # or yarn install

Scripts

In this project, you can run the following scripts:

Script Description
yarn dev Runs the app in the development mode.
yarn build Builds the app for production to the dist folder.
yarn preview Serves the production app locally after build.
yarn lint Lints the project
yarn test Runs and watches unit tests.
yarn test:coverage Gets unit test coverage.
yarn test:ci Runs unit tests once.
yarn test:ui Runs unit test in UI.

Committing

We use Commitlint to lint our commit messages. This ensures that we have consistent commit messages.

Example of a good commit message:

git commit -m "feat: add new button component"

Commit Types:

Type Description
feat A new feature for user, not a new feature for build script
fix A bug fix for user, not a fix to a build script
chore Other changes that don't modify src or test files
style Changes that do not affect the meaning of the code (white-space, formatting)
docs Documentation only changes
refactor A code change that neither fixes a bug nor adds a feature
perf A code change that improves performance
test Adding missing tests or correcting existing tests
build Changes that affect the build system or external dependencies
ci Changes to our CI configuration files and scripts
revert Reverts a previous commit

License

MIT

vite-react's People

Contributors

okradze avatar

Stargazers

Zura Chubinashvili avatar Shanshe Kenkadze avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.