-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
feat(lint): add the ignoreRestSiblings
option for lint/correctness/noUnusedVariables
#5157
base: main
Are you sure you want to change the base?
Conversation
@Conaclos what do you think about the default value? |
Thanks for approving the CI run! I fixed linting/formatting checks. Two jobs (codegen and tests) are still falling. CodegenCodegen is obvious – but I can’t run it locally due to a silly error (which I can’t figure out how to fix), so I’d appreciate if you can do it: $ cargo codegen-configuration
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.52s
Running `target/debug/xtask_codegen configuration`
> rustfmt --version
rustfmt 1.8.0
Error: Failed to run rustfmt from toolchain 'stable'. Please run `rustup component add rustfmt --toolchain stable` to install it.
$ rustup component add rustfmt --toolchain stable
info: component 'rustfmt' for target 'aarch64-apple-darwin' is up to date
$ which rustfmt
/opt/homebrew/bin/rustfmt TestsI’m not sure why there’s such a diff between local and CI test runs, but I’m happy to hand-fix the snapshots if you say this is expected: |
crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/correctness/no_unused_variables.rs
Outdated
Show resolved
Hide resolved
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.
Can you please add a changeset?
I don't usually use |
Thanks! Replacing the brew-installed |
I think it makes sense of turning off |
5 │ | ||
|
||
i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. | ||
|
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.
I wonder if we could add a note indicating that users can ignore rest sibling with the ignoreRestSiblings
option.
This could improve option discovery.
We could display this note only for rest siblings like in the current case.
CodSpeed Performance ReportMerging #5157 will not alter performanceComparing Summary
|
Summary
This pull request adds an
ignoreRestSiblings
option forlint/correctness/noUnusedVariables
. The option is similar to its ESLint alternative: https://eslint.org/docs/latest/rules/no-unused-vars#ignorerestsiblingsThe option defaults to
true
(unlike its ESLint alternative) to avoid introducing a breaking change. (I’d love it if we could flip the default tofalse
in the next major – as that would allow stricter linting by default – but this is not my call to make.)Closes: #5152
Note: I have zero experience with Rust, so I had to Cursor my way through this PR. The (new) tests do pass, but sorry if there are any glaring omissions!
Test Plan
Tests should pass, I guess?