Skip to content

eslint-plugin-router: create-route-property-order crashes with "Unsupported spread element" on a non-identifier spread #8673

Open

Description

@Stanzilla

Which project does this relate to?

Router

Describe the bug

@tanstack/router/create-route-property-order throws, and so ESLint stops, when a createRoute options object spreads anything other than an identifier:

export const route = createRoute({
  ...shared(),
  getParentRoute: () => rootRoute,
  path: '/',
})
Error: Unsupported spread element
Occurred while linting routes.js:6
Rule: "@tanstack/router/create-route-property-order"

The throw is here, and it is still on main:
https://github.com/TanStack/router/blob/main/packages/eslint-plugin-router/src/rules/create-route-property-order/create-route-property-order.rule.ts#L81

Spreading a call result, a member expression (...opts.route) or a conditional (...(flag ? a : b)) all hit it. Oxlint's JS plugin host shows the same crash.

Complete minimal reproducer

https://gist.github.com/Stanzilla/aacf46f0404c35fbca3ef0f7f231f15b

Steps to Reproduce the Bug

  1. git clone https://gist.github.com/aacf46f0404c35fbca3ef0f7f231f15b.git repro && cd repro
  2. npm install
  3. npm run lint
  4. ESLint crashes with Error: Unsupported spread element.

Expected behavior

The rule does not crash. The spread content is unknown, so the rule can skip that object, or handle the spread the same way it handles an identifier spread.

Workaround: assign the expression to a local variable and spread that.

Platform

  • @tanstack/eslint-plugin-router: 1.162.0 (latest)
  • ESLint: 9.39.1
  • Node: 24.21.0
  • OS: macOS

Additional context

An AI agent (Claude Code) found the crash, built the reproducer and wrote this issue.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions