Skip to content

Bug: huge memory consumption #10516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
KostyaTretyak opened this issue Dec 18, 2024 · 3 comments
Closed
4 tasks done

Bug: huge memory consumption #10516

KostyaTretyak opened this issue Dec 18, 2024 · 3 comments
Labels
fix: user error issue was fixed by correcting the configuration / correcting the code locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. performance Issues regarding performance

Comments

@KostyaTretyak
Copy link

KostyaTretyak commented Dec 18, 2024

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.

Relevant Package

typescript-eslint

Playground Link

No response

Repro steps

I have an open-source monorepository containing approximately 650 files and 42,000 lines of code. This project uses TypeScript Project References and Lerna, with each package having its own tsconfig.json. The total external direct dependencies and devDependencies across all projects is around 30. Work on Ubuntu 22.04.

ESLint Config

// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
  {
    languageOptions: {
      parserOptions: {
        project: [
          './packages/*/tsconfig.json',
          './examples/*/tsconfig.json',
        ]
      },
    },
  },
  {
    rules: {
      semi: ['error', 'always'],
      quotes: ['error', 'single', { avoidEscape: true }],
      '@typescript-eslint/no-floating-promises': 'error',
      '@typescript-eslint/no-unused-expressions': 'warn',
      '@typescript-eslint/no-misused-promises': 0,
      '@typescript-eslint/no-empty-object-type': 0,
      '@typescript-eslint/no-non-null-assertion': 0,
      '@typescript-eslint/no-empty-function': 0,
      '@typescript-eslint/no-empty-interface': 0,
      '@typescript-eslint/explicit-function-return-type': 0,
      '@typescript-eslint/explicit-module-boundary-types': 0,
      '@typescript-eslint/no-explicit-any': 0,
      '@typescript-eslint/no-inferrable-types': 0,
      '@typescript-eslint/no-non-null-asserted-optional-chain': 0,
      '@typescript-eslint/no-unused-vars': 0,
      '@typescript-eslint/triple-slash-reference': 0,
      '@typescript-eslint/ban-types': 0,
      'no-async-promise-executor': 0,
      'no-prototype-builtins': 0,
    },
  },
  {
    ignores: [
      '**/dist*',
      '**/*.d.ts',
      'website/*',
      'node_modules/*',
      'eslint.config.mjs',
      '**/jest.config.ts',
    ],
  },
);

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

The typescript-eslint plugin should not consume so much memory.

Actual Result

As soon as I activate the line ...tseslint.configs.recommended in my eslint.config.mjs, restart VS Code, and open a file, for example, examples/20-authjs/src/app/app.module.ts, memory usage growing to 3.2 GB in one of the processes.

I tried using EXPERIMENTAL_useProjectService: true in eslint.config.mjs, but it didn't help.

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 8.18.1
@typescript-eslint/parser 8.18.1
@typescript-eslint/rule-tester -
@typescript-eslint/scope-manager 8.18.1
@typescript-eslint/typescript-estree 8.18.1
@typescript-eslint/type-utils 8.18.1
@typescript-eslint/utils 8.18.1
TypeScript 5.7.2
ESLint 9.17.0
node 22.12.0
@KostyaTretyak KostyaTretyak added bug Something isn't working triage Waiting for team members to take a look labels Dec 18, 2024
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Dec 18, 2024

👋 thanks for trying out the project service and reporting! Just a few things to check before we dig in:

  1. Since you're on the latest 8.18.1 (great!): just confirming, are you calling it projectService: true per https://typescript-eslint.io/getting-started/typed-linting? (the option has been renamed since its EXPERIMENTAL_* days)
  2. Have you read through https://typescript-eslint.io/troubleshooting/typed-linting/monorepos?
  3. Have you read through https://typescript-eslint.io/troubleshooting/typed-linting/performance?
    • And if so, what happened when you tried the investigations mentioned there?

@JoshuaKGoldberg JoshuaKGoldberg added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for team members to take a look labels Dec 18, 2024
@KostyaTretyak
Copy link
Author

  1. Looks like this tip of yours helped. When I set languageOptions.parserOptions.projectService: true it worked. Thank you!

@JoshuaKGoldberg
Copy link
Member

Awesome, glad it's working! ⚡

Cross-linking to #7350 & #9571 as we've been looking for memory and performance comparisons that show the difference.

Aside: it would be nice if something told people they were using invalid/unknown settings. Tracked by our old friend #6403.

@JoshuaKGoldberg JoshuaKGoldberg added performance Issues regarding performance fix: user error issue was fixed by correcting the configuration / correcting the code and removed bug Something isn't working awaiting response Issues waiting for a reply from the OP or another party labels Dec 18, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Dec 27, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fix: user error issue was fixed by correcting the configuration / correcting the code locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. performance Issues regarding performance
Projects
None yet
Development

No branches or pull requests

2 participants