Skip to content

Glob pattern in parser's option "project" slows down linting #2611

@tosmolka

Description

@tosmolka
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

# Clone typescript-eslint into current directory
git clone https://github.com/typescript-eslint/typescript-eslint
cd typescript-eslint
# Install packages to increase number of files and subfolders in the directory
yarn install
# Lint ESLint rules with enabled debugging and pass tsconfig.json to project option via glob pattern
eslint packages\eslint-plugin\src\rules --parser-options debugLevel:true,project:**/packages/eslint-plugin/tsconfig.json

Expected Result

Linting with glob pattern should take similar time as when tsconfig.json is passed directly via relative path.

eslint typescript-eslint\packages\eslint-plugin\src\rules --parser-options debugLevel:true,project:packages/eslint-plugin/tsconfig.json

Output:

  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +0ms
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\adjacent-overload-signatures.ts +0ms
  typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\adjacent-overload-signatures.ts +0ms
  typescript-eslint:typescript-estree:createWatchProgram Creating watch program for c:\src\github.com\typescript-eslint\packages\eslint-plugin\tsconfig.json. +7ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +0ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +5s
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\array-type.ts +5s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\array-type.ts +5s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +328ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +722ms
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\await-thenable.ts +722ms
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\await-thenable.ts +713ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +684ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +169ms
...
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\typedef.ts +93ms
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\typedef.ts +95ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +89ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +141ms
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unbound-method.ts +142ms
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unbound-method.ts +141ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +141ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +131ms
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unified-signatures.ts +130ms
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unified-signatures.ts +130ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +142ms

Actual Result

Parser seems to be resolving glob pattern for every linted file individually which significantly increases time to finish the scan.

eslint packages\eslint-plugin\src\rules --parser-options debugLevel:true,project:**/packages/eslint-plugin/tsconfig.json

Output:

  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +0ms
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\adjacent-overload-signatures.ts +0ms
  typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\adjacent-overload-signatures.ts +0ms
  typescript-eslint:typescript-estree:createWatchProgram Creating watch program for c:\src\github.com\typescript-eslint\packages\eslint-plugin\tsconfig.json. +0ms
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +0ms
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +11s
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\array-type.ts +11s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\array-type.ts +11s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +5s
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +3s
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\await-thenable.ts +3s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\await-thenable.ts +3s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +3s
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +3s
...
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\typedef.ts +3s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\typedef.ts +3s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +3s
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +3s
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unbound-method.ts +3s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unbound-method.ts +3s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +3s
  typescript-eslint:typescript-estree:parser parserOptions.project (excluding ignored) matched projects: [ 'packages/eslint-plugin/tsconfig.json' ] +4s
  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unified-signatures.ts +4s
  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. c:\src\github.com\typescript-eslint\packages\eslint-plugin\src\rules\unified-signatures.ts +4s
  typescript-eslint:parser:parser Resolved libs from program: [ 'es2017' ] +4s

Additional Info

Until the issue is investigated and fixed we were suggesting adding a note in the documentation to warn users - #2602

Versions

package version
@typescript-eslint/typescript-estree 4.3.0
TypeScript 4.0.2
node 14.6.0

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy