Skip to content
Source
Sign inSign up
TanStack/router

feat: startInstance carries createServerFn and createMiddleware #6748

Openschiller-manuel(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromstartInstance-monorepoopened

Summary by CodeRabbit

  • New Features

    • Added an end-to-end example project demonstrating React Start with analytics middleware and context management.
    • Enhanced StartInstance with typed createMiddleware and createServerFn methods, enabling external packages to create middleware and server functions with full type safety.
  • Tests

    • Added comprehensive type and integration tests for server function and middleware composition with context propagation.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

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

    3. 📝 Walkthrough

      Walkthrough

      This PR introduces an end-to-end React monorepo example demonstrating middleware and server function composition, while simultaneously expanding the StartInstance public API to expose createMiddleware and createServerFn factory methods with full type support.

      Changes

      Cohort / File(s)Summary
      E2E React Monorepo Configuration
      e2e/react-start/monorepo/.gitignore, package.json, tsconfig.json, vite.config.ts, playwright.config.ts
      Sets up a new monorepo project with package metadata, TypeScript/Vite/Tailwind tooling, Playwright e2e testing configuration, and build/dev/test scripts.
      E2E Monorepo - Shared Packages
      e2e/react-start/monorepo/packages/analytics/src/index.ts, packages/start-config/src/index.ts
      Implements analytics and start-config packages: getAnalyticsContext and getAnalyticsSession server functions with request/function middleware composition; startInstance wiring locale and auth middlewares.
      E2E Monorepo - Router & Routes
      e2e/react-start/monorepo/src/router.tsx, src/routeTree.gen.ts, src/routes/__root.tsx, src/routes/index.tsx, src/routes/analytics-context.tsx, src/routes/analytics-session.tsx
      Defines TanStack Router setup with generated route tree, root layout component, and three file-based routes demonstrating server function loaders and middleware context consumption.
      E2E Monorepo - Start Configuration & Styling
      e2e/react-start/monorepo/src/start.ts, src/styles/app.css
      Exports startInstance from shared config and imports Tailwind CSS utilities.
      E2E Monorepo - Tests
      e2e/react-start/monorepo/tests/monorepo.spec.ts
      Adds Playwright e2e tests validating SSR and client-side navigation for analytics context and session server functions with middleware data augmentation.
      StartInstance Public API Expansion
      packages/start-client-core/src/createStart.ts, packages/start-client-core/src/index.tsx, packages/start-client-core/src/tests/createStartServerFn.test-d.ts
      Exposes createMiddleware and createServerFn as public StartInstance members with full generic typing; adds comprehensive TypeScript type tests covering middleware context propagation and server function combinations.
      Plugin Configuration Updates
      packages/start-plugin-core/src/start-compiler-plugin/plugin.ts, packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      Moves createStart lookup from per-environment client blocks to shared common configurations; adds test coverage for createStart exports.
      Plugin Test Snapshots & Files
      packages/start-plugin-core/tests/createServerFn/snapshots/client/createStart.tsx, snapshots/server-caller/createStart.tsx, snapshots/server-provider/createStart.tsx, test-files/createStart.tsx
      Introduces test snapshots and reference files demonstrating startInstance creation with middleware, server function definition via createServerFn, and RPC handler registration patterns.

      Sequence Diagram

      sequenceDiagram
          participant Client
          participant Router
          participant Middleware as Middleware Stack
          participant Handler as Server Handler
          participant Context as Global Context
      
          Client->>Router: Navigate to /analytics-session
          Router->>Handler: Trigger loader: getAnalyticsSession()
          Handler->>Middleware: startInstance.createServerFn()
          Middleware->>Context: Apply requestMiddleware (locale, auth)
          Context-->>Middleware: {locale: 'en-us', userId: 'user-42'}
          Middleware->>Middleware: Apply functionMiddleware (sessionId)
          Middleware-->>Handler: {locale, userId, sessionId}
          Handler-->>Router: Return loader data
          Router->>Client: Render route with data
          Client->>Client: Display: locale, userId, sessionId

      Estimated code review effort

      🎯 4 (Complex) | ⏱️ ~60 minutes

      • TanStack/router#6188: Compiler and plugin changes for detecting and compiling middleware/factory server-only code alongside the main PR's middleware exposure.
      • TanStack/router#6213: Related modifications to start-client-core/start-plugin-core server-function APIs and middleware/server-fn metadata flow.
      • TanStack/router#5040: Foundational work introducing server-function APIs that this PR builds upon and extends with new public StartInstance members.

      Suggested labels

      package: start-client-core, e2e, examples

      Suggested reviewers

      • nlynzaad

      Poem

      🐰 Middleware threads compose with grace, Server functions find their place, StartInstance now reveals its art, Context flows through every part! ✨

      🚥 Pre-merge checks | ✅ 2 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe PR title accurately captures the main feature: exposing createServerFn and createMiddleware methods on the startInstance for external package usage with proper typing.
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing Touches
      • 📝 Generate docstrings (stacked PR)
      • 📝 Generate docstrings (commit on current branch)
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `startInstance-monorepo`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    4. View your CI Pipeline Execution ↗ for commit 0d6fbd7789041adc6ad2b6654d99aa6ea587c845

      CommandStatusDurationResult
      nx run tanstack-router-e2e-bundle-size:build --...✅ Succeeded1m 27sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-02-24 00:21:32 UTC

    5. Bundle Size Benchmarks

      • Commit: 7f7f6cb7ca1a
      • Measured at: 2026-02-24T00:11:03.150Z
      • Baseline source: history:09405b22ccff
      • Dashboard: bundle-size history
      ScenarioCurrent (gzip)Delta vs baselineRawBrotliTrend
      react-router.minimal86.53 KiB0 B (0.00%)272.15 KiB75.17 KiB▇▇▇██▆▆▆▁▁▁
      react-router.full89.55 KiB0 B (0.00%)282.49 KiB77.88 KiB█████▇▆▆▁▁▁
      solid-router.minimal35.80 KiB0 B (0.00%)107.27 KiB32.12 KiB█████▆▆▆▁▁▁
      solid-router.full40.15 KiB0 B (0.00%)120.32 KiB36.10 KiB█████▇▆▆▁▁▂
      vue-router.minimal51.66 KiB0 B (0.00%)147.25 KiB46.49 KiB███▇▇▆▆▆▁▁▁
      vue-router.full56.49 KiB0 B (0.00%)162.83 KiB50.70 KiB███▇▇▆▆▆▁▁▁
      react-start.minimal99.08 KiB0 B (0.00%)311.29 KiB85.71 KiB▇▇▇▇▇▆▆█▁▁▁
      react-start.full102.42 KiB0 B (0.00%)321.06 KiB88.47 KiB█████▆▅▆▁▁▁
      solid-start.minimal48.12 KiB0 B (0.00%)144.84 KiB42.55 KiB███▇▇▆▅█▁▁▂
      solid-start.full53.58 KiB0 B (0.00%)160.76 KiB47.34 KiB█████▆▆█▁▁▁

      Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

    6. More templates

      @tanstack/arktype-adapter

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

      @tanstack/eslint-plugin-router

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

      @tanstack/history

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

      @tanstack/nitro-v2-vite-plugin

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-fn-stubs

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6748

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/vue-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6748

      @tanstack/vue-router-devtools

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

      @tanstack/vue-router-ssr-query

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

      @tanstack/vue-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6748

      @tanstack/vue-start-client

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

      @tanstack/vue-start-server

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

      @tanstack/zod-adapter

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

      commit: 0d6fbd7

    7. Actionable comments posted: 2

      ♻️ Duplicate comments (1)
      packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createStart.tsx (1)

      1-22: LGTM — server-caller snapshot wires createSsrRpc with lazy dynamic imports correctly

      The pattern of using createSsrRpc with a deferred import().then(m => m[handler]) for the server-caller split is consistent with the established SSR RPC approach in the codebase. The same unused-createServerFn-import observation applies here as noted in the client snapshot.

      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In
      `@packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createStart.tsx`
      around lines 1 - 22, The snapshot imports createServerFn but never uses it;
      remove the unused import to clean up the file — update the import statement that
      currently reads "import { createStart, createServerFn, createMiddleware } from
      '@tanstack/react-start';" to drop createServerFn so only createStart and
      createMiddleware are imported, ensuring there are no leftover references to
      createServerFn in this file.
      🧹 Nitpick comments (3)
      packages/start-client-core/src/createStart.ts (1)

      195-215: as unknown as is broad — consider narrowing the casts to just the mismatched properties.

      The whole object literal is cast via as unknown as StartInstance<...>, which silences TypeScript on all properties. A future accidental swap (e.g. createServerFn: createMiddleware) would go undetected. The type mismatch that necessitates the cast is only on createMiddleware and createServerFn (runtime type uses Register, interface expects the instance-specific generic).

      ♻️ Narrower cast suggestion
      -  return {
      -    getOptions: async () => {
      -      ...
      -    },
      -    createMiddleware: createMiddleware,
      -    createServerFn: createServerFn,
      -  } as unknown as StartInstance<
      -    TSerializationAdapters,
      -    TDefaultSsr,
      -    TRequestMiddlewares,
      -    TFunctionMiddlewares
      -  >
      +  return {
      +    getOptions: async () => {
      +      ...
      +    },
      +    createMiddleware: createMiddleware as unknown as StartInstance<
      +      TSerializationAdapters,
      +      TDefaultSsr,
      +      TRequestMiddlewares,
      +      TFunctionMiddlewares
      +    >['createMiddleware'],
      +    createServerFn: createServerFn as unknown as StartInstance<
      +      TSerializationAdapters,
      +      TDefaultSsr,
      +      TRequestMiddlewares,
      +      TFunctionMiddlewares
      +    >['createServerFn'],
      +  }
      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In `@packages/start-client-core/src/createStart.ts` around lines 195 - 215, The
      object is being cast wholesale with "as unknown as StartInstance<...>" which
      hides any other mismatches; restrict casting to the two mismatched properties
      instead: leave the returned object typed naturally, and only cast
      createMiddleware and createServerFn to the expected Register-compatible
      signatures (or to the specific StartInstance function types) so TypeScript still
      checks getOptions and serialization handling (see getOptions,
      dedupeSerializationAdapters, createMiddleware, createServerFn, and
      StartInstance). Update the return to return a properly typed object and apply
      narrow casts only on createMiddleware/createServerFn rather than the entire
      object.
      packages/start-plugin-core/tests/createServerFn/snapshots/client/createStart.tsx (1)

      2-2: createServerFn import is unused in createStart snapshots

      createServerFn is imported but never referenced directly — only startInstance.createServerFn is used. This pattern appears consistently across all three createStart snapshot variants (client, server-provider, server-caller), generating unused import warnings for end-users if the plugin doesn't post-process imports.

      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In
      `@packages/start-plugin-core/tests/createServerFn/snapshots/client/createStart.tsx`
      at line 2, The import list includes createServerFn but the code only uses
      startInstance.createServerFn, so remove createServerFn from the import statement
      to avoid unused-import warnings; update the import to only import the actually
      used symbols (e.g., keep createStart and createMiddleware) in the createStart
      snapshots where createServerFn is unused (refer to the import line that
      currently lists createStart, createServerFn, createMiddleware and to usages like
      startInstance.createServerFn).
      e2e/react-start/monorepo/packages/analytics/src/index.ts (1)

      23-32: Redundant as string cast on template literal.

      Template literals are already typed as string in TypeScript, so the assertion on line 26 is unnecessary.

      Suggested fix
      -    const sessionId = `session-${context.userId}-${context.locale}` as string
      +    const sessionId = `session-${context.userId}-${context.locale}`
      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In `@e2e/react-start/monorepo/packages/analytics/src/index.ts` around lines 23 -
      32, Remove the redundant type assertion from the template literal when creating
      sessionId in analyticsMiddleware: in the server handler created by
      startInstance.createMiddleware().server, change the line that sets const
      sessionId = `session-${context.userId}-${context.locale}` as string to simply
      const sessionId = `session-${context.userId}-${context.locale}` so the inferred
      string type is used; update any references to sessionId if necessary but do not
      add an explicit cast.
      🤖 Prompt for all review comments with AI agents
      Verify each finding against the current code and only fix it if needed.
      
      Inline comments:
      In `@e2e/react-start/monorepo/src/styles/app.css`:
      - Line 1: The Biome linter is failing to parse Tailwind v4 `@import` ... source()
      syntax; open the repository root biome.json and add the Tailwind opt-in flag by
      setting "tailwindDirectives": true in Biome's CSS parser config (add or update
      the CSS parser section so the config includes "tailwindDirectives": true),
      ensuring Biome will accept the Tailwind directives used in app.css; reference
      the biome.json file and the tailwindDirectives key when making this change.
      
      In `@e2e/react-start/monorepo/tests/monorepo.spec.ts`:
      - Line 1: Change the import so `Page` is imported as a type-only import and
      ensure the type import comes before the value import to satisfy sorting: replace
      the combined import with a type-only import for `Page` (import type { Page })
      and a separate value import for `expect` (import { expect }) so `Page` (type) is
      declared before `expect` (value), updating the import line that currently
      imports `expect, Page` from '@playwright/test'.
      
      ---
      
      Duplicate comments:
      In
      `@packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createStart.tsx`:
      - Around line 1-22: The snapshot imports createServerFn but never uses it;
      remove the unused import to clean up the file — update the import statement that
      currently reads "import { createStart, createServerFn, createMiddleware } from
      '@tanstack/react-start';" to drop createServerFn so only createStart and
      createMiddleware are imported, ensuring there are no leftover references to
      createServerFn in this file.
      
      ---
      
      Nitpick comments:
      In `@e2e/react-start/monorepo/packages/analytics/src/index.ts`:
      - Around line 23-32: Remove the redundant type assertion from the template
      literal when creating sessionId in analyticsMiddleware: in the server handler
      created by startInstance.createMiddleware().server, change the line that sets
      const sessionId = `session-${context.userId}-${context.locale}` as string to
      simply const sessionId = `session-${context.userId}-${context.locale}` so the
      inferred string type is used; update any references to sessionId if necessary
      but do not add an explicit cast.
      
      In `@packages/start-client-core/src/createStart.ts`:
      - Around line 195-215: The object is being cast wholesale with "as unknown as
      StartInstance<...>" which hides any other mismatches; restrict casting to the
      two mismatched properties instead: leave the returned object typed naturally,
      and only cast createMiddleware and createServerFn to the expected
      Register-compatible signatures (or to the specific StartInstance function types)
      so TypeScript still checks getOptions and serialization handling (see
      getOptions, dedupeSerializationAdapters, createMiddleware, createServerFn, and
      StartInstance). Update the return to return a properly typed object and apply
      narrow casts only on createMiddleware/createServerFn rather than the entire
      object.
      
      In
      `@packages/start-plugin-core/tests/createServerFn/snapshots/client/createStart.tsx`:
      - Line 2: The import list includes createServerFn but the code only uses
      startInstance.createServerFn, so remove createServerFn from the import statement
      to avoid unused-import warnings; update the import to only import the actually
      used symbols (e.g., keep createStart and createMiddleware) in the createStart
      snapshots where createServerFn is unused (refer to the import line that
      currently lists createStart, createServerFn, createMiddleware and to usages like
      startInstance.createServerFn).

      ℹ️ Review info

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between ea31c50be97ce036128a92b052e129eba4bc49e3 and 0d6fbd7789041adc6ad2b6654d99aa6ea587c845.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (25)
      • e2e/react-start/monorepo/.gitignore
      • e2e/react-start/monorepo/package.json
      • e2e/react-start/monorepo/packages/analytics/src/index.ts
      • e2e/react-start/monorepo/packages/start-config/src/index.ts
      • e2e/react-start/monorepo/playwright.config.ts
      • e2e/react-start/monorepo/src/routeTree.gen.ts
      • e2e/react-start/monorepo/src/router.tsx
      • e2e/react-start/monorepo/src/routes/__root.tsx
      • e2e/react-start/monorepo/src/routes/analytics-context.tsx
      • e2e/react-start/monorepo/src/routes/analytics-session.tsx
      • e2e/react-start/monorepo/src/routes/index.tsx
      • e2e/react-start/monorepo/src/start.ts
      • e2e/react-start/monorepo/src/styles/app.css
      • e2e/react-start/monorepo/tests/monorepo.spec.ts
      • e2e/react-start/monorepo/tsconfig.json
      • e2e/react-start/monorepo/vite.config.ts
      • packages/start-client-core/src/createStart.ts
      • packages/start-client-core/src/index.tsx
      • packages/start-client-core/src/tests/createStartServerFn.test-d.ts
      • packages/start-plugin-core/src/start-compiler-plugin/plugin.ts
      • packages/start-plugin-core/tests/createServerFn/createServerFn.test.ts
      • packages/start-plugin-core/tests/createServerFn/snapshots/client/createStart.tsx
      • packages/start-plugin-core/tests/createServerFn/snapshots/server-caller/createStart.tsx
      • packages/start-plugin-core/tests/createServerFn/snapshots/server-provider/createStart.tsx
      • packages/start-plugin-core/tests/createServerFn/test-files/createStart.tsx
      e2e/react-start/monorepo/src/styles/app.css line 1
      @@ -0,0 +1 @@
      1+@import 'tailwindcss' source('../');

      ⚠️ Potential issue | 🟡 Minor

      🧩 Analysis chain

      🏁 Script executed:

      # Check if the CSS file exists and its content
      cat e2e/react-start/monorepo/src/styles/app.css 2>/dev/null || echo "File not found"

      Repository: TanStack/router

      Length of output: 95


      🏁 Script executed:

      # Find all biome.json files in the repository and check their content
      fd -type f -name 'biome.json' | head -20

      Repository: TanStack/router

      Length of output: 229


      🏁 Script executed:

      # Check for biome.json in the e2e project root and parent directories
      cd e2e/react-start && pwd && ls -la biome.json 2>/dev/null || echo "No biome.json in e2e/react-start"

      Repository: TanStack/router

      Length of output: 126


      🏁 Script executed:

      # Search for all biome.json files in the repository
      find . -maxdepth 3 -name 'biome.json' 2>/dev/null

      Repository: TanStack/router

      Length of output: 71


      🏁 Script executed:

      # Check the root directory and parent directories for biome.json
      ls -la biome.json 2>/dev/null || echo "No biome.json at root"
      cat biome.json 2>/dev/null || echo "Cannot read root biome.json"

      Repository: TanStack/router

      Length of output: 1893


      🏁 Script executed:

      # Search for any biome-related configuration
      rg 'tailwindDirectives' --type json 2>/dev/null || echo "No tailwindDirectives found"

      Repository: TanStack/router

      Length of output: 86


      Add tailwindDirectives: true to Biome's CSS parser config.

      Biome 2.4.4 cannot parse Tailwind v4's @import ... source() syntax without enabling the opt-in Tailwind support. The biome.json at the repository root currently lacks this configuration, which will cause Biome linting to fail on this CSS file.

      Add the following to biome.json:

      Required biome.json change
       {
         "css": {
           "linter": {
             "enabled": true
           },
           "parser": {
      -      "cssModules": true
      +      "cssModules": true,
      +      "tailwindDirectives": true
           }
         }
       }
      🧰 Tools
      🪛 Biome (2.4.4)

      [error] 1-1: expected , but instead found (

      (parse)

      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In `@e2e/react-start/monorepo/src/styles/app.css` at line 1, The Biome linter is
      failing to parse Tailwind v4 `@import` ... source() syntax; open the repository
      root biome.json and add the Tailwind opt-in flag by setting
      "tailwindDirectives": true in Biome's CSS parser config (add or update the CSS
      parser section so the config includes "tailwindDirectives": true), ensuring
      Biome will accept the Tailwind directives used in app.css; reference the
      biome.json file and the tailwindDirectives key when making this change.
      e2e/react-start/monorepo/tests/monorepo.spec.ts line 1
      @@ -0,0 +1 @@
      1+import { expect, Page } from '@playwright/test'

      ⚠️ Potential issue | 🟡 Minor

      Fix type-only import of Page — two ESLint errors on this line

      Page is used only as a TypeScript type annotation (page: Page) and must be a type import per @typescript-eslint/consistent-type-imports. Additionally, sort-imports expects Page before expect (uppercase P sorts before lowercase e in ASCII order).

      🛠️ Proposed fix
      -import { expect, Page } from '@playwright/test'
      +import { expect } from '@playwright/test'
      +import type { Page } from '@playwright/test'
      📝 Committable suggestion

      ‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      import { expect } from '@playwright/test'
      import type { Page } from '@playwright/test'
      🧰 Tools
      🪛 ESLint

      [error] 1-1: Imports "Page" are only used as type.

      (@typescript-eslint/consistent-type-imports)


      [error] 1-1: Member 'Page' of the import declaration should be sorted alphabetically.

      (sort-imports)

      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In `@e2e/react-start/monorepo/tests/monorepo.spec.ts` at line 1, Change the import
      so `Page` is imported as a type-only import and ensure the type import comes
      before the value import to satisfy sorting: replace the combined import with a
      type-only import for `Page` (import type { Page }) and a separate value import
      for `expect` (import { expect }) so `Page` (type) is declared before `expect`
      (value), updating the import line that currently imports `expect, Page` from
      '@playwright/test'.

Sign in to join this conversation.