Skip to content

fix(studio): remove runtime ui ts-nocheck directives#27

Merged
iipanda merged 1 commit into
mainfrom
codex/remove-studio-runtime-ui-ts-nocheck
Apr 6, 2026
Merged

fix(studio): remove runtime ui ts-nocheck directives#27
iipanda merged 1 commit into
mainfrom
codex/remove-studio-runtime-ui-ts-nocheck

Conversation

@iipanda
Copy link
Copy Markdown
Collaborator

@iipanda iipanda commented Apr 6, 2026

Summary

  • remove all @ts-nocheck directives from packages/studio/src/lib/runtime-ui
  • add explicit .js relative ESM imports required by the Studio runtime UI under nodenext
  • fix the remaining real type issues in shared UI helpers, mock data, editor callbacks, and the stylesheet test harness

Test Plan

  • bun x --bun tsc --project packages/studio/tsconfig.lib.json --noEmit
  • bun test packages/studio/src
  • bun run typecheck

Summary by CodeRabbit

  • Refactor
    • Enabled comprehensive TypeScript type-checking across the studio codebase to improve code reliability and catch potential errors earlier.
    • Modernized module import patterns for better consistency and alignment with modern development standards.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mdcms-studio-review Ready Ready Preview, Comment Apr 6, 2026 1:22am

Request Review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

This PR systematically removes TypeScript suppression directives (// @ts-nocheck``) across the studio runtime-ui package and updates all relative imports to use explicit .js file extensions for ESM module resolution. A few files receive targeted type improvements and structural adjustments.

Changes

Cohort / File(s) Summary
Admin Pages
admin/api-page.tsx, admin/content/[type]/page.tsx, admin/content/page.tsx, admin/login-page.tsx, admin/media-page.tsx, admin/page.tsx, admin/trash-page.tsx, admin/workflows-page.tsx
Removed // @ts-nocheck``, updated imports to use .js extensions. Removed unused `DashboardData` type from admin/page.tsx. No functional changes to rendering or exports.
Environments & Settings
admin/environments-page.tsx, admin/settings-page.tsx
Removed // @ts-nocheck`` and updated imports with .js extensions. In environments-page, introduced `EnvironmentCard` type with `environmentColorMap`, `initialEnvironments` data transformation, and updated state initialization. In settings-page, removed unused `showSecret` state and unused Lucide icon imports (`Eye`, `EyeOff`, `Trash2`).
Users & Admin Layout
admin/users-page.tsx, admin/layout.tsx
Removed // @ts-nocheck``, updated imports to .js extensions. No functional changes.
UI Components
components/ui/avatar.tsx, components/ui/badge.tsx, components/ui/button.tsx, components/ui/calendar.tsx, components/ui/card.tsx, components/ui/checkbox.tsx, components/ui/collapsible.tsx, components/ui/dropdown-menu.tsx, components/ui/input.tsx, components/ui/label.tsx, components/ui/pagination.tsx, components/ui/popover.tsx, components/ui/scroll-area.tsx, components/ui/select.tsx, components/ui/separator.tsx, components/ui/switch.tsx, components/ui/table.tsx, components/ui/tabs.tsx, components/ui/textarea.tsx, components/ui/tooltip.tsx
Removed // @ts-nocheck`` and updated cn utility import paths to `.js` extensions. No logic changes.
Layout & Core Components
components/layout/app-sidebar.tsx, components/layout/page-header.tsx, components/coming-soon.tsx, components/mdcms-logo.tsx
Removed // @ts-nocheck`` and updated imports to .js extensions. In page-header.tsx, made `children` optional in `PageTitleSectionProps`. In app-sidebar.tsx, changed list item key from `item.href` to `item.label`.
Editor Components
components/editor/editor-sidebar.tsx, components/editor/tiptap-editor.tsx
Removed // @ts-nocheck`` and updated imports to .js extensions. In tiptap-editor.tsx, added explicit typing for `TipTap` editor callbacks: introduced `TipTapEditorInstance` type and annotated `handleEditorUpdate`, `syncSlashTrigger`, `publishSelectedMdxComponent` with proper return types. Removed unused `MdxComponentKind` type import.
Utilities & Mock Data
lib/utils.ts, lib/mock-data.ts, pages/content-page.tsx, pages/content-type-page.tsx
Removed // @ts-nocheck`` and updated imports to .js extensions. In mock-data.ts, added `body` field to `mockDeletedDocuments` entries using `createMockDocumentBody()`. No signature changes.
Test Files
style-installer.test.ts
Removed // @ts-nocheck`` and refactored fake DOM type definitions to derive from the actual installStudioRuntimeStyles function's expected types (`RuntimeStylesheetDocument`, `RuntimeStylesheetNode`) instead of hand-authored types. Updated `FakeLinkNode` and `FakeHeadNode` type definitions and their runtime implementations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

v0

Poem

🐰 Whiskers twitching with TypeScript delight,
We banish the @ts-nocheck blight,
With .js paths so clear and so bright,
Type safety hops in, everything's right!
No more suppression—just proper code sight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: removing all @ts-nocheck directives from the runtime UI codebase and adding explicit .js imports, which is the primary objective across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/remove-studio-runtime-ui-ts-nocheck

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx (1)

86-100: ⚠️ Potential issue | 🟡 Minor

Trim and normalize the slug before persisting it.

The current guard accepts whitespace-only values, and the raw slug can be stored with spaces or mixed casing even though it is rendered as a path segment. Normalizing before the early return keeps the created environment identifiers usable.

Suggested fix
   const handleCreateEnvironment = () => {
-    if (!newEnv.name || !newEnv.slug) return;
+    const name = newEnv.name.trim();
+    const slug = newEnv.slug.trim().toLowerCase().replace(/\s+/g, "-");
+
+    if (!name || !slug) return;
 
     const env: EnvironmentCard = {
       id: `env-${Date.now()}`,
-      name: newEnv.name,
-      slug: newEnv.slug,
-      description: newEnv.description,
+      name,
+      slug,
+      description: newEnv.description.trim(),
       isProduction: false,
       color: "#6b7280",
       documentCount: 0,
       lastPublished: null,
     };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx` around
lines 86 - 100, The slug is not being normalized or trimmed before validation
and persistence in handleCreateEnvironment, which allows whitespace-only or
improperly-cased slugs to be accepted; trim and normalize newEnv.slug (e.g.,
const normalized = newEnv.slug.trim().toLowerCase().replace(/\s+/g,
"-").replace(/[^a-z0-9-_.]/g, "").replace(/-+/g, "-").replace(/(^-+|-+$)/g,
"")), use the normalized value for the early return check (if (!newEnv.name ||
!normalized) return;), and assign env.slug = normalized before calling
setEnvironments([...environments, env]); reference newEnv, env,
handleCreateEnvironment, and setEnvironments when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx`:
- Around line 86-100: The slug is not being normalized or trimmed before
validation and persistence in handleCreateEnvironment, which allows
whitespace-only or improperly-cased slugs to be accepted; trim and normalize
newEnv.slug (e.g., const normalized =
newEnv.slug.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_.]/g,
"").replace(/-+/g, "-").replace(/(^-+|-+$)/g, "")), use the normalized value for
the early return check (if (!newEnv.name || !normalized) return;), and assign
env.slug = normalized before calling setEnvironments([...environments, env]);
reference newEnv, env, handleCreateEnvironment, and setEnvironments when making
the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eec96120-2e7a-4002-be28-4f8c411b38be

📥 Commits

Reviewing files that changed from the base of the PR and between e8cd1eb and 9b3466c.

📒 Files selected for processing (43)
  • packages/studio/src/lib/runtime-ui/app/admin/api-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/content/[type]/page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/content/page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/environments-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/layout.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/login-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/media-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/settings-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/trash-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/users-page.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/workflows-page.tsx
  • packages/studio/src/lib/runtime-ui/components/coming-soon.tsx
  • packages/studio/src/lib/runtime-ui/components/editor/editor-sidebar.tsx
  • packages/studio/src/lib/runtime-ui/components/editor/tiptap-editor.tsx
  • packages/studio/src/lib/runtime-ui/components/layout/app-sidebar.tsx
  • packages/studio/src/lib/runtime-ui/components/layout/page-header.tsx
  • packages/studio/src/lib/runtime-ui/components/mdcms-logo.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/avatar.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/badge.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/button.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/calendar.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/card.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/checkbox.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/collapsible.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/dropdown-menu.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/input.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/label.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/pagination.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/popover.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/scroll-area.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/select.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/separator.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/switch.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/table.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/tabs.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/textarea.tsx
  • packages/studio/src/lib/runtime-ui/components/ui/tooltip.tsx
  • packages/studio/src/lib/runtime-ui/lib/mock-data.ts
  • packages/studio/src/lib/runtime-ui/lib/utils.ts
  • packages/studio/src/lib/runtime-ui/pages/content-page.tsx
  • packages/studio/src/lib/runtime-ui/pages/content-type-page.tsx
  • packages/studio/src/lib/runtime-ui/style-installer.test.ts
💤 Files with no reviewable changes (3)
  • packages/studio/src/lib/runtime-ui/lib/utils.ts
  • packages/studio/src/lib/runtime-ui/components/ui/collapsible.tsx
  • packages/studio/src/lib/runtime-ui/app/admin/page.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant