antigravity-devkit 1.0.1 → 1.0.2
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/package.json
CHANGED
|
@@ -118,3 +118,5 @@ public class ApiResponse<T>
|
|
|
118
118
|
| Async/await | Blocking calls |
|
|
119
119
|
| DI everywhere | `new` in controllers |
|
|
120
120
|
| Proper status codes | 200 for everything |
|
|
121
|
+
| Constants/Enums for strings | Magic strings |
|
|
122
|
+
| Environment variables/Config | Hardcoded settings |
|
|
@@ -105,6 +105,44 @@ catch (Exception ex)
|
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
108
|
+
## Constants & Enums
|
|
109
|
+
|
|
110
|
+
```csharp
|
|
111
|
+
// ✅ Correct: Use enums for types
|
|
112
|
+
public enum UserStatus
|
|
113
|
+
{
|
|
114
|
+
Active,
|
|
115
|
+
Inactive,
|
|
116
|
+
Suspended
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ✅ Correct: Use constants for reusable strings
|
|
120
|
+
public static class AppConstants
|
|
121
|
+
{
|
|
122
|
+
public const string DefaultLanguage = "en-US";
|
|
123
|
+
public const string ApiVersion = "v1";
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Configuration Management
|
|
130
|
+
|
|
131
|
+
```csharp
|
|
132
|
+
// ✅ Correct: Use IConfiguration or environment variables
|
|
133
|
+
public class MyService
|
|
134
|
+
{
|
|
135
|
+
private readonly string _apiKey;
|
|
136
|
+
|
|
137
|
+
public MyService(IConfiguration config)
|
|
138
|
+
{
|
|
139
|
+
_apiKey = config["ApiSettings:Key"] ?? throw new ArgumentNullException("API Key is missing");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
108
146
|
## DO / DON'T
|
|
109
147
|
|
|
110
148
|
| ✅ Do | ❌ Don't |
|
|
@@ -113,3 +151,5 @@ catch (Exception ex)
|
|
|
113
151
|
| Nullable types | Ignore null warnings |
|
|
114
152
|
| Records for DTOs | Mutable classes |
|
|
115
153
|
| Pattern matching | Long if-else chains |
|
|
154
|
+
| Constants/Enums for strings | Magic strings |
|
|
155
|
+
| Environment variables/Config | Hardcoded settings |
|
|
@@ -183,6 +183,44 @@ module.exports = {
|
|
|
183
183
|
|
|
184
184
|
---
|
|
185
185
|
|
|
186
|
+
## Constants & Enums
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// ✅ Correct: constants/auth.ts
|
|
190
|
+
export enum UserRole {
|
|
191
|
+
ADMIN = 'admin',
|
|
192
|
+
USER = 'user'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const API_ENDPOINTS = {
|
|
196
|
+
LOGIN: '/auth/login',
|
|
197
|
+
LOGOUT: '/auth/logout'
|
|
198
|
+
} as const;
|
|
199
|
+
|
|
200
|
+
// Usage
|
|
201
|
+
if (role === UserRole.ADMIN) { ... }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Configuration Management
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# ✅ Correct: .env
|
|
210
|
+
VITE_API_URL=https://api.example.com
|
|
211
|
+
VITE_ENABLE_ANALYTICS=true
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// src/config.ts
|
|
216
|
+
export const config = {
|
|
217
|
+
apiUrl: import.meta.env.VITE_API_URL,
|
|
218
|
+
enableAnalytics: import.meta.env.VITE_ENABLE_ANALYTICS === 'true'
|
|
219
|
+
} as const;
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
186
224
|
## DO / DON'T
|
|
187
225
|
|
|
188
226
|
| Do | Don't |
|
|
@@ -193,3 +231,5 @@ module.exports = {
|
|
|
193
231
|
| Tailwind utilities | Inline styles |
|
|
194
232
|
| Custom Tailwind config | Default colors only |
|
|
195
233
|
| Small components | Giant components |
|
|
234
|
+
| Constants/Enums for strings | Magic strings |
|
|
235
|
+
| Env files for config | Hardcoded config |
|