mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-06-29 07:15:48 +00:00
Former-commit-id: c5c915a00934cb86aa2ecb6dd0c10afa2ed83834 [formerly f00a3218da665fc7f9d3e0e724352f04c6dabdc2] [formerly 1431a8b11a118cad553c55bdbca0791716fee1ff [formerly e6594851ebebcba5612036f96ced6d2319ffd6b1]] Former-commit-id: 3d7f0c4b17851c1712d913f530b38e7be91dd47e [formerly 3b60102dd35bdd7a341f5c1962a6a1d03c834bc8] Former-commit-id: 1f8bed47754d1b4497472521ec19e693a311b25d
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname
}
// other options...
}
}
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactDom from 'eslint-plugin-react-dom'
import reactX from 'eslint-plugin-react-x'
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname
}
// other options...
}
}
])