Repository navigation
Support default parameters in plugin-activation-args - #167
Open
Yash990-bit wants to merge 2 commits into
Open
Yash990-bit wants to merge 2 commits into
Yash990-bit wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The initializer shortcut incorrectly suppresses optionalNotNullable for explicitly non-nullable parameters, allowing the activation body to receive a missing service while assuming a non-nullable type.
1 open issue
What changed in this PR
This PR addresses #166 by teaching plugin-activation-args to recognize defaulted activation parameters, avoiding false missing-argument and argument-count reports.
Changes:
- Extract parameter names and types from default-value assignments while preserving parameter positions.
- Add initializer-based nullability handling.
- Add regression tests for defaulted parameters, referenced functions, method shorthand, and invalid token types or ordering.
| File | Description |
|---|---|
| tests/jupyter-plugin-activation-args.test.ts | Adds valid and invalid cases covering defaulted activation parameters. |
| src/rules/plugin-activation-args.ts | Handles defaulted parameters during extraction and updates nullability checks. |
Review effort: Balanced
This branch has not been deployed
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.

Close #166
Summary
Fixes a false positive in
plugin-activation-argswhere activation functions using default parameter values (e.g.trans: ITranslator | null = null) were erroneously reported for missing arguments and incorrect argument counts.Background & Cause
In
src/rules/plugin-activation-args.ts,extractFunctionInfofilteredfn.paramswith: