Skip to content

Commit

Permalink
feat(noUnusedFunctionParameters): add lint for unused function parame…
Browse files Browse the repository at this point in the history
…ters, instead of using noUnusedVariables (#2899)

Co-authored-by: printfn <[email protected]>
  • Loading branch information
printfn and printfn committed May 31, 2024
1 parent 9e4feb6 commit bc30892
Show file tree
Hide file tree
Showing 15 changed files with 600 additions and 44 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
- Add [nursery/noUnmatchableAnbSelector](https://biomejs.dev/linter/rules/no-unmatchable-anb-selector). [#2706](https://github.com/biomejs/biome/issues/2706) Contributed by @togami2864
- Add [nursery/useGenericFontNames](https://biomejs.dev/linter/rules/use-generic-font-names). [#2573](https://github.com/biomejs/biome/pull/2573) Contributed by @togami2864
- Add [nursery/noYodaExpression](https://biomejs.dev/linter/rules/no-yoda-expression/). Contributed by @michellocana
- Add [nursery/noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters/) Contributed by @printfn

#### Enhancements

Expand Down
103 changes: 61 additions & 42 deletions crates/biome_configuration/src/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_diagnostics_categories/src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ define_categories! {
"lint/nursery/noUnknownSelectorPseudoElement": "https://biomejs.dev/linter/rules/no-unknown-selector-pseudo-element",
"lint/nursery/noUnknownUnit": "https://biomejs.dev/linter/rules/no-unknown-unit",
"lint/nursery/noUnmatchableAnbSelector": "https://biomejs.dev/linter/rules/no-unmatchable-anb-selector",
"lint/nursery/noUnusedFunctionParameters": "https://biomejs.dev/linter/rules/no-unused-function-parameters",
"lint/nursery/noUselessStringConcat": "https://biomejs.dev/linter/rules/no-useless-string-concat",
"lint/nursery/noUselessUndefinedInitialization": "https://biomejs.dev/linter/rules/no-useless-undefined-initialization",
"lint/nursery/noYodaExpression": "https://biomejs.dev/linter/rules/no-yoda-expression",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ declare_rule! {
/// If you want to report unused imports,
/// enable [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports/).
///
/// From `v1.9.0`, the rule won't check unused function parameters any more.
/// Users should switch to
/// [noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters/)
///
/// ## Examples
///
/// ### Invalid
Expand Down Expand Up @@ -65,7 +69,7 @@ declare_rule! {
/// export function f<T>() {}
/// ```
///
/// # Valid
/// ### Valid
///
/// ```js
/// function foo(b) {
Expand Down Expand Up @@ -99,7 +103,7 @@ declare_rule! {
}
}

/// Suggestion if the bindnig is unused
/// Suggestion if the binding is unused
#[derive(Debug)]
pub enum SuggestedFix {
/// No suggestion will be given
Expand Down
2 changes: 2 additions & 0 deletions crates/biome_js_analyze/src/lint/nursery.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc30892

Please sign in to comment.