This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
This project is a QR code generator built using React, TypeScript, and Vite. It allows users to generate QR codes for various inputs and provides a fast and efficient development experience with Vite's hot module replacement (HMR).
The project follows a standard Vite + React structure:
Valentine-qr/
├── public/ # Static assets
├── src/ # Source code
│ ├── components/ # Reusable React components
│ ├── styles/ # CSS or SCSS files
│ ├── App.tsx # Main application component
│ ├── main.tsx # Entry point for the React app
│ └── vite-env.d.ts # TypeScript environment definitions
├── .eslintrc.cjs # ESLint configuration
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite configuration
└── package.json # Project dependencies and scripts
-
Clone the Repository
Clone the project to your local machine:git clone <repository-url> cd Valentine-qr
-
Install Dependencies
Install the required dependencies using npm or yarn:npm install # or yarn install
-
Run the Development Server
Start the development server:npm run dev # or yarn dev
The application will be available at
http://localhost:5173
. -
Build for Production
To create a production build, run:npm run build # or yarn build
The build output will be in the
dist/
directory. -
Preview the Production Build
To preview the production build locally:npm run preview # or yarn preview
-
Lint and Format Code
Use the following commands to lint and format the code:npm run lint npm run format
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptions
property like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
- Replace
tseslint.configs.recommended
totseslint.configs.recommendedTypeChecked
ortseslint.configs.strictTypeChecked
- Optionally add
...tseslint.configs.stylisticTypeChecked
- Install eslint-plugin-react and update the config:
// eslint.config.js
import react from 'eslint-plugin-react'
export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})