question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESLint Performance Issue

See original GitHub issue

Current Behavior

I have a mono repo with 20+ libraries and a few storybooks. Each library contains a single component.

When I run Eslint (the new builder) on a single library it takes 22 seconds to lint that single library of 1 component.

From my investigation it appears to be the creation of a TS program based on tsconfig.base.json which includes files in every app and library, not just the ones in the library I want to lint.

If for example I was to add the following to the .eslintrc.json file in the library folder, so it creates the TS program based on the files solely in that library I get a much more respectable 4 second linting time for that single library:

"parserOptions": {
    "project": "./libs/react/box/tsconfig.*?.json"
}

While this workaround works when running the builder my IDE throws warnings so this isn’t really a solution, it just demonstrates the issue.

Expected Behavior

Linting a single library should run fast, and not slow down based on the number of other apps and libraries in the repository.

Steps to Reproduce

  • Clone https://github.com/nrwl/nx-examples/pull/119
  • run yarn nx lint sample --skip-nx-cache
  • In the libs/sample/.eslintrc.json file uncomment out the parserOptions section
  • run the linting command above again
  • It should run faster now we are not including all files. Note the speed up is not that significant in this small project, but in a larger repository we are seeing a 5x improvement.

Failure Logs

N/A

Environment

@nrwl/angular : 10.3.1
 @nrwl/cli : 10.3.0
 @nrwl/cypress : 10.3.1
 @nrwl/eslint-plugin-nx : 10.3.1
 @nrwl/express : Not Found
 @nrwl/jest : 10.3.1
 @nrwl/linter : 10.3.1
 @nrwl/nest : Not Found
 @nrwl/next : Not Found
 @nrwl/node : Not Found
 @nrwl/react : 10.3.1
 @nrwl/schematics : Not Found
 @nrwl/tao : 10.3.0
 @nrwl/web : 10.3.1
 @nrwl/workspace : 10.3.1
 typescript : 4.0.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:9

github_iconTop GitHub Comments

18reactions
JamesHenrycommented, Feb 18, 2021

@ericwooley the PR is ready my understanding from Jason is it will be merged in the release after next (11.4 I think)

12reactions
JamesHenrycommented, Oct 31, 2020

Yeah, this is the manifestation of why I wrote this TODO when I last touched the workspace lint utils 😃 https://github.com/nrwl/nx/blob/992013ca0af7676cae3005b308c7496fa77bba9f/packages/workspace/src/utils/lint.ts#L277

We should be able to address this soon I think @FrozenPandaz - it naturally forms part of the overrides update for non-Angular projects that we discussed already

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why typescript-eslint Performance is Slow - Duncan Leung
While setting up our team's ESLint config with TypeScript, I noticed that running ESLint with typescript-eslint was quite slow. After digging ...
Read more >
Poor performance on some projects · Issue #389 - GitHub
We are trying to use typescript-eslint on a pretty large project with 1000+ files. The CLI is very slow (see stats below), which...
Read more >
Eslint vs Performance - DEV Community ‍ ‍
In addition to obvious performance issues, you might notice that a significant amount of time is wasted on rules that you can live...
Read more >
Speed up ESLint performance 3 times in IDE | by Shiny Chang
It's a nice choice at the beginning, but you may have some performance issue when your project grows up. You can export TIMING=1...
Read more >
Working with Rules - ESLint - Pluggable JavaScript Linter
"problem" means the rule is identifying code that either will cause an error or may cause a confusing behavior. · "suggestion" means the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found