typescript-eslint: Bug: `no-misused-promises` rule is slow to evaluate in Svelte

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

Set TIMING=20 in the lint script of this repo: https://github.com/immich-app/immich/tree/main/web

Took over 4 min to run while other rules completed quickly

Image

Reproduction Repository Link

https://github.com/immich-app/immich

Repro Steps

git clone git@github.com:immich-app/immich.git
cd immich/web
npm install
TIMING=20 npm run lint

Versions

This repo is currently on typescript-eslint 8 as indicated below, but I’ve sent a PR to upgrade it to the latest v9 and it happens there as well

package version
@typescript-eslint/eslint-plugin 8.26.1
@typescript-eslint/parser 8.26.1
@typescript-eslint/scope-manager 8.26.1
@typescript-eslint/typescript-estree 8.26.1
@typescript-eslint/type-utils 8.26.1
@typescript-eslint/utils 8.26.1
TypeScript 5.7.3
ESLint 9.18.0
node 22.11.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 28 (24 by maintainers)

Most upvoted comments

I’d still say that you’re not wrong and we could probably see wins by doing some caching of all the functions that are at the top-level of the rule module. Many of the utils do work like iterating call signatures to figure out if a type matches some shape. But we don’t need to do that every time for all types - there’s likely room for caching and short-circuiting to save some time there.

It would be worth someone giving it a whirl by editing your local install in your repo to see if it shifts the needle.

Otherwise I’d hazard a guess that each time we call getTypeOfSymbolAtLocation it’s highly likely to be a unique symbol and so you can’t cache

according to the TS team, it does cache the lookup per symbol at least (inside typescript)

i won’t have time to run it again until maybe later today or tomorrow

but once i do i can try attach one. unless ben or pralkarz beat me to it