Skip to content

[no-shadow] False positive on export enum X declaration #2471

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

Closed
3 tasks done
AArnott opened this issue Sep 2, 2020 · 2 comments
Closed
3 tasks done

[no-shadow] False positive on export enum X declaration #2471

AArnott opened this issue Sep 2, 2020 · 2 comments
Labels
fix: user error issue was fixed by correcting the configuration / correcting the code package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@AArnott
Copy link

AArnott commented Sep 2, 2020

  • 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

git clone https://github.com/AArnott/pr-autocomplete-app
cd pr-autocomplete-app
git checkout eslintbug_2471
yarn
yarn lint

A single export enum in the entire compilation, with no imports, such as this:

export enum MergeMethods3 {
  merge = "merge",
}

Expected Result

No lint errors

Actual Result

/home/andrew/git/pr-autocomplete-app/GitHubHook/index.ts
  1:13  error  'MergeMethods3' is already declared in the upper scope  no-shadow

Additional Info

This regressed in AArnott/pr-autocomplete-app#65 where we upgrade @typescript-eslint/parser from 3.10.1 to 4.0.1.

No matter what I name the enum, it rejects it with the same error.

Versions

package version
@typescript-eslint/eslint-plugin 4.0.1
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.8.1
node 12.16.1
@AArnott AArnott added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Sep 2, 2020
@bradzacher bradzacher added fix: user error issue was fixed by correcting the configuration / correcting the code and removed triage Waiting for team members to take a look labels Sep 2, 2020
@bradzacher
Copy link
Member

As per the release notes (https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) you need to use @typescript-eslint/no-shadow, not the base eslint rule.

See also #2466

@karladler
Copy link

karladler commented Sep 22, 2020

Fixed it for me:

'no-shadow': 'off', // replaced by ts-eslint rule below
'@typescript-eslint/no-shadow': 'error'

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fix: user error issue was fixed by correcting the configuration / correcting the code package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants