Potential CPU usage issues with typescript/eslint
See original GitHub issueI’ve noticed that since after I enabled this plugin, the CPU usage of the node process went up to 100% and my fans started to go crazy.
The node CPU usage starts to increase after a few compilation/checks.
// vite.config.js
import reactRefresh from '@vitejs/plugin-react-refresh';
import { defineConfig } from 'vite';
import checker from 'vite-plugin-checker';
export default defineConfig({
build: {
outDir: 'build',
},
server: {
open: true,
proxy: {
'/api': {
target: 'http://localhost:5000',
changeOrigin: true,
},
},
},
plugins: [
reactRefresh(),
checker({
typescript: true,
eslint: {
files: ['./src'],
extensions: ['.ts', '.tsx'],
},
}),
],
});
System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 2.05 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.1 - /usr/local/bin/node
npm: 6.14.14 - /usr/local/bin/npm
Browsers:
Chrome: 92.0.4515.159
Firefox: 90.0.2
Safari: 14.1.2
npmPackages:
vite-plugin-checker: ^0.3.4 => 0.3.4
I have problems to identify the issue any further. This is the behaviour if I have this plugin enabled. So I’m afraid I cant put any more details to it. I’m mostly creating this issue to see if there’s anyone else experiencing the same issue?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:18 (7 by maintainers)
Top Results From Across the Web
High CPU usage when ESLint is enabled with typescript-eslint
snapshot shows that IDE own CPU usage is low; it's node.js that loads CPU. js-language-service is just a wrapper around tsserver provided by...
Read more >Language Services in Intellij IDEA maxing out CPU
I have a fairly large project at my current work (about 3k ts and coffeescript files), and have started getting an issue using...
Read more >How to Fix High CPU Usage - Intel
This may resolve the issue, especially if it's been a long time since you last restarted — a reboot can clear out temporary...
Read more >7 Recommended ESLint Rules for React TypeScript Project
The combination of ESLint and Prettier is Amazing. It not only reduces formatting time dramatically, but also saves your brain CPU.
Read more >Tracking down specific TypeScript source code files/function ...
I'm been programming in this style for longer than the CPU issue has ... functions might be causing the high CPU usage to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fi3ework
Checker({ typescript: true})
Here is our tsconfig.json
And here is the vite.config.ts:
Let me know if you need more information. I will try to come up with more ideas and reproduce this issue. Thank you for your help!
update
I think
UseFsEventsWithFallbackDynamicPolling
works good at some most time with a low CPU load. But it also has some downside otherwise it has been set as the default strategy by tsc itself (see discussions in https://github.com/microsoft/TypeScript/issues/31048). I think we can:UseFsEventsWithFallbackDynamicPolling
flag to satisfy the most common scenario.ts.System
interface. I think this is a better and long-term solution.@raszi Nice catch. Maybe it should be added to the worker env by default for the typescript checker.