Skip to content

Bug: Crash on interaction between no-misused-spread and SystemStyleObject from Chakra UI v2 #10747

Closed
@benj-dobs

Description

@benj-dobs

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

A strange case - when running npm run lint on this sample repo, the no-misused-spread rule crashes with the following error:

Oops! Something went wrong! :(

ESLint: 9.19.0

TypeError: Cannot read properties of undefined (reading '0')
Occurred while linting /Users/benj-dobs/Documents/tseslint-repro/index.tsx:6
Rule: "@typescript-eslint/no-misused-spread"
    at Object.getWellKnownSymbolPropertyOfType (/Users/benj-dobs/Documents/tseslint-repro/node_modules/ts-api-utils/lib/index.cjs:919:72)
    at /Users/benj-dobs/Documents/tseslint-repro/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-spread.js:156:30
    at Array.some (<anonymous>)
    at isIterable (/Users/benj-dobs/Documents/tseslint-repro/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-spread.js:156:10)
    at checkObjectSpread (/Users/benj-dobs/Documents/tseslint-repro/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-spread.js:122:17)
    at ruleErrorHandler (/Users/benj-dobs/Documents/tseslint-repro/node_modules/eslint/lib/linter/linter.js:1160:48)
    at /Users/benj-dobs/Documents/tseslint-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/benj-dobs/Documents/tseslint-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/benj-dobs/Documents/tseslint-repro/node_modules/eslint/lib/linter/node-event-generator.js:297:26)

There seems to be something about the StyleSystemObject type that causes the rule to crash. I haven't been able to reproduce this with simple types.

Reproduction Repository Link

https://github.com/benj-dobs/tseslint-repro

Repro Steps

  1. clone the repo
  2. npm install
  3. npm run lint

Versions

package version
@typescript-eslint/eslint-plugin 8.22.0
@typescript-eslint/parser 8.22.0
@typescript-eslint/scope-manager 8.22.0
@typescript-eslint/typescript-estree 8.22.0
@typescript-eslint/type-utils 8.22.0
@typescript-eslint/utils 8.22.0
TypeScript 5.7.3
ESLint 9.19.0
node 22.13.1

Also reproduced with node 20.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions