[PR #155] [MERGED] feat: ban 'as any' type assertions and fix all violations #155

Closed
opened 2026-10-27 21:10:06 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/Comfy-PR/pull/155
Author: @comfy-pr-bot
Created: 2/6/2026
Status: ✅ Merged
Merged: 2/6/2026
Merged by: @comfy-pr-bot

Base: main ← Head: sno-bot


📝 Commits (2)

  • 2eda6e6 feat: ban 'as any' type assertions with enhanced type safety rules
  • 188c892 fix: replace all 'as any' type assertions with proper types

📊 Changes

88 files changed (+538 additions, -586 deletions)

View changed files

📝 .oxlintrc.json (+8 -2)
📝 app/(dashboard)/cnrepos/CNReposTableClient.tsx (+2 -2)
📝 app/(dashboard)/repos/page.tsx (+1 -1)
📝 app/(dashboard)/rules/[name]/RuleSetWhirler.tsx (+1 -1)
📝 app/(dashboard)/rules/page.tsx (+2 -2)
📝 app/api/router.ts (+3 -3)
📝 app/api/webhook/github/route.spec.ts (+7 -6)
📝 app/api/webhook/github/route.ts (+1 -1)
📝 app/api/webhook/github/webhook-events.ts (+1 -1)
📝 app/tasks/coreping/coreping.ts (+3 -3)
📝 app/tasks/gh-core-tag-notification/index.spec.ts (+27 -12)
📝 app/tasks/gh-design/GithubDesignTaskMetaEditor.tsx (+1 -1)
📝 app/tasks/gh-design/createTimeLogger.ts (+1 -1)
📝 app/tasks/gh-design/gh-design.ts (+1 -1)
📝 app/tasks/gh-desktop-release-notification/index.spec.ts (+26 -16)
📝 app/tasks/gh-frontend-release-notification/index.spec.ts (+23 -9)
📝 app/tasks/gh-issue-transfer-comfyui-to-frontend/index.spec.ts (+6 -6)
📝 app/tasks/gh-issue-transfer-comfyui-to-workflow_templates/index.spec.ts (+5 -5)
📝 app/tasks/gh-issue-transfer-desktop-to-frontend/index.spec.ts (+6 -6)
📝 app/tasks/gh-issue-transfer-frontend-to-comfyui/index.spec.ts (+6 -6)

...and 68 more files

📄 Description

Summary

Complete type safety improvement by banning as any type assertions and fixing all 311 violations across the codebase.

Changes

1. Enhanced Type Safety Rules (2eda6e6)

Updated .oxlintrc.json with strict type safety enforcement:

{
  "rules": {
    "typescript/no-explicit-any": "error",
    "typescript/no-unsafe-argument": "warn",
    "typescript/no-unsafe-assignment": "warn",
    "typescript/no-unsafe-call": "warn",
    "typescript/no-unsafe-member-access": "warn",
    "typescript/no-unsafe-return": "warn"
  }
}

2. Fixed All Violations (188c892)

Fixed 311 violations across 86 files:

Major Files

  • bot/slack-bot.ts (29 violations): Added proper Zod schemas for Slack events, blocks, attachments
  • packages/mongodb-pipeline-ts/$pipeline.ts (16 violations): Proper generic types
  • lib/slack/*.ts (30+ violations): Type-safe Slack API responses
  • src/*.ts (15+ violations): Proper types and Record<string, unknown> for dynamic objects
  • app/tasks/*.spec.ts (45+ violations): Type-safe test mocks

Common Fix Patterns

// ❌ Before
const data = response as any;
const result: any = getValue();
items.map((item: any) => ...)
catch (error: any) { }

// ✅ After  
const data = response as ResponseType;
const result: unknown = getValue();
items.map((item: ItemType) => ...)
catch (error: unknown) { }

Testing

  • ✅ All 311 violations fixed
  • ✅ Oxlint passes with 0 no-explicit-any errors
  • ✅ No build errors
  • ✅ Type safety enforced for new code

Verification

bunx oxlint . --quiet 2>&1 | grep "typescript-eslint(no-explicit-any)"
# Result: 0 violations

Impact

  • Type Safety: Prevents unsafe type assertions going forward
  • Code Quality: Better IntelliSense and type checking
  • Maintainability: Easier refactoring with proper types
  • No Breaking Changes: All changes are internal type improvements

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/Comfy-PR/pull/155 **Author:** [@comfy-pr-bot](https://github.com/comfy-pr-bot) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/6/2026 **Merged by:** [@comfy-pr-bot](https://github.com/comfy-pr-bot) **Base:** `main` ← **Head:** `sno-bot` --- ### 📝 Commits (2) - [`2eda6e6`](https://github.com/Comfy-Org/Comfy-PR/commit/2eda6e639f5eedc73dcb4c35c724b1c7df5194e1) feat: ban 'as any' type assertions with enhanced type safety rules - [`188c892`](https://github.com/Comfy-Org/Comfy-PR/commit/188c8922335e33702e530876510db6012d7363a0) fix: replace all 'as any' type assertions with proper types ### 📊 Changes **88 files changed** (+538 additions, -586 deletions) <details> <summary>View changed files</summary> 📝 `.oxlintrc.json` (+8 -2) 📝 `app/(dashboard)/cnrepos/CNReposTableClient.tsx` (+2 -2) 📝 `app/(dashboard)/repos/page.tsx` (+1 -1) 📝 `app/(dashboard)/rules/[name]/RuleSetWhirler.tsx` (+1 -1) 📝 `app/(dashboard)/rules/page.tsx` (+2 -2) 📝 `app/api/router.ts` (+3 -3) 📝 `app/api/webhook/github/route.spec.ts` (+7 -6) 📝 `app/api/webhook/github/route.ts` (+1 -1) 📝 `app/api/webhook/github/webhook-events.ts` (+1 -1) 📝 `app/tasks/coreping/coreping.ts` (+3 -3) 📝 `app/tasks/gh-core-tag-notification/index.spec.ts` (+27 -12) 📝 `app/tasks/gh-design/GithubDesignTaskMetaEditor.tsx` (+1 -1) 📝 `app/tasks/gh-design/createTimeLogger.ts` (+1 -1) 📝 `app/tasks/gh-design/gh-design.ts` (+1 -1) 📝 `app/tasks/gh-desktop-release-notification/index.spec.ts` (+26 -16) 📝 `app/tasks/gh-frontend-release-notification/index.spec.ts` (+23 -9) 📝 `app/tasks/gh-issue-transfer-comfyui-to-frontend/index.spec.ts` (+6 -6) 📝 `app/tasks/gh-issue-transfer-comfyui-to-workflow_templates/index.spec.ts` (+5 -5) 📝 `app/tasks/gh-issue-transfer-desktop-to-frontend/index.spec.ts` (+6 -6) 📝 `app/tasks/gh-issue-transfer-frontend-to-comfyui/index.spec.ts` (+6 -6) _...and 68 more files_ </details> ### 📄 Description ## Summary Complete type safety improvement by banning `as any` type assertions and fixing all 311 violations across the codebase. ## Changes ### 1. Enhanced Type Safety Rules (2eda6e6) Updated `.oxlintrc.json` with strict type safety enforcement: ```json { "rules": { "typescript/no-explicit-any": "error", "typescript/no-unsafe-argument": "warn", "typescript/no-unsafe-assignment": "warn", "typescript/no-unsafe-call": "warn", "typescript/no-unsafe-member-access": "warn", "typescript/no-unsafe-return": "warn" } } ``` ### 2. Fixed All Violations (188c892) **Fixed 311 violations across 86 files:** #### Major Files - `bot/slack-bot.ts` (29 violations): Added proper Zod schemas for Slack events, blocks, attachments - `packages/mongodb-pipeline-ts/$pipeline.ts` (16 violations): Proper generic types - `lib/slack/*.ts` (30+ violations): Type-safe Slack API responses - `src/*.ts` (15+ violations): Proper types and `Record<string, unknown>` for dynamic objects - `app/tasks/*.spec.ts` (45+ violations): Type-safe test mocks #### Common Fix Patterns ```typescript // ❌ Before const data = response as any; const result: any = getValue(); items.map((item: any) => ...) catch (error: any) { } // ✅ After const data = response as ResponseType; const result: unknown = getValue(); items.map((item: ItemType) => ...) catch (error: unknown) { } ``` ## Testing - ✅ All 311 violations fixed - ✅ Oxlint passes with 0 `no-explicit-any` errors - ✅ No build errors - ✅ Type safety enforced for new code ## Verification ```bash bunx oxlint . --quiet 2>&1 | grep "typescript-eslint(no-explicit-any)" # Result: 0 violations ``` ## Impact - **Type Safety**: Prevents unsafe type assertions going forward - **Code Quality**: Better IntelliSense and type checking - **Maintainability**: Easier refactoring with proper types - **No Breaking Changes**: All changes are internal type improvements --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 21:10:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/Comfy-PR#155
No description provided.