create-reactivite 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -177
- package/index.js +7 -0
- package/package.json +1 -1
- package/template/README.md +73 -73
- package/template/components.json +22 -22
- package/template/eslint.config.js +30 -23
- package/template/index.html +13 -13
- package/template/package.json +53 -51
- package/template/pnpm-lock.yaml +1521 -1766
- package/template/src/App.tsx +27 -13
- package/template/src/components/admin-page-components/activity-chart.tsx +80 -0
- package/template/src/components/admin-page-components/dashboard-header.tsx +38 -0
- package/template/src/components/admin-page-components/dashboard-layout.tsx +23 -0
- package/template/src/components/admin-page-components/dashboard-sales.tsx +67 -0
- package/template/src/components/admin-page-components/dashboard-sidebar.tsx +81 -0
- package/template/src/components/admin-page-components/revenu-chart.tsx +69 -0
- package/template/src/components/admin-page-components/stat-cards.tsx +50 -0
- package/template/src/components/home-page-components/header.tsx +2 -2
- package/template/src/components/ui/accordion.tsx +64 -64
- package/template/src/components/ui/alert.tsx +66 -66
- package/template/src/components/ui/avatar.tsx +51 -51
- package/template/src/components/ui/badge.tsx +46 -46
- package/template/src/components/ui/button-group.tsx +83 -83
- package/template/src/components/ui/button.tsx +60 -60
- package/template/src/components/ui/calendar.tsx +210 -211
- package/template/src/components/ui/card.tsx +92 -92
- package/template/src/components/ui/checkbox.tsx +30 -30
- package/template/src/components/ui/collapsible.tsx +31 -31
- package/template/src/components/ui/dialog.tsx +141 -141
- package/template/src/components/ui/input.tsx +21 -0
- package/template/src/components/ui/select.tsx +185 -185
- package/template/src/components/ui/separator.tsx +26 -26
- package/template/src/components/ui/sonner.tsx +38 -38
- package/template/src/components/ui/spinner.tsx +16 -16
- package/template/src/components/ui/table.tsx +114 -114
- package/template/src/components/ui/toggle.tsx +45 -45
- package/template/src/components/ui/tooltip.tsx +59 -59
- package/template/src/lib/utils.ts +6 -6
- package/template/src/main.tsx +10 -10
- package/template/src/pages/Dashboard/Dashboard.tsx +32 -0
- package/template/tsconfig.app.json +31 -28
- package/template/tsconfig.json +12 -14
- package/template/tsconfig.node.json +26 -26
- package/template/vite.config.ts +13 -14
package/README.md
CHANGED
|
@@ -1,177 +1,197 @@
|
|
|
1
|
-
# create-reactivite
|
|
2
|
-
|
|
3
|
-
A modern React boilerplate generator that creates production-ready applications with React, Vite, TypeScript, Tailwind CSS, and shadcn/ui components.
|
|
4
|
-
|
|
5
|
-
## 🚀 Features
|
|
6
|
-
|
|
7
|
-
- **⚡ Vite** - Lightning fast build tool and dev server
|
|
8
|
-
- **⚛️ React 19** - Latest React with modern features
|
|
9
|
-
- **📘 TypeScript** - Full TypeScript support with strict configuration
|
|
10
|
-
- **🎨 Tailwind CSS v4** - Latest Tailwind with modern CSS features
|
|
11
|
-
- **🧩 shadcn/ui** - Beautiful, accessible UI components
|
|
12
|
-
- **📦 Radix UI** - Unstyled, accessible components
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
npm
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- **
|
|
51
|
-
- **
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- **
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
│
|
|
79
|
-
|
|
80
|
-
│
|
|
81
|
-
│ ├──
|
|
82
|
-
│ │
|
|
83
|
-
│ ├──
|
|
84
|
-
│ │ └──
|
|
85
|
-
│ ├──
|
|
86
|
-
│
|
|
87
|
-
│
|
|
88
|
-
├──
|
|
89
|
-
|
|
90
|
-
├──
|
|
91
|
-
├──
|
|
92
|
-
└──
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
pnpm
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
# create-reactivite
|
|
2
|
+
|
|
3
|
+
A modern React boilerplate generator that creates production-ready applications with React, Vite, TypeScript, Tailwind CSS, and shadcn/ui components.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **⚡ Vite 8** - Lightning fast build tool and dev server
|
|
8
|
+
- **⚛️ React 19** - Latest React with modern features
|
|
9
|
+
- **📘 TypeScript 6** - Full TypeScript support with strict configuration
|
|
10
|
+
- **🎨 Tailwind CSS v4** - Latest Tailwind with modern CSS features
|
|
11
|
+
- **🧩 shadcn/ui** - Beautiful, accessible UI components
|
|
12
|
+
- **📦 Radix UI** - Unstyled, accessible components
|
|
13
|
+
- **🧭 React Router v7** - Client-side routing with `createBrowserRouter`
|
|
14
|
+
- **📊 Recharts** - Composable charts for the admin dashboard
|
|
15
|
+
- **🌙 Dark Mode** - Built-in theme switching with next-themes
|
|
16
|
+
- **📅 Date Picker** - React Day Picker integration
|
|
17
|
+
- **🔔 Toast Notifications** - Sonner for elegant notifications
|
|
18
|
+
- **🎯 ESLint** - Code linting with modern flat config
|
|
19
|
+
- **📱 Responsive** - Mobile-first responsive design
|
|
20
|
+
- **🎭 Icons** - Lucide React icon library
|
|
21
|
+
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
### Using npx (Recommended)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx create-reactivite my-app
|
|
28
|
+
cd my-app
|
|
29
|
+
pnpm dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Using npm
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm create reactivite my-app
|
|
36
|
+
cd my-app
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Install in current directory
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx create-reactivite .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 🛠️ What's Included
|
|
47
|
+
|
|
48
|
+
### Core Technologies
|
|
49
|
+
|
|
50
|
+
- **React 19.2** - Latest React with concurrent features
|
|
51
|
+
- **TypeScript 6.0** - Strict type checking
|
|
52
|
+
- **Vite 8.0** - Fast build tool and dev server (Rolldown bundler)
|
|
53
|
+
- **Tailwind CSS 4.3** - Utility-first CSS framework
|
|
54
|
+
- **React Router 7** - Routing via `createBrowserRouter` (from `react-router`)
|
|
55
|
+
|
|
56
|
+
### UI Components
|
|
57
|
+
|
|
58
|
+
The template includes a comprehensive set of pre-built shadcn/ui components:
|
|
59
|
+
|
|
60
|
+
- **Layout**: Card, Separator, Dialog
|
|
61
|
+
- **Forms**: Button, Checkbox, Select, Calendar
|
|
62
|
+
- **Navigation**: Accordion, Collapsible, Toggle
|
|
63
|
+
- **Feedback**: Alert, Badge, Spinner, Toast (Sonner)
|
|
64
|
+
- **Data Display**: Avatar, Table, Tooltip
|
|
65
|
+
|
|
66
|
+
### Development Tools
|
|
67
|
+
|
|
68
|
+
- **ESLint** - Code linting with React and TypeScript rules
|
|
69
|
+
- **TypeScript** - Strict configuration for better code quality
|
|
70
|
+
- **Path Aliases** - Clean imports with `@/` prefix
|
|
71
|
+
- **Hot Reload** - Instant updates during development
|
|
72
|
+
|
|
73
|
+
## 🏗️ Project Structure
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
my-app/
|
|
77
|
+
├── public/
|
|
78
|
+
│ └── vite.svg
|
|
79
|
+
├── src/
|
|
80
|
+
│ ├── assets/
|
|
81
|
+
│ ├── components/
|
|
82
|
+
│ │ ├── ui/ # shadcn/ui components
|
|
83
|
+
│ │ ├── home-page-components/
|
|
84
|
+
│ │ └── admin-page-components/
|
|
85
|
+
│ ├── lib/
|
|
86
|
+
│ │ └── utils.ts # Utility functions
|
|
87
|
+
│ ├── pages/
|
|
88
|
+
│ │ ├── Homepage/
|
|
89
|
+
│ │ └── Dashboard/
|
|
90
|
+
│ ├── App.tsx # createBrowserRouter route shell
|
|
91
|
+
│ ├── main.tsx
|
|
92
|
+
│ └── global.css
|
|
93
|
+
├── components.json # shadcn/ui configuration
|
|
94
|
+
├── package.json
|
|
95
|
+
├── tsconfig.json
|
|
96
|
+
├── vite.config.ts
|
|
97
|
+
└── eslint.config.js
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 🚀 Getting Started
|
|
101
|
+
|
|
102
|
+
1. **Create your project**:
|
|
103
|
+
```bash
|
|
104
|
+
npx create-reactivite my-awesome-app
|
|
105
|
+
cd my-awesome-app
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. **Install dependencies** (automatically done):
|
|
109
|
+
```bash
|
|
110
|
+
pnpm install # or npm install
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. **Start development server**:
|
|
114
|
+
```bash
|
|
115
|
+
pnpm dev # or npm run dev
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
4. **Open your browser** and visit `http://localhost:5173`
|
|
119
|
+
|
|
120
|
+
## 📝 Available Scripts
|
|
121
|
+
|
|
122
|
+
- `pnpm dev` - Start development server
|
|
123
|
+
- `pnpm build` - Build for production
|
|
124
|
+
- `pnpm preview` - Preview production build
|
|
125
|
+
- `pnpm lint` - Run ESLint
|
|
126
|
+
|
|
127
|
+
## 🎨 Adding Components
|
|
128
|
+
|
|
129
|
+
This template uses shadcn/ui. To add new components:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npx shadcn@latest add button
|
|
133
|
+
npx shadcn@latest add input
|
|
134
|
+
npx shadcn@latest add form
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 🔧 Configuration
|
|
138
|
+
|
|
139
|
+
### Tailwind CSS
|
|
140
|
+
|
|
141
|
+
The project uses Tailwind CSS v4 with the new Vite plugin. Configuration is handled through CSS variables and the `components.json` file.
|
|
142
|
+
|
|
143
|
+
### TypeScript
|
|
144
|
+
|
|
145
|
+
Strict TypeScript configuration is included with path aliases:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { Button } from "@/components/ui/button"
|
|
149
|
+
import { utils } from "@/lib/utils"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### ESLint
|
|
153
|
+
|
|
154
|
+
Modern ESLint flat config with React and TypeScript support.
|
|
155
|
+
|
|
156
|
+
### Routing
|
|
157
|
+
|
|
158
|
+
Routes are defined in `App.tsx` via `createBrowserRouter` from **react-router** v7 (not `react-router-dom`). Add a page by creating it under `src/pages/<Name>/` and registering a route:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { createBrowserRouter } from "react-router"
|
|
162
|
+
|
|
163
|
+
const router = createBrowserRouter([
|
|
164
|
+
{ path: "/", element: <Homepage /> },
|
|
165
|
+
{ path: "/dashboard", element: <Dashboard /> },
|
|
166
|
+
])
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 🌙 Dark Mode
|
|
170
|
+
|
|
171
|
+
Dark mode is pre-configured using `next-themes`. Toggle between light and dark themes seamlessly.
|
|
172
|
+
|
|
173
|
+
## 📱 Responsive Design
|
|
174
|
+
|
|
175
|
+
All components are built with mobile-first responsive design principles using Tailwind CSS.
|
|
176
|
+
|
|
177
|
+
## 🤝 Contributing
|
|
178
|
+
|
|
179
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
180
|
+
|
|
181
|
+
## 📄 License
|
|
182
|
+
|
|
183
|
+
MIT License - feel free to use this template for your projects.
|
|
184
|
+
|
|
185
|
+
## 🔗 Links
|
|
186
|
+
|
|
187
|
+
- [React](https://react.dev/)
|
|
188
|
+
- [Vite](https://vite.dev/)
|
|
189
|
+
- [Tailwind CSS](https://tailwindcss.com/)
|
|
190
|
+
- [shadcn/ui](https://ui.shadcn.com/)
|
|
191
|
+
- [React Router](https://reactrouter.com/)
|
|
192
|
+
- [Recharts](https://recharts.org/)
|
|
193
|
+
- [TypeScript](https://www.typescriptlang.org/)
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
**Happy coding! 🎉**
|
package/index.js
CHANGED
|
@@ -54,6 +54,13 @@ const __dirname = path.dirname(__filename);
|
|
|
54
54
|
console.log("📦 Creating project...");
|
|
55
55
|
await copy(templatePath, targetPath);
|
|
56
56
|
|
|
57
|
+
// npm publish `.gitignore` faylını tarball-dan silir, ona görə
|
|
58
|
+
// template-də `_gitignore` saxlanılır və kopyadan sonra adı dəyişdirilir.
|
|
59
|
+
const gitignoreSrc = path.join(targetPath, "_gitignore");
|
|
60
|
+
if (fs.existsSync(gitignoreSrc)) {
|
|
61
|
+
fs.renameSync(gitignoreSrc, path.join(targetPath, ".gitignore"));
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
// 🧩 4. Asılılıqları quraşdırırıq
|
|
58
65
|
console.log("📥 Installing dependencies...");
|
|
59
66
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-reactivite",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "⚡ Effortlessly scaffold modern React + Vite + Tailwind CSS projects with a clean structure and ready-to-use configuration. Create Reactivite helps you instantly start new React apps with best practices, Shadcn/UI support, and zero setup hassle.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-reactivite": "./index.js"
|
package/template/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## React Compiler
|
|
11
|
-
|
|
12
|
-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
-
|
|
14
|
-
## Expanding the ESLint configuration
|
|
15
|
-
|
|
16
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
-
|
|
26
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
// eslint.config.js
|
|
50
|
-
import reactX from 'eslint-plugin-react-x'
|
|
51
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
-
|
|
53
|
-
export default defineConfig([
|
|
54
|
-
globalIgnores(['dist']),
|
|
55
|
-
{
|
|
56
|
-
files: ['**/*.{ts,tsx}'],
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
73
|
-
```
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
package/template/components.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "new-york",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true,
|
|
11
|
-
"prefix": ""
|
|
12
|
-
},
|
|
13
|
-
"iconLibrary": "lucide",
|
|
14
|
-
"aliases": {
|
|
15
|
-
"components": "@/components",
|
|
16
|
-
"utils": "@/lib/utils",
|
|
17
|
-
"ui": "@/components/ui",
|
|
18
|
-
"lib": "@/lib",
|
|
19
|
-
"hooks": "@/hooks"
|
|
20
|
-
},
|
|
21
|
-
"registries": {}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/index.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
-
|
|
8
|
-
export default defineConfig([
|
|
9
|
-
globalIgnores(['dist']),
|
|
10
|
-
{
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
extends: [
|
|
13
|
-
js.configs.recommended,
|
|
14
|
-
tseslint.configs.recommended,
|
|
15
|
-
reactHooks.configs['recommended-latest'],
|
|
16
|
-
reactRefresh.configs.vite,
|
|
17
|
-
],
|
|
18
|
-
languageOptions: {
|
|
19
|
-
ecmaVersion: 2020,
|
|
20
|
-
globals: globals.browser,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat['recommended-latest'],
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
// shadcn/ui components co-locate cva variant helpers with components.
|
|
25
|
+
files: ['src/components/ui/**/*.{ts,tsx}'],
|
|
26
|
+
rules: {
|
|
27
|
+
'react-refresh/only-export-components': 'off',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
])
|