What problem does this feature solve?
Reporting a no-var violation is a single syntax check. But deciding whether the var→let autofix is safe, canFix does full-scope reference analysis and calls GetSymbolAtLocation on every candidate identifier (for a top-level var this scans the whole file).
However, canFix's result does not affect whether we report — it's purely for the fix. Yet this expensive analysis runs regardless of --fix, so in common lint-only CI runs it's computed and immediately discarded — pure waste.
What does the proposed API of configuration look like?
Thread the "is autofix needed" intent from the CLI layer all the way down to rule execution, so a rule can know whether the current run will actually apply fixes. On that basis, decouple the "expensive analysis done solely to compute the fix" from the "analysis required for reporting itself" — when a run doesn't need fixes, the rule skips the former entirely.
no-var: its report decision is a pure syntax check, while canFix's full-scope reference analysis serves only the fix and does not affect whether we report. So it can be skipped wholesale when no fix is needed, with identical reporting results.
Default behavior is unchanged (fixes are still computed as usual under LSP, the API, and --fix); only the lint-only CLI path turns this analysis off, saving full-file symbol resolution on the common CI route.
What problem does this feature solve?
Reporting a
no-varviolation is a single syntax check. But deciding whether thevar→letautofix is safe,canFixdoes full-scope reference analysis and callsGetSymbolAtLocationon every candidate identifier (for a top-levelvarthis scans the whole file).However,
canFix's result does not affect whether we report — it's purely for the fix. Yet this expensive analysis runs regardless of--fix, so in common lint-only CI runs it's computed and immediately discarded — pure waste.What does the proposed API of configuration look like?
Thread the "is autofix needed" intent from the CLI layer all the way down to rule execution, so a rule can know whether the current run will actually apply fixes. On that basis, decouple the "expensive analysis done solely to compute the fix" from the "analysis required for reporting itself" — when a run doesn't need fixes, the rule skips the former entirely.
no-var: its report decision is a pure syntax check, whilecanFix's full-scope reference analysis serves only the fix and does not affect whether we report. So it can be skipped wholesale when no fix is needed, with identical reporting results.Default behavior is unchanged (fixes are still computed as usual under LSP, the API, and
--fix); only the lint-only CLI path turns this analysis off, saving full-file symbol resolution on the common CI route.