Skip to content
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

False positive for no-unused-vars #4888

Closed
florianwittmann opened this issue Aug 14, 2024 · 6 comments
Closed

False positive for no-unused-vars #4888

florianwittmann opened this issue Aug 14, 2024 · 6 comments
Assignees
Labels
A-linter Area - Linter C-bug Category - Bug

Comments

@florianwittmann
Copy link

In the following case text in the first line is found by no-unused-vars, but not found by the original eslint rule:

   const { text, ...dbEntry } = entry;
    return doSomething({
      ...dbEntry,
      someOtherProp
    });

Here we want to get entry without text and this seems to be one legit way to do this, hence text is not unused. This was tested with version 0.7.1.

@florianwittmann florianwittmann added the C-bug Category - Bug label Aug 14, 2024
@camc314
Copy link
Contributor

camc314 commented Aug 14, 2024

hmm this reports an error on text for me? maybe a diff between the eslint vs typescript eslint rule?

the quick solve for this is to do something like: const { text: _text, ...dbEntry } = entry although it requires changing code

Screenshot 2024-08-14 at 09 18 53

@DonIsaac
Copy link
Contributor

I think there's a bug in the code handling ignoreRestSiblings.

Just to confirm, you did set this option to true, correct?

@DonIsaac DonIsaac added the A-linter Area - Linter label Aug 14, 2024
@florianwittmann
Copy link
Author

Yes, it is active, with the following additional configuration:

      "no-unused-vars": [
        "warn",
        {
          "args": "none",
          "caughtErrors": "none",
          "ignoreRestSiblings": true,
          "vars": "all"
        }
      ],

@DonIsaac DonIsaac self-assigned this Aug 15, 2024
@DonIsaac
Copy link
Contributor

@florianwittmann can you please show me the command you're using to run oxlint?

DonIsaac added a commit that referenced this issue Aug 15, 2024
)

Add test cases that cover #4888. I can't reproduce the issue this way,
so I'll try running oxlint as a CLI instead. These test cases will be
useful to have in our repo anyways.
@DonIsaac
Copy link
Contributor

I am unable to reproduce this issue, please provide any additional setup/command arguments/etc you used so I can debug it.

@florianwittmann
Copy link
Author

Found the problem, it was referencing the wrong config file the hole time 🤦 Sorry, everything seems to work as intended, when configured correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

3 participants