Open
Description
Repo for reproduction is here: https://github.com/ChristianIvicevic/import-namespace-issue-repro
I noticed that eslint takes ages linting the single file in this repo and profiling timings yields the following:
Rule | Time (ms) | Relative
:-----------------------------------------|----------:|--------:
import/namespace | 8546.897 | 99.8%
@typescript-eslint/no-floating-promises | 9.076 | 0.1%
@typescript-eslint/no-unused-vars | 1.006 | 0.0%
@typescript-eslint/no-unsafe-argument | 0.989 | 0.0%
@typescript-eslint/no-misused-promises | 0.556 | 0.0%
@typescript-eslint/ban-types | 0.318 | 0.0%
@typescript-eslint/no-empty-function | 0.270 | 0.0%
@typescript-eslint/no-loss-of-precision | 0.257 | 0.0%
@typescript-eslint/triple-slash-reference | 0.220 | 0.0%
@typescript-eslint/no-unsafe-call | 0.163 | 0.0%
After trial-and-error I noticed that the offending line is this:
Removing all JS extensions fixes the abysmal speed of import/namespace
:
Rule | Time (ms) | Relative
:------------------------------------------|----------:|--------:
import/namespace | 92.790 | 87.9%
@typescript-eslint/no-floating-promises | 8.542 | 8.1%
@typescript-eslint/no-unsafe-argument | 0.962 | 0.9%
@typescript-eslint/no-unused-vars | 0.843 | 0.8%
@typescript-eslint/no-misused-promises | 0.468 | 0.4%
@typescript-eslint/no-empty-function | 0.249 | 0.2%
@typescript-eslint/ban-types | 0.209 | 0.2%
@typescript-eslint/no-loss-of-precision | 0.202 | 0.2%
@typescript-eslint/no-unsafe-member-access | 0.136 | 0.1%
@typescript-eslint/no-unsafe-call | 0.127 | 0.1%
For the time being I have disabled import/namespace
for my lambdas that import @vercel/node
. In the rest of my project this is a non-issue, it's just in combination with that package that eslint is stuck doing... something.