Turn off import-x/no-deprecated to speed up ESLint
What does this MR do and why?
A full ESLint run takes more than 5 minutes. The import-x/no-deprecated rule is the single most expensive rule in that run, at about 30% of all rule time. It resolves every import and parses the target module to look for a @deprecated JSDoc tag.
The rule also protects very little:
- It reports only named exports that have a JSDoc block.
- It never reports members of a default-exported object, such as the
Api.groupsandApi.projectsmethods. - It never reports components marked with a
// @deprecatedline comment. - The only remaining reportable exports are
trimFirstCharOfLineContentindiffs/store/utils.jsand a test helper. Their callers already suppressed the rule.
This MR turns the rule off for the whole monolith. It also:
- Removes the
eslint-disablecomments for the rule. With--report-unused-disable-directivesand--max-warnings 0, these comments would fail the lint job. - Replaces the frontend tooling guide section about the rule. The guide now says to deprecate code, or mark it for migration, with a
no-restricted-importsorno-restricted-propertiesentry that names the replacement. Thevuexandaxiosentries already work this way.
The @deprecated tags stay in the code. Editors still show them.
The config entry sits next to import-x/no-cycle, the other import rule that is off for speed.
Benchmark
Full-repo run on one machine, three runs per configuration:
TIMING=all ./node_modules/.bin/eslint --no-cache .| Run | Wall time before | Wall time after | Rule time before | Rule time after |
|---|---|---|---|---|
| 1 | 5 min 21 s | 4 min 32 s | 2 min 59 s | 2 min 15 s |
| 2 | 5 min 17 s | 4 min 19 s | 2 min 58 s | 2 min 9 s |
| 3 | 5 min 17 s | 4 min 13 s | 3 min 0 s | 2 min 5 s |
Per rule, import-x/no-deprecated went from about 52 s to zero. The other import-x rules share a resolver cache, so part of the saving moves to import-x/named and import-x/no-extraneous-dependencies. The net saving is about 50 s of rule time and about 1 min of wall time.
How to set up and validate locally
yarn lint:eslint:all --no-cache
rg -n 'import-x/no-deprecated' app ee spec doc eslint.config.mjsThe lint run passes with no unused-directive warnings. The search returns only the config entry.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
References
- Profiling results and analysis: #630872 (closed)
- Removed unused
Api.usersandApi.userbefore this change (merged): !257740 (merged) - Removed unused
canScrollUpandcanScrollDownbefore this change (merged): !257753 (merged) - Prompted by the
eslint-plugin-import-xswitch in !257578 (merged)