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
Rule Change: Add support for suggestions for unused var #17545
Comments
Thanks for the proposal. Would this only apply to variables declared with |
My idea would be to support all kinds of unused variables to propose the suggestion, for example : 1.const { useState, useEffect } = require("react");
useEffect(); suggests : const { useEffect } = require("react");
useEffect(); 2.function() {
const { useState } = require("react");
let a = 1 + 1;
return a
} suggests : function() {
let a = 1 + 1;
return a
} 3.function({ foo, bar}) {
return bar;
} suggests : function({ bar}) {
return bar;
} 4.function({ foo, bar}) {
return null;
} suggests: function() {
return null;
} 5.function() {
let a = 1, b = 2;
const x = 1;
var c = 0;
return 1;
} suggests : function() {
return 1;
} |
I support this. There will be a lot of details (for example, #17546 (comment)) that I think we can figure out while working on the PR, or if the team prefers here in advance. Waiting for more opinions from other team members. |
Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update. |
This issue was auto-closed due to inactivity. While we wish we could keep responding to every issue, we unfortunately don't have the bandwidth and need to focus on high-value issues. |
@eslint/eslint-team what do you think of this proposal? |
I think adding suggestions is a good idea. Marking as accepted. @edi9999 would you be interested in submitting a PR? |
Currently, I'm not going to be able to work on this in the foreseeable future. I don't have that much of eslint internals knowledge yet and don't have much time to do it, I'm sorry. |
I can try to implement this. |
What rule do you want to change?
no-unused-vars
What change to do you want to make?
Implement suggestions
How do you think the change should be implemented?
A new default behavior
Example code
What does the rule currently do for this code?
Not propose any suggestion
What will the rule do after it's changed?
It will remove the line with the util.
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: