Closed DonIsaac closed 3 weeks ago
I attempted to do this, but I had an absolute heck of a time getting the lifetimes to work out properly. I'm not experienced enough with Rust yet to know exactly where the mistake is, so help appreciated: https://github.com/oxc-project/oxc/pull/6049
Closing this as done with https://github.com/oxc-project/oxc/pull/6722, we even got the extra credit 😄
This is a big one. I haven't taken the time to write this down until now.
Problem
Most (if not all)
eslint-plugin-jest
rules usecollect_possible_jest_call_node
in arun_once
block, then pass those nodes to an internal "run" implementation. For example,This is problematic. Each jest rule repeats the same work, which wastes cycles. To make things worse,
collect_possible_jest_call_node
allocates nodes it discovers onto the heap.(Possible) Solution
Rule
trait, adding arun_on_jest_node
method.Linter::run
to usecollect_possible_jest_call_node
and pass a reference to them torule.run_on_jest_node
run_once
impls from jest/vitest rules.Acceptance Criteria
Linter
should skip jest node collection if neither the jest or vitest plugins are enabledExtra Credit
Bonus points if you can refactor
collect_possible_jest_node
to return animpl Iterator
instead of aVec
.CC: @camchenry, who has actively been making performance improvements to the linter.