-
-
Notifications
You must be signed in to change notification settings - Fork 803
feat(lint): new rule: no parameters only used in recursion #7926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dyc3
merged 15 commits into
biomejs:main
from
matanshavit:feat/no-parameters-only-used-in-recursion
Oct 31, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ffefe8f
feat(lint): add noParametersOnlyUsedInRecursion rule scaffold
matanshavit 5bfba00
feat(lint): implement noParametersOnlyUsedInRecursion rule logic
matanshavit 2854aae
feat(lint): enhance noParametersOnlyUsedInRecursion to handle arithme…
matanshavit b5c5908
feat(lint): add code action for noParametersOnlyUsedInRecursion
matanshavit f59a63e
refactor(lint): fix clippy warnings in noParametersOnlyUsedInRecursion
matanshavit 5192632
docs: add changeset for noParametersOnlyUsedInRecursion rule
matanshavit 9bfd4e7
feat(lint): add arrow function support to noParametersOnlyUsedInRecur…
matanshavit 1f72617
refactor(lint): optimize noParametersOnlyUsedInRecursion performance
matanshavit 8c5950d
feat(lint): support assignment expressions in noParametersOnlyUsedInR…
matanshavit 5208a38
feat(lint): support logical operators in noParametersOnlyUsedInRecursion
matanshavit add0a52
feat(lint): support conditional expressions in noParametersOnlyUsedIn…
matanshavit a53b2e8
feat(lint): support optional chaining and computed members in noParam…
matanshavit 2eef0e6
docs(lint): add examples for logical operators and optional chaining …
matanshavit 213c001
refactor(lint): use let-chain in noParametersOnlyUsedInRecursion
matanshavit 7beb492
Apply suggestions from code review
matanshavit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Added the rule [`noParametersOnlyUsedInRecursion`](https://biomejs.dev/linter/rules/no-parameters-only-used-in-recursion/). | ||
|
|
||
| This rule detects function parameters that are exclusively used in recursive calls and can be removed to simplify the function signature since they are effectively unused. | ||
|
|
||
| ```js | ||
| function factorial(n, acc) { | ||
| if (n === 0) return 1; | ||
| return factorial(n - 1, acc); // acc is only used here | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| Fixes [#6484](https://github.com/biomejs/biome/issues/6484). |
107 changes: 64 additions & 43 deletions
107
crates/biome_configuration/src/analyzer/linter/rules.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new rule creates changes down the array because the linter rules should stay alphabatized/ordered