mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-06-30 15:56:04 +00:00
Former-commit-id: 300e6c1e0854e18ca8f9743b55a39a3f7f3a2bec [formerly 1726d72f3dc439cfab323fb42f1f4fa408245ead] [formerly e478847f0379ece71fe024ca894740b50c1b2596 [formerly bbae20d6f8d156881ced8d8f7caf903d6785c56c]] Former-commit-id: 4ec5432e5e521e7f2bc8d7bfc890ab44fba0ff8d [formerly 5556d79045a913b9ba5fd4a4769c362a67c7f6ec] Former-commit-id: 877383e4305425395d7641c1e3002a302e0a4be6
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...
}
}
])