# Testing Checklist - Deprecation Fixes & ESLint 9 Migration

**Date**: 2024-12-28  
**Purpose**: Comprehensive testing checklist for all deprecation fixes and ESLint 9 migration

---

## ✅ Pre-Testing Verification

### 1. Dependency Installation
- [ ] Run `pnpm install` - should complete without errors
- [ ] Check for remaining warnings: `pnpm install 2>&1 | grep -i "WARN"`
- [ ] Verify no `@types/pino` warnings
- [ ] Verify no `eslint@8` warnings
- [ ] Only subdependency warnings should remain (9 packages, informational only)

### 2. Package Versions Verification
- [ ] ESLint: `pnpm list eslint` shows `9.17.0+` in all packages
- [ ] TypeScript ESLint: `pnpm list typescript-eslint` shows `8.18.0+`
- [ ] Pino: `pnpm list pino` shows `8.17.2` (no @types/pino)

---

## 🧪 Testing Phases

### Phase 1: Linting Tests

#### 1.1 Root Level Linting
- [ ] Run `pnpm lint` from root
- [ ] Verify all packages lint successfully
- [ ] Check for ESLint errors or warnings
- [ ] Verify flat config is being used

#### 1.2 Service Linting
- [ ] `pnpm --filter @the-order/identity lint`
- [ ] `pnpm --filter @the-order/finance lint`
- [ ] `pnpm --filter @the-order/dataroom lint`
- [ ] `pnpm --filter @the-order/intake lint`

#### 1.3 Package Linting
- [ ] `pnpm --filter @the-order/shared lint`
- [ ] `pnpm --filter @the-order/auth lint`
- [ ] `pnpm --filter @the-order/crypto lint`
- [ ] `pnpm --filter @the-order/storage lint`
- [ ] `pnpm --filter @the-order/database lint`
- [ ] `pnpm --filter @the-order/workflows lint`
- [ ] `pnpm --filter @the-order/schemas lint`
- [ ] `pnpm --filter @the-order/test-utils lint`
- [ ] `pnpm --filter @the-order/monitoring lint`
- [ ] `pnpm --filter @the-order/payment-gateway lint`
- [ ] `pnpm --filter @the-order/ocr lint`

#### 1.4 App Linting
- [ ] `pnpm --filter @the-order/portal-public lint`
- [ ] `pnpm --filter @the-order/portal-internal lint`
- [ ] `pnpm --filter @the-order/mcp-legal lint`
- [ ] `pnpm --filter @the-order/mcp-members lint`

#### 1.5 Next.js Specific Linting
- [ ] `pnpm --filter @the-order/portal-public lint` (Next.js)
- [ ] `pnpm --filter @the-order/portal-internal lint` (Next.js)
- [ ] Verify `next lint` works with ESLint 9

---

### Phase 2: TypeScript Compilation Tests

#### 2.1 Root Level Type Check
- [ ] Run `pnpm type-check` from root
- [ ] Verify all packages type-check successfully
- [ ] Check for TypeScript errors

#### 2.2 Service Type Checking
- [ ] `pnpm --filter @the-order/identity type-check`
- [ ] `pnpm --filter @the-order/finance type-check`
- [ ] `pnpm --filter @the-order/dataroom type-check`
- [ ] `pnpm --filter @the-order/intake type-check`

#### 2.3 Package Type Checking
- [ ] `pnpm --filter @the-order/shared type-check`
- [ ] `pnpm --filter @the-order/auth type-check`
- [ ] `pnpm --filter @the-order/crypto type-check`
- [ ] `pnpm --filter @the-order/storage type-check`
- [ ] `pnpm --filter @the-order/database type-check`
- [ ] `pnpm --filter @the-order/workflows type-check`
- [ ] `pnpm --filter @the-order/schemas type-check`
- [ ] `pnpm --filter @the-order/test-utils type-check`
- [ ] `pnpm --filter @the-order/monitoring type-check`
- [ ] `pnpm --filter @the-order/payment-gateway type-check`
- [ ] `pnpm --filter @the-order/ocr type-check`

---

### Phase 3: Build Tests

#### 3.1 Root Level Build
- [ ] Run `pnpm build` from root
- [ ] Verify all packages build successfully
- [ ] Check for build errors

#### 3.2 Service Builds
- [ ] `pnpm --filter @the-order/identity build`
- [ ] `pnpm --filter @the-order/finance build`
- [ ] `pnpm --filter @the-order/dataroom build`
- [ ] `pnpm --filter @the-order/intake build`

#### 3.3 Package Builds
- [ ] `pnpm --filter @the-order/shared build`
- [ ] `pnpm --filter @the-order/auth build`
- [ ] `pnpm --filter @the-order/crypto build`
- [ ] `pnpm --filter @the-order/storage build`
- [ ] `pnpm --filter @the-order/database build`
- [ ] `pnpm --filter @the-order/workflows build`
- [ ] `pnpm --filter @the-order/schemas build`
- [ ] `pnpm --filter @the-order/test-utils build`
- [ ] `pnpm --filter @the-order/monitoring build`
- [ ] `pnpm --filter @the-order/payment-gateway build`
- [ ] `pnpm --filter @the-order/ocr build`

#### 3.4 App Builds
- [ ] `pnpm --filter @the-order/portal-public build`
- [ ] `pnpm --filter @the-order/portal-internal build`
- [ ] `pnpm --filter @the-order/mcp-legal build`
- [ ] `pnpm --filter @the-order/mcp-members build`

---

### Phase 4: Test Execution

#### 4.1 Unit Tests
- [ ] Run `pnpm test` from root
- [ ] Verify all unit tests pass
- [ ] Check test coverage

#### 4.2 Service Tests
- [ ] `pnpm --filter @the-order/identity test`
- [ ] `pnpm --filter @the-order/finance test`
- [ ] `pnpm --filter @the-order/dataroom test`
- [ ] `pnpm --filter @the-order/intake test`

#### 4.3 Package Tests
- [ ] `pnpm --filter @the-order/shared test`
- [ ] `pnpm --filter @the-order/auth test`
- [ ] `pnpm --filter @the-order/crypto test`
- [ ] `pnpm --filter @the-order/storage test`
- [ ] `pnpm --filter @the-order/database test`
- [ ] `pnpm --filter @the-order/workflows test`
- [ ] `pnpm --filter @the-order/schemas test`
- [ ] `pnpm --filter @the-order/test-utils test`

---

### Phase 5: Git Hooks & Pre-commit

#### 5.1 Pre-commit Hook Testing
- [ ] Make a test commit with linting errors - should be caught
- [ ] Make a test commit with formatting issues - should be fixed
- [ ] Verify `lint-staged` works with ESLint 9
- [ ] Verify Prettier integration works

#### 5.2 Lint-staged Configuration
- [ ] Test TypeScript file linting
- [ ] Test JSON file formatting
- [ ] Test Markdown file formatting
- [ ] Test YAML file formatting

---

### Phase 6: CI/CD Pipeline Tests

#### 6.1 GitHub Actions
- [ ] Verify `.github/workflows/ci.yml` runs successfully
- [ ] Check lint job passes
- [ ] Check type-check job passes
- [ ] Check test job passes
- [ ] Check build job passes

#### 6.2 Local CI Simulation
- [ ] Run all CI commands locally:
  ```bash
  pnpm install
  pnpm lint
  pnpm type-check
  pnpm test
  pnpm build
  ```

---

### Phase 7: ESLint Configuration Tests

#### 7.1 Flat Config Verification
- [ ] Verify `eslint.config.js` is being used
- [ ] Test that old `.eslintrc.js` is ignored (if still present)
- [ ] Verify all rules are applied correctly
- [ ] Test rule overrides work

#### 7.2 Plugin Compatibility
- [ ] Verify `@typescript-eslint` plugins work
- [ ] Verify `eslint-plugin-security` works
- [ ] Verify `eslint-plugin-sonarjs` works
- [ ] Verify `eslint-config-prettier` works

#### 7.3 Type Checking Rules
- [ ] Verify type-checking rules work (`no-floating-promises`, `await-thenable`)
- [ ] Test with actual TypeScript code
- [ ] Verify project references work

---

### Phase 8: Integration Tests

#### 8.1 Service Integration
- [ ] Test Identity service endpoints
- [ ] Test Finance service endpoints
- [ ] Test Dataroom service endpoints
- [ ] Test Intake service endpoints

#### 8.2 Database Integration
- [ ] Test database connections
- [ ] Test database operations
- [ ] Test migrations

#### 8.3 External Service Integration
- [ ] Test Storage (S3) operations
- [ ] Test KMS operations
- [ ] Test Payment Gateway (if configured)
- [ ] Test OCR service (if configured)

---

### Phase 9: Performance Tests

#### 9.1 Linting Performance
- [ ] Measure lint time: `time pnpm lint`
- [ ] Compare with previous ESLint 8 performance
- [ ] Verify no significant slowdown

#### 9.2 Build Performance
- [ ] Measure build time: `time pnpm build`
- [ ] Verify no significant slowdown

---

### Phase 10: Documentation & Cleanup

#### 10.1 Documentation
- [ ] Update README with ESLint 9 information
- [ ] Document flat config format
- [ ] Update contributing guide if needed

#### 10.2 Cleanup
- [ ] Remove old `.eslintrc.js` (after verification)
- [ ] Remove any ESLint 8 references
- [ ] Clean up unused dependencies

---

## 🐛 Known Issues & Workarounds

### Issue 1: Next.js ESLint Compatibility
**Status**: Testing required  
**Action**: Verify `next lint` works with ESLint 9

### Issue 2: TypeScript ESLint Project References
**Status**: Testing required  
**Action**: Verify `project: './tsconfig.json'` works correctly

### Issue 3: Lint-staged with Flat Config
**Status**: Testing required  
**Action**: Verify lint-staged can use ESLint 9 flat config

---

## 📊 Test Results Template

```
## Test Results - [Date]

### Linting
- Root: ✅ / ❌
- Services: ✅ / ❌
- Packages: ✅ / ❌
- Apps: ✅ / ❌

### Type Checking
- Root: ✅ / ❌
- All packages: ✅ / ❌

### Builds
- Root: ✅ / ❌
- All packages: ✅ / ❌

### Tests
- Unit tests: ✅ / ❌
- Integration tests: ✅ / ❌

### Git Hooks
- Pre-commit: ✅ / ❌
- Lint-staged: ✅ / ❌

### CI/CD
- GitHub Actions: ✅ / ❌

### Issues Found
- [List any issues]

### Warnings Remaining
- [List remaining warnings]
```

---

## ✅ Success Criteria

All tests pass when:
- ✅ All linting passes
- ✅ All type checks pass
- ✅ All builds succeed
- ✅ All tests pass
- ✅ Git hooks work
- ✅ CI/CD pipelines pass
- ✅ No critical warnings
- ✅ Performance is acceptable

---

## 🚀 Quick Test Commands

```bash
# Full test suite
pnpm install && pnpm lint && pnpm type-check && pnpm test && pnpm build

# Individual package test
pnpm --filter @the-order/identity lint type-check test build

# Verify warnings
pnpm install 2>&1 | grep -i "WARN" | grep -v "subdependencies"
```

---

## 📝 Notes

- ESLint 9 uses flat config format (ES modules)
- Old `.eslintrc.js` can be kept for reference during migration
- Next.js apps may need special ESLint configuration
- Some packages may need package-specific ESLint configs

