refactor(linter): reduce repeat code in JS plugin linting#17087
Conversation
CodSpeed Performance ReportMerging #17087 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the JS plugin linting code to reduce duplication by extracting the &mut Program from ContextHost once at the beginning of run_external_rules, rather than performing this extraction in two separate code paths. This simplification makes the code more maintainable and sets up for future optimizations.
Key changes:
- Moved the
Semanticextraction andProgrampointer creation to happen before branching onjs_allocator_pool - Updated
clone_into_fixed_size_allocator_and_run_external_rulesto accept an already-extracted&Programinstead of extracting it internally - Swapped parameter order in
convert_and_call_external_linterto placeprogrambeforeallocatorfor consistency
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
Follow-on after #17013. Refactor. Reduce repeated code by getting a `&mut Program` out of the `ContextHost` at the start of the process, instead of in 2 places later on. This also enables an optimization in next PR.
9a293a2 to
61f2138
Compare
fee8a45 to
22124c0
Compare
…ize allocator (#17088) Follow-on after #17013. We already copy the source text into the new fixed-sized allocator. Prevent the source also being cloned by `program.clone_in(allocator)` - that's unnecessary as we immediately overwrite it. This is enabled by #17087, which allows us to have a `&mut Program` at this point.

Follow-on after #17013. Refactor.
Reduce repeated code by getting a
&mut Programout of theContextHostat the start of the process, instead of in 2 places later on.This also enables an optimization in next PR.