I have an Angular12 project composed of 590 TypeScript files. When I do ng lint it runs TSLint and finishes in about 5 seconds. Nonetheless, I tried upgrading to eslint following the instructions on this official video from Angular, and now ng lint takes more than 10 minutes (I actually didn't let the process finish, I stopped it at the 10 minutes mark).
I tried to isolate the issue to know if the cause was ng or eslint so I installed eslint globally with npm i -g eslint and run it with timing information for a single file:
time TIMING=1 eslint /home/user/my-file.ts
And even for this single file it took more than 2 minutes. It is odd that eslint is reporting each rule took just some milliseconds, whereas Linux says it took 148 seconds (which is accurate, it took more than 2 minutes):
Rule | Time (ms) | Relative
:-------------------------------------------|----------:|--------:
@angular-eslint/no-conflicting-lifecycle | 0.342 | 35.9%
@angular-eslint/no-input-rename | 0.163 | 17.1%
@angular-eslint/template/banana-in-box | 0.161 | 16.9%
@angular-eslint/no-output-rename | 0.103 | 10.9%
@angular-eslint/component-class-suffix | 0.100 | 10.5%
@angular-eslint/contextual-lifecycle | 0.083 | 8.7%
@angular-eslint/directive-class-suffix | 0.000 | 0.0%
@angular-eslint/no-empty-lifecycle-method | 0.000 | 0.0%
@angular-eslint/no-host-metadata-property | 0.000 | 0.0%
@angular-eslint/no-inputs-metadata-property | 0.000 | 0.0%
Rule | Time (ms) | Relative
:----|----------:|--------:
TIMING=1 eslint 148.14s user 4.47s system 190% cpu 1:19.96 total
How can I make eslint go faster?