@@ -213,6 +213,48 @@ const count = users.length; // Number - no useMemo
213
213
- Check for dynamic imports or require statements
214
214
3 . ** Delete the file** if it is not used anywhere in the codebase
215
215
216
+ ** CRITICAL: Files to NEVER delete**
217
+ Before proceeding with any file deletion, verify the file is NOT one of these protected types:
218
+
219
+ ** Configuration Files:**
220
+
221
+ - ` package.json ` , ` package-lock.json ` , ` pnpm-lock.yaml ` , ` yarn.lock `
222
+ - ` tsconfig.json ` , ` tsconfig.*.json `
223
+ - ` next.config.js ` , ` next.config.ts ` , ` next.config.mjs `
224
+ - ` tailwind.config.js ` , ` postcss.config.js ` , ` eslint.config.js `
225
+ - ` biome.json ` , ` .eslintrc.* ` , ` .prettierrc.* `
226
+ - ` vite.config.* ` , ` webpack.config.* ` , ` rollup.config.* `
227
+ - ` .env* ` , ` .env.local ` , ` .env.production ` , etc.
228
+ - ` nx.json ` , ` project.json ` , ` workspace.json `
229
+
230
+ ** Entry Point Files:**
231
+
232
+ - ` index.ts ` , ` index.tsx ` , ` index.js ` , ` index.jsx `
233
+ - ` main.ts ` , ` main.tsx ` , ` main.js ` , ` main.jsx `
234
+ - ` app.ts ` , ` app.tsx ` , ` app.js ` , ` app.jsx `
235
+ - ` server.ts ` , ` server.tsx ` , ` server.js ` , ` server.jsx `
236
+
237
+ ** Generated Files:**
238
+
239
+ - Files in ` _generated/ ` directories
240
+ - Files in ` node_modules/ ` directories
241
+ - Files in ` .next/ ` , ` dist/ ` , ` build/ ` , ` out/ ` directories
242
+ - Files with ` .d.ts ` extensions (TypeScript declaration files)
243
+ - Files in ` convex/_generated/ ` directories
244
+
245
+ ** Framework-Specific Files:**
246
+
247
+ - ` page.tsx ` , ` page.ts ` , ` page.js ` , ` page.jsx ` (Next.js App Router)
248
+ - ` layout.tsx ` , ` layout.ts ` , ` layout.js ` , ` layout.jsx ` (Next.js App Router)
249
+ - ` loading.tsx ` , ` loading.ts ` , ` loading.js ` , ` loading.jsx ` (Next.js App Router)
250
+ - ` error.tsx ` , ` error.ts ` , ` error.js ` , ` error.jsx ` (Next.js App Router)
251
+ - ` not-found.tsx ` , ` not-found.ts ` , ` not-found.js ` , ` not-found.jsx ` (Next.js App Router)
252
+ - ` route.ts ` , ` route.tsx ` , ` route.js ` , ` route.jsx ` (Next.js API routes)
253
+ - ` middleware.ts ` , ` middleware.js ` (Next.js middleware)
254
+ - ` manifest.ts ` , ` manifest.js ` (PWA manifests)
255
+ - ` sitemap.ts ` , ` sitemap.js ` (SEO files)
256
+ - ` robots.ts ` , ` robots.js ` (SEO files)
257
+
216
258
** Search commands to use:**
217
259
218
260
``` bash
@@ -236,17 +278,20 @@ grep -r "import(" . --exclude-dir=node_modules --exclude-dir=.git | grep "filena
236
278
- Verify that the file isn't used in build scripts or deployment configurations
237
279
- Ensure the file isn't referenced in documentation or README files
238
280
- Double-check that the file isn't used in test files or test configurations
281
+ - ** NEVER delete files in protected directories or with protected names**
239
282
240
283
** Checklist for unused file cleanup:**
241
284
242
285
- [ ] File name has been identified and understood
286
+ - [ ] ** VERIFIED file is NOT a protected configuration, entry point, generated, or framework file**
243
287
- [ ] Searched for exact file name references (without extension)
244
288
- [ ] Searched for full relative path references
245
289
- [ ] Searched for import statements referencing this file
246
290
- [ ] Searched for dynamic imports or require statements
247
291
- [ ] Checked configuration files for references
248
292
- [ ] Verified file is not used in build/deployment scripts
249
293
- [ ] Confirmed file is not referenced in documentation
294
+ - [ ] ** Double-checked that file is not in a protected directory or has a protected name**
250
295
- [ ] File has been safely deleted (if unused)
251
296
252
297
## Complete Example: Before and After
0 commit comments