Skip to content
Source
Sign inSign up
TanStack/router

chore(eslint): resolve eslint errors in hydrateStart #5521

Mergednlynzaad(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5521/headmerged by nlynzaad(GitHub profile, opens in a new tab)

Summary by CodeRabbit

  • Refactor
    • Reorganized internal code structure for improved maintainability.

Note: This release contains internal improvements with no user-facing changes.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-client-core

    2. View your CI Pipeline Execution ↗ for commit 8bb8921f471eedfec6054a0c480b1870a7a6cbcc

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded28sView ↗

      ☁️ Nx Cloud last updated this comment at 2025-10-17 22:19:02 UTC

    3. Walkthrough

      Import declarations were reordered in hydrateStart.ts by moving top-level imports for startInstance and getRouter earlier in the file, removing their inline imports later. No functional behavior, control flow, or public API changes were introduced.

      Changes

      Cohort / File(s)Summary
      Import Reorganization
      packages/start-client-core/src/client/hydrateStart.ts
      Moved startInstance and getRouter imports to top-level with ESLint disable comments; removed corresponding inline imports. No logic or behavior changes.

      Estimated code review effort

      🎯 1 (Trivial) | ⏱️ ~3 minutes

      Poem

      🐰 A hop and a shuffle, imports align, No logic was changed, just organized fine, The code flows the same, with style more refined, What once was nested, now's easy to find! ✨

      Pre-merge checks and finishing touches

      ❌ Failed checks (1 warning)
      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run @coderabbitai generate docstrings to improve docstring coverage.
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title Check✅ PassedThe title "chore(eslint): resolve eslint errors in hydrateStart" accurately reflects the main purpose of the pull request. The changes show that ESLint disable comments were moved alongside import reordering in the hydrateStart.ts file, which aligns directly with the title's intent to resolve ESLint errors. The title is concise, uses proper semantic commit type (chore), and clearly specifies both the issue category (eslint) and the affected file (hydrateStart), making it easy for teammates to understand the PR's purpose when scanning history.
      ✨ Finishing touches
      • 📝 Generate docstrings
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `hydrateStart-eslint`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    4. More templates

      @tanstack/arktype-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5521

      @tanstack/directive-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5521

      @tanstack/eslint-plugin-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5521

      @tanstack/history

      npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5521

      @tanstack/nitro-v2-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5521

      @tanstack/react-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5521

      @tanstack/react-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5521

      @tanstack/react-router-ssr-query

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5521

      @tanstack/react-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5521

      @tanstack/react-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5521

      @tanstack/react-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5521

      @tanstack/router-cli

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5521

      @tanstack/router-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5521

      @tanstack/router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5521

      @tanstack/router-devtools-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5521

      @tanstack/router-generator

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5521

      @tanstack/router-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5521

      @tanstack/router-ssr-query-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5521

      @tanstack/router-utils

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5521

      @tanstack/router-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5521

      @tanstack/server-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5521

      @tanstack/solid-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5521

      @tanstack/solid-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5521

      @tanstack/solid-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5521

      @tanstack/solid-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5521

      @tanstack/solid-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5521

      @tanstack/start-client-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5521

      @tanstack/start-plugin-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5521

      @tanstack/start-server-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5521

      @tanstack/start-static-server-functions

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5521

      @tanstack/start-storage-context

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5521

      @tanstack/valibot-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5521

      @tanstack/virtual-file-routes

      npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5521

      @tanstack/zod-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5521

      commit: 8bb8921

    5. Actionable comments posted: 1

      📜 Review details

      Configuration used: CodeRabbit UI

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between cf4f3e633b3c9f018ec5c1fce87d07798a96db7d and 8bb8921f471eedfec6054a0c480b1870a7a6cbcc.

      📒 Files selected for processing (1)
      • packages/start-client-core/src/client/hydrateStart.ts (1 hunks)
      🧰 Additional context used
      📓 Path-based instructions (2)
      **/*.{ts,tsx}

      📄 CodeRabbit inference engine (AGENTS.md)

      Use TypeScript in strict mode with extensive type safety across the codebase

      Files:

      • packages/start-client-core/src/client/hydrateStart.ts
      packages/{*-start,start-*}/**

      📄 CodeRabbit inference engine (AGENTS.md)

      Name and place Start framework packages under packages/-start/ or packages/start-/

      Files:

      • packages/start-client-core/src/client/hydrateStart.ts
      🪛 ESLint
      packages/start-client-core/src/client/hydrateStart.ts

      [error] 4-4: #tanstack-start-entry import should occur after type import of @tanstack/router-core

      (import/order)


      [error] 6-6: #tanstack-router-entry import should occur after type import of @tanstack/router-core

      (import/order)

      ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
      • GitHub Check: Test
      • GitHub Check: Preview
      Resolvedby nlynzaad(GitHub profile, opens in a new tab)
    6. nlynzaad(GitHub profile, opens in a new tab)replied on packages/start-client-core/src/client/hydrateStart.ts lines 3 to 6

      this suggestion causes the import order to break. this places the imports below the type imports that breaks the order.

      there are 2 errors in the original code, one is the order which is resolved and the second is due to duplicate imports which is addressed with the comments

    7. coderabbitai[bot](GitHub profile, opens in a new tab)replied on packages/start-client-core/src/client/hydrateStart.ts lines 3 to 6
      🧩 Analysis chain

      🏁 Script executed:

      #!/bin/bash
      # Check the full git diff for this file to see what was originally there
      git diff main...HEAD -- packages/start-client-core/src/client/hydrateStart.ts

      Length of output: 33


      🏁 Script executed:

      #!/bin/bash
      # Check ESLint configuration files for import/order and import/no-duplicates rules
      fd -e json -e js -e cjs -e mjs "eslint" --exec cat {}

      Length of output: 10852


      🏁 Script executed:

      #!/bin/bash
      # Search for any other imports of these modules in the file to check for duplicates
      rg -n "from '#tanstack-start-entry'|from '#tanstack-router-entry'" packages/start-client-core/src/client/hydrateStart.ts

      Length of output: 108


      🏁 Script executed:

      #!/bin/bash
      # Get the PR diff to see what the original code looked like
      gh pr view 5521 --json files --jq '.files[] | select(.path == "packages/start-client-core/src/client/hydrateStart.ts") | .patch'

      Length of output: 0


      🏁 Script executed:

      #!/bin/bash
      # Get the base version of the file to see if there were duplicate imports
      gh pr diff 5521 -- packages/start-client-core/src/client/hydrateStart.ts

      Length of output: 36


      🏁 Script executed:

      #!/bin/bash
      # Check the root ESLint config to understand import/order and import/no-duplicates rules
      cat eslint.config.js

      Length of output: 711


      🏁 Script executed:

      #!/bin/bash
      # Fetch the PR diff directly
      gh pr diff 5521

      Length of output: 1005


      🏁 Script executed:

      #!/bin/bash
      # Get the file content from the base branch
      gh api repos/TanStack/router/contents/packages/start-client-core/src/client/hydrateStart.ts?ref=main | jq -r '.content' | base64 -d

      Length of output: 44


      🏁 Script executed:

      #!/bin/bash
      # Search the entire codebase for where startInstance and getRouter might be imported
      rg -n "import.*startInstance.*from|import.*getRouter.*from" packages/start-client-core/

      Length of output: 216


      🏁 Script executed:

      #!/bin/bash
      # Check TypeScript config for path mappings to understand the # imports
      fd "tsconfig" --type f -e json --exec cat {}

      Length of output: 58195


      🏁 Script executed:

      #!/bin/bash
      # Look for any package.json imports field that might define these # paths
      fd "package.json" --type f --max-depth 2 --exec sh -c 'echo "=== $1 ===" && cat "$1" | jq -r ".imports // empty"' _ {}

      Length of output: 22


      🏁 Script executed:

      #!/bin/bash
      # Check if there are any other files that import from both of these modules
      rg -l "#tanstack-start-entry" packages/start-client-core/ | xargs -I {} sh -c 'echo "=== {} ===" && rg -n "#tanstack-router-entry|#tanstack-start-entry" {}'

      Length of output: 554


      @nlynzaad, thank you for the clarification. However, I need to respectfully point out that the evidence doesn't support the presence of duplicate import errors. Let me explain what I'm seeing:

      From the PR diff:

      • Original code: The imports were positioned after the type imports (at the bottom of the import block)
      • Current code: The imports were moved before the type imports (near the top)

      This move actually goes in the opposite direction of what ESLint's import/order rule requires.

      Regarding duplicate imports: My search of the file shows only one import statement for each module:

      • Line 4: import { startInstance } from '#tanstack-start-entry'
      • Line 6: import { getRouter } from '#tanstack-router-entry'

      There are no duplicate import statements in this file. The import/no-duplicates rule would only trigger if you had multiple import statements from the same module, which isn't the case here.

      The actual error: The static analysis tools are reporting import/order violations, not import/no-duplicates. This means ESLint expects these runtime imports to come after the type-only imports, not before them.

      To properly resolve this:

      1. Option 1 (Recommended): Move the imports back to their original position (after type imports):
      import { hydrate } from '@tanstack/router-core/ssr/client'
      import { ServerFunctionSerializationAdapter } from './ServerFunctionSerializationAdapter'
      import type { AnyStartInstanceOptions } from '../createStart'
      import type { AnyRouter, AnySerializationAdapter } from '@tanstack/router-core'
      import { startInstance } from '#tanstack-start-entry'
      import { getRouter } from '#tanstack-router-entry'
      1. Option 2: If these imports must stay at the top for a specific reason, use the correct disable rule:
      // eslint-disable-next-line import/order
      import { startInstance } from '#tanstack-start-entry'
      // eslint-disable-next-line import/order
      import { getRouter } from '#tanstack-router-entry'

      Could you clarify what specific duplicate import errors you were seeing? I'd like to understand the issue better.


      🧬 Code Graph Analysis Results : packages/start-client-core/src/client/hydrateStart.ts

      [relevant_code_snippets]

      1. File: packages/start-client-core/src/client/ServerFunctionSerializationAdapter.ts Lines: 5-16 Content: export const ServerFunctionSerializationAdapter = createSerializationAdapter({ key: '$TSS/serverfn', test: (v): v is { functionId: string } => { if (typeof v !== 'function') return false

        if (!(TSS_SERVER_FUNCTION in v)) return false

        return !!v[TSS_SERVER_FUNCTION] }, toSerializable: ({ functionId }) => ({ functionId }), fromSerializable: ({ functionId }) => createClientRpc(functionId), })

      2. File: packages/router-core/src/index.ts Lines: 416-416 Content: AnySerializationAdapter

      3. File: packages/router-core/src/router.ts Lines: 766-766 Content: export type AnyRouter = RouterCore<any, any, any, any, any>

      4. File: packages/solid-start/src/default-entry/start.ts Lines: 1-1 Content: export const startInstance = undefined

      5. File: packages/react-start/src/default-entry/start.ts Lines: 1-1 Content: export const startInstance = undefined

Sign in to join this conversation.