Skip to content

[no-unused-vars] throws "Node must be provided when reporting error if location is not provided" on string enum #2486

Closed
@Samox

Description

@Samox
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro
I have added a failing test to my fork, you can check out the code Samox#1 and run cd packages/eslint-plugin && yarn test ./tests/eslint-rules/no-unused-vars.test.ts.

I'd be glad to fix the issue myself but have no idea how to do it.

I thought it would be easier with a failing test on your repo than a copy of package.json, tsconfig, etc.

Expected Result

String enum are properly parsed and the rule no-unused-vars does not throw "Node must be provided when reporting error if location is not provided" so we can easily find where the issue is.

Actual Result
I upgraded to typescript 4 and latest version of typescript-eslint. Eslint started throwing a "Node must be provided when reporting error if location is not provided". I had to add logs to eslint-plugin to understand where the issue was, it was an enum and I fixed the issue by removing the strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix: user errorissue was fixed by correcting the configuration / correcting the codepackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions