From 68cd16c54d77f747278fe1fc114b14ce44ed794c Mon Sep 17 00:00:00 2001
From: Sheraff <fpellet@ensc.fr>
Date: Fri, 23 Jan 2026 20:53:37 +0100
Subject: [PATCH 1/6] feat(router-generator): param name syntax check and warn

---
 packages/router-generator/src/generator.ts    |   5 +
 .../src/validate-route-params.ts              | 118 ++++++++++++++++++
 .../tests/validate-route-params.test.ts       |  90 +++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 packages/router-generator/src/validate-route-params.ts
 create mode 100644 packages/router-generator/tests/validate-route-params.test.ts

diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index bb3f92735b..e9efdea445 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -43,6 +43,7 @@ import {
 } from './utils'
 import { fillTemplate, getTargetTemplate } from './template'
 import { transform } from './transform/transform'
+import { validateRouteParams } from './validate-route-params'
 import type { GeneratorPlugin } from './plugin/types'
 import type { TargetTemplate } from './template'
 import type {
@@ -1056,6 +1057,10 @@ ${acc.routeTree.map((child) => `${child.variableName}Route: typeof ${getResolved
       throw new Error(`⚠️ File ${node.fullPath} does not exist`)
     }
 
+    if (node.routePath) {
+      validateRouteParams(node.routePath, node.filePath, this.logger)
+    }
+
     const updatedCacheEntry: RouteNodeCacheEntry = {
       fileContent: existingRouteFile.fileContent,
       mtimeMs: existingRouteFile.stat.mtimeMs,
diff --git a/packages/router-generator/src/validate-route-params.ts b/packages/router-generator/src/validate-route-params.ts
new file mode 100644
index 0000000000..62c7a8403c
--- /dev/null
+++ b/packages/router-generator/src/validate-route-params.ts
@@ -0,0 +1,118 @@
+import type { Logger } from './logger'
+
+/**
+ * Regex for valid JavaScript identifier (param name)
+ * Must start with letter, underscore, or dollar sign
+ * Can contain letters, numbers, underscores, or dollar signs
+ */
+const VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/
+
+interface ExtractedParam {
+  /** The param name without $ prefix (e.g., "userId", "optional") */
+  paramName: string
+  /** Whether this param name is valid */
+  isValid: boolean
+}
+
+/**
+ * Extracts param names from a route path segment.
+ *
+ * Handles these patterns:
+ * - $paramName                     -> extract "paramName"
+ * - {$paramName}                   -> extract "paramName"
+ * - prefix{$paramName}suffix       -> extract "paramName"
+ * - {-$paramName}                  -> extract "paramName" (optional)
+ * - prefix{-$paramName}suffix      -> extract "paramName" (optional)
+ * - $ or {$}                       -> wildcard, skip validation
+ */
+function extractParamsFromSegment(segment: string): Array<ExtractedParam> {
+  const params: Array<ExtractedParam> = []
+
+  // Skip empty segments
+  if (!segment || !segment.includes('$')) {
+    return params
+  }
+
+  // Check for wildcard ($ alone or {$})
+  if (segment === '$' || segment === '{$}') {
+    return params // Wildcard, no param name to validate
+  }
+
+  // Pattern 1: Simple $paramName (entire segment starts with $)
+  if (segment.startsWith('$') && !segment.includes('{')) {
+    const paramName = segment.slice(1)
+    if (paramName) {
+      params.push({
+        paramName,
+        isValid: VALID_PARAM_NAME_REGEX.test(paramName),
+      })
+    }
+    return params
+  }
+
+  // Pattern 2: Braces pattern {$paramName} or {-$paramName} with optional prefix/suffix
+  // Match patterns like: prefix{$param}suffix, {$param}, {-$param}
+  const bracePattern = /\{(-?\$)([^}]*)\}/g
+  let match
+
+  while ((match = bracePattern.exec(segment)) !== null) {
+    const paramName = match[2] // The param name after $ or -$
+
+    if (!paramName) {
+      // This is a wildcard {$} or {-$}, skip
+      continue
+    }
+
+    params.push({
+      paramName,
+      isValid: VALID_PARAM_NAME_REGEX.test(paramName),
+    })
+  }
+
+  return params
+}
+
+/**
+ * Extracts all params from a route path.
+ *
+ * @param path - The route path (e.g., "/users/$userId/posts/$postId")
+ * @returns Array of extracted params with validation info
+ */
+function extractParamsFromPath(path: string): Array<ExtractedParam> {
+  if (!path || !path.includes('$')) {
+    return []
+  }
+
+  const segments = path.split('/')
+  const allParams: Array<ExtractedParam> = []
+
+  for (const segment of segments) {
+    const params = extractParamsFromSegment(segment)
+    allParams.push(...params)
+  }
+
+  return allParams
+}
+
+/**
+ * Validates route params and logs warnings for invalid param names.
+ *
+ * @param routePath - The route path to validate
+ * @param filePath - The file path for error messages
+ * @param logger - Logger instance for warnings
+ */
+export function validateRouteParams(
+  routePath: string,
+  filePath: string,
+  logger: Logger,
+): void {
+  const params = extractParamsFromPath(routePath)
+  const invalidParams = params.filter((p) => !p.isValid)
+
+  for (const param of invalidParams) {
+    logger.warn(
+      `WARNING: Invalid param name "${param.paramName}" in route "${routePath}" (file: ${filePath}). ` +
+        `Param names must be valid JavaScript identifiers (match /[a-zA-Z_$][a-zA-Z0-9_$]*/).`,
+    )
+  }
+}
diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
new file mode 100644
index 0000000000..da63fd32a4
--- /dev/null
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -0,0 +1,90 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { validateRouteParams } from '../src/validate-route-params'
+import type { Logger } from '../src/logger'
+
+describe('validateRouteParams', () => {
+  const warn = vi.fn()
+  const logger = { warn } as unknown as Logger
+
+  beforeEach(() => { warn.mockClear() })
+
+  describe('valid param names', () => {
+    it('should not warn for valid simple params', () => {
+      validateRouteParams('/users/$userId', 'users/$userId.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for params with underscores', () => {
+      validateRouteParams('/items/$_id', 'items/$_id.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for params with dollar sign prefix', () => {
+      validateRouteParams('/data/$$var', 'data/$$var.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for braces params', () => {
+      validateRouteParams('/users/{$userName}', 'users/{$userName}.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for optional params', () => {
+      validateRouteParams('/search/{-$query}', 'search/{-$query}.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for wildcards', () => {
+      validateRouteParams('/files/$', 'files/$.tsx', logger)
+      validateRouteParams('/catch/{$}', 'catch/{$}.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+
+    it('should not warn for paths without params', () => {
+      validateRouteParams('/users/list', 'users/list.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(0)
+    })
+  })
+
+  describe('invalid param names', () => {
+    it('should warn for params starting with a number', () => {
+      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(1)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('123'))
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('Invalid param name'))
+    })
+
+    it('should warn for params with hyphens', () => {
+      validateRouteParams('/users/$user-name', 'users/$user-name.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(1)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('user-name'))
+    })
+
+    it('should warn for params with dots', () => {
+      validateRouteParams('/users/{$my.param}', 'users/{$my.param}.tsx', logger)
+      expect(warn).toHaveBeenCalledTimes(1)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('my.param'))
+    })
+
+    it('should warn for multiple invalid params', () => {
+      validateRouteParams(
+        '/users/$1id/posts/$post-id',
+        'users/$1id/posts/$post-id.tsx',
+        logger,
+      )
+      expect(warn).toHaveBeenCalledTimes(2)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('1id'))
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('post-id'))
+    })
+
+    it('should include file path in warning message', () => {
+      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('users/$123.tsx'))
+    })
+
+    it('should include route path in warning message', () => {
+      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
+      expect(warn).toHaveBeenCalledWith(expect.stringContaining('/users/$123'))
+    })
+  })
+})

From 7e48e14e5acd8d311d6cb67ef0753ef06b390e2a Mon Sep 17 00:00:00 2001
From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com>
Date: Fri, 23 Jan 2026 19:55:06 +0000
Subject: [PATCH 2/6] ci: apply automated fixes

---
 .../tests/validate-route-params.test.ts              | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
index da63fd32a4..771fd6884f 100644
--- a/packages/router-generator/tests/validate-route-params.test.ts
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -6,7 +6,9 @@ describe('validateRouteParams', () => {
   const warn = vi.fn()
   const logger = { warn } as unknown as Logger
 
-  beforeEach(() => { warn.mockClear() })
+  beforeEach(() => {
+    warn.mockClear()
+  })
 
   describe('valid param names', () => {
     it('should not warn for valid simple params', () => {
@@ -51,7 +53,9 @@ describe('validateRouteParams', () => {
       validateRouteParams('/users/$123', 'users/$123.tsx', logger)
       expect(warn).toHaveBeenCalledTimes(1)
       expect(warn).toHaveBeenCalledWith(expect.stringContaining('123'))
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('Invalid param name'))
+      expect(warn).toHaveBeenCalledWith(
+        expect.stringContaining('Invalid param name'),
+      )
     })
 
     it('should warn for params with hyphens', () => {
@@ -79,7 +83,9 @@ describe('validateRouteParams', () => {
 
     it('should include file path in warning message', () => {
       validateRouteParams('/users/$123', 'users/$123.tsx', logger)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('users/$123.tsx'))
+      expect(warn).toHaveBeenCalledWith(
+        expect.stringContaining('users/$123.tsx'),
+      )
     })
 
     it('should include route path in warning message', () => {

From 3c33832fe3142eeec13454fed1b2d5c63046ed46 Mon Sep 17 00:00:00 2001
From: Sheraff <fpellet@ensc.fr>
Date: Fri, 23 Jan 2026 21:03:28 +0100
Subject: [PATCH 3/6] better tests

---
 .../invalid-param-names/routeTree.snapshot.ts |  95 +++++++++++++++
 .../invalid-param-names/routes/$123.tsx       |   5 +
 .../invalid-param-names/routes/$user-name.tsx |   5 +
 .../routes/$validParam.tsx                    |   5 +
 .../invalid-param-names/routes/__root.tsx     |   5 +
 .../tests/validate-route-params.test.ts       | 109 ++++--------------
 6 files changed, 138 insertions(+), 86 deletions(-)
 create mode 100644 packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts
 create mode 100644 packages/router-generator/tests/generator/invalid-param-names/routes/$123.tsx
 create mode 100644 packages/router-generator/tests/generator/invalid-param-names/routes/$user-name.tsx
 create mode 100644 packages/router-generator/tests/generator/invalid-param-names/routes/$validParam.tsx
 create mode 100644 packages/router-generator/tests/generator/invalid-param-names/routes/__root.tsx

diff --git a/packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts b/packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts
new file mode 100644
index 0000000000..4728dd439e
--- /dev/null
+++ b/packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts
@@ -0,0 +1,95 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
+
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as ValidParamRouteImport } from './routes/$validParam'
+import { Route as UserNameRouteImport } from './routes/$user-name'
+import { Route as R123RouteImport } from './routes/$123'
+
+const ValidParamRoute = ValidParamRouteImport.update({
+  id: '/$validParam',
+  path: '/$validParam',
+  getParentRoute: () => rootRouteImport,
+} as any)
+const UserNameRoute = UserNameRouteImport.update({
+  id: '/$user-name',
+  path: '/$user-name',
+  getParentRoute: () => rootRouteImport,
+} as any)
+const R123Route = R123RouteImport.update({
+  id: '/$123',
+  path: '/$123',
+  getParentRoute: () => rootRouteImport,
+} as any)
+
+export interface FileRoutesByFullPath {
+  '/$123': typeof R123Route
+  '/$user-name': typeof UserNameRoute
+  '/$validParam': typeof ValidParamRoute
+}
+export interface FileRoutesByTo {
+  '/$123': typeof R123Route
+  '/$user-name': typeof UserNameRoute
+  '/$validParam': typeof ValidParamRoute
+}
+export interface FileRoutesById {
+  __root__: typeof rootRouteImport
+  '/$123': typeof R123Route
+  '/$user-name': typeof UserNameRoute
+  '/$validParam': typeof ValidParamRoute
+}
+export interface FileRouteTypes {
+  fileRoutesByFullPath: FileRoutesByFullPath
+  fullPaths: '/$123' | '/$user-name' | '/$validParam'
+  fileRoutesByTo: FileRoutesByTo
+  to: '/$123' | '/$user-name' | '/$validParam'
+  id: '__root__' | '/$123' | '/$user-name' | '/$validParam'
+  fileRoutesById: FileRoutesById
+}
+export interface RootRouteChildren {
+  R123Route: typeof R123Route
+  UserNameRoute: typeof UserNameRoute
+  ValidParamRoute: typeof ValidParamRoute
+}
+
+declare module '@tanstack/react-router' {
+  interface FileRoutesByPath {
+    '/$validParam': {
+      id: '/$validParam'
+      path: '/$validParam'
+      fullPath: '/$validParam'
+      preLoaderRoute: typeof ValidParamRouteImport
+      parentRoute: typeof rootRouteImport
+    }
+    '/$user-name': {
+      id: '/$user-name'
+      path: '/$user-name'
+      fullPath: '/$user-name'
+      preLoaderRoute: typeof UserNameRouteImport
+      parentRoute: typeof rootRouteImport
+    }
+    '/$123': {
+      id: '/$123'
+      path: '/$123'
+      fullPath: '/$123'
+      preLoaderRoute: typeof R123RouteImport
+      parentRoute: typeof rootRouteImport
+    }
+  }
+}
+
+const rootRouteChildren: RootRouteChildren = {
+  R123Route: R123Route,
+  UserNameRoute: UserNameRoute,
+  ValidParamRoute: ValidParamRoute,
+}
+export const routeTree = rootRouteImport
+  ._addFileChildren(rootRouteChildren)
+  ._addFileTypes<FileRouteTypes>()
diff --git a/packages/router-generator/tests/generator/invalid-param-names/routes/$123.tsx b/packages/router-generator/tests/generator/invalid-param-names/routes/$123.tsx
new file mode 100644
index 0000000000..5ead8abbb3
--- /dev/null
+++ b/packages/router-generator/tests/generator/invalid-param-names/routes/$123.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/$123')({
+  component: () => <div>Invalid param starting with number</div>,
+})
diff --git a/packages/router-generator/tests/generator/invalid-param-names/routes/$user-name.tsx b/packages/router-generator/tests/generator/invalid-param-names/routes/$user-name.tsx
new file mode 100644
index 0000000000..4913327d6c
--- /dev/null
+++ b/packages/router-generator/tests/generator/invalid-param-names/routes/$user-name.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/$user-name')({
+  component: () => <div>Invalid param with hyphen</div>,
+})
diff --git a/packages/router-generator/tests/generator/invalid-param-names/routes/$validParam.tsx b/packages/router-generator/tests/generator/invalid-param-names/routes/$validParam.tsx
new file mode 100644
index 0000000000..6a879114ab
--- /dev/null
+++ b/packages/router-generator/tests/generator/invalid-param-names/routes/$validParam.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/$validParam')({
+  component: () => <div>Valid param</div>,
+})
diff --git a/packages/router-generator/tests/generator/invalid-param-names/routes/__root.tsx b/packages/router-generator/tests/generator/invalid-param-names/routes/__root.tsx
new file mode 100644
index 0000000000..f463b796b4
--- /dev/null
+++ b/packages/router-generator/tests/generator/invalid-param-names/routes/__root.tsx
@@ -0,0 +1,5 @@
+import { createRootRoute, Outlet } from '@tanstack/react-router'
+
+export const Route = createRootRoute({
+  component: () => <Outlet />,
+})
diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
index 771fd6884f..b1f029fd06 100644
--- a/packages/router-generator/tests/validate-route-params.test.ts
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -1,96 +1,33 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { validateRouteParams } from '../src/validate-route-params'
-import type { Logger } from '../src/logger'
+import { join } from 'node:path'
+import { describe, expect, it, vi } from 'vitest'
+import { Generator, getConfig } from '../src'
 
-describe('validateRouteParams', () => {
-  const warn = vi.fn()
-  const logger = { warn } as unknown as Logger
+describe('validateRouteParams via generator', () => {
+  it('should warn for invalid param names when running the generator', async () => {
+    const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { })
 
-  beforeEach(() => {
-    warn.mockClear()
-  })
-
-  describe('valid param names', () => {
-    it('should not warn for valid simple params', () => {
-      validateRouteParams('/users/$userId', 'users/$userId.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
-
-    it('should not warn for params with underscores', () => {
-      validateRouteParams('/items/$_id', 'items/$_id.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
-
-    it('should not warn for params with dollar sign prefix', () => {
-      validateRouteParams('/data/$$var', 'data/$$var.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
-
-    it('should not warn for braces params', () => {
-      validateRouteParams('/users/{$userName}', 'users/{$userName}.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
-
-    it('should not warn for optional params', () => {
-      validateRouteParams('/search/{-$query}', 'search/{-$query}.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
+    const folderName = 'invalid-param-names'
+    const dir = join(process.cwd(), 'tests', 'generator', folderName)
 
-    it('should not warn for wildcards', () => {
-      validateRouteParams('/files/$', 'files/$.tsx', logger)
-      validateRouteParams('/catch/{$}', 'catch/{$}.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
+    const config = getConfig({
+      disableLogging: false, // Enable logging to capture warnings
+      routesDirectory: dir + '/routes',
+      generatedRouteTree: dir + '/routeTree.gen.ts',
     })
 
-    it('should not warn for paths without params', () => {
-      validateRouteParams('/users/list', 'users/list.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(0)
-    })
-  })
-
-  describe('invalid param names', () => {
-    it('should warn for params starting with a number', () => {
-      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(1)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('123'))
-      expect(warn).toHaveBeenCalledWith(
-        expect.stringContaining('Invalid param name'),
-      )
-    })
+    const generator = new Generator({ config, root: dir })
+    await generator.run()
 
-    it('should warn for params with hyphens', () => {
-      validateRouteParams('/users/$user-name', 'users/$user-name.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(1)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('user-name'))
-    })
+    // Should have warned about invalid params: $123 and $user-name
+    expect(warnSpy).toHaveBeenCalledWith(
+      expect.stringContaining('Invalid param name'),
+    )
+    expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('123'))
+    expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('user-name'))
 
-    it('should warn for params with dots', () => {
-      validateRouteParams('/users/{$my.param}', 'users/{$my.param}.tsx', logger)
-      expect(warn).toHaveBeenCalledTimes(1)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('my.param'))
-    })
+    // Should NOT have warned about $validParam
+    expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining('validParam'))
 
-    it('should warn for multiple invalid params', () => {
-      validateRouteParams(
-        '/users/$1id/posts/$post-id',
-        'users/$1id/posts/$post-id.tsx',
-        logger,
-      )
-      expect(warn).toHaveBeenCalledTimes(2)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('1id'))
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('post-id'))
-    })
-
-    it('should include file path in warning message', () => {
-      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
-      expect(warn).toHaveBeenCalledWith(
-        expect.stringContaining('users/$123.tsx'),
-      )
-    })
-
-    it('should include route path in warning message', () => {
-      validateRouteParams('/users/$123', 'users/$123.tsx', logger)
-      expect(warn).toHaveBeenCalledWith(expect.stringContaining('/users/$123'))
-    })
+    warnSpy.mockRestore()
   })
 })

From 6fd3ba58ccc58b3f91551f2c207d850bf8b9e0b7 Mon Sep 17 00:00:00 2001
From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com>
Date: Fri, 23 Jan 2026 20:04:41 +0000
Subject: [PATCH 4/6] ci: apply automated fixes

---
 .../router-generator/tests/validate-route-params.test.ts    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
index b1f029fd06..bbe5129f8b 100644
--- a/packages/router-generator/tests/validate-route-params.test.ts
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -4,7 +4,7 @@ import { Generator, getConfig } from '../src'
 
 describe('validateRouteParams via generator', () => {
   it('should warn for invalid param names when running the generator', async () => {
-    const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { })
+    const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
 
     const folderName = 'invalid-param-names'
     const dir = join(process.cwd(), 'tests', 'generator', folderName)
@@ -26,7 +26,9 @@ describe('validateRouteParams via generator', () => {
     expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('user-name'))
 
     // Should NOT have warned about $validParam
-    expect(warnSpy).not.toHaveBeenCalledWith(expect.stringContaining('validParam'))
+    expect(warnSpy).not.toHaveBeenCalledWith(
+      expect.stringContaining('validParam'),
+    )
 
     warnSpy.mockRestore()
   })

From 1eac9e6d5a28075dddaba1e797577d707f8456ff Mon Sep 17 00:00:00 2001
From: Sheraff <fpellet@ensc.fr>
Date: Fri, 23 Jan 2026 23:20:44 +0100
Subject: [PATCH 5/6] cleanup vi spy

---
 .../router-generator/tests/validate-route-params.test.ts | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
index bbe5129f8b..acfac074b5 100644
--- a/packages/router-generator/tests/validate-route-params.test.ts
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -1,11 +1,12 @@
 import { join } from 'node:path'
-import { describe, expect, it, vi } from 'vitest'
+import { afterAll, describe, expect, it, vi } from 'vitest'
 import { Generator, getConfig } from '../src'
 
 describe('validateRouteParams via generator', () => {
-  it('should warn for invalid param names when running the generator', async () => {
-    const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
+  const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
+  afterAll(() => { warnSpy.mockRestore() })
 
+  it('should warn for invalid param names when running the generator', async () => {
     const folderName = 'invalid-param-names'
     const dir = join(process.cwd(), 'tests', 'generator', folderName)
 
@@ -29,7 +30,5 @@ describe('validateRouteParams via generator', () => {
     expect(warnSpy).not.toHaveBeenCalledWith(
       expect.stringContaining('validParam'),
     )
-
-    warnSpy.mockRestore()
   })
 })

From a517ae503e450577099030fa446f0a62f5e806a8 Mon Sep 17 00:00:00 2001
From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com>
Date: Fri, 23 Jan 2026 22:21:55 +0000
Subject: [PATCH 6/6] ci: apply automated fixes

---
 packages/router-generator/tests/validate-route-params.test.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/router-generator/tests/validate-route-params.test.ts b/packages/router-generator/tests/validate-route-params.test.ts
index acfac074b5..14b61adc3d 100644
--- a/packages/router-generator/tests/validate-route-params.test.ts
+++ b/packages/router-generator/tests/validate-route-params.test.ts
@@ -4,7 +4,9 @@ import { Generator, getConfig } from '../src'
 
 describe('validateRouteParams via generator', () => {
   const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
-  afterAll(() => { warnSpy.mockRestore() })
+  afterAll(() => {
+    warnSpy.mockRestore()
+  })
 
   it('should warn for invalid param names when running the generator', async () => {
     const folderName = 'invalid-param-names'
