fix(plugins): credit NestJS framework-dispatched lifecycle/handler methods as used#853
Closed
BartWaardenburg wants to merge 3 commits into
Closed
fix(plugins): credit NestJS framework-dispatched lifecycle/handler methods as used#853BartWaardenburg wants to merge 3 commits into
BartWaardenburg wants to merge 3 commits into
Conversation
…thods as used Fixes #843
- Fix clippy uninlined_format_args in nestjs test - Add real end-to-end regression test + fixture (fails before / passes after) - Document detection behavior in detection.md and CHANGELOG
041dd6e to
e5c09d8
Compare
Collaborator
Author
|
Landed on main via maintainer direct-to-main flow, squashed into 4a5d0b2. The linked issue is fixed on main; closing this PR as redundant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaced the
define_plugin!macro incrates/core/src/plugins/nestjs.rswith a manualimpl Pluginthat returnsused_class_member_rules(). Added 11implements-scoped rules coveringNestModule.configure, the five lifecycle hook interfaces (OnModuleInit,OnModuleDestroy,OnApplicationBootstrap,BeforeApplicationShutdown,OnApplicationShutdown), and the five handler dispatch interfaces (CanActivate,NestInterceptor,PipeTransform,ExceptionFilter,NestMiddleware). Added 7 unit tests including a regression test that assertsconfigureis credited as used for aNestModuleimplementor while a genuinely-unused method on the same class is not credited.Review
Verdict: SHIP
implements OnModuleInitalso creditsonModuleDestroy). This is intentional and more correct (NestJS dispatches lifecycle hooks by duck-typed method-name presence, not interface declaration) and is documented in the doc/inline comments, so it reduces false positives rather than introducing false negatives. Handler-dispatch interfaces are correctly single-method-scoped.crates/core/src/plugins/oxlint.rs(parallel-agent / pre-existing change). The patch itself does not touch it.Closes #843