8000 [no-shadow] False positive with const enum and module augmentation · Issue #2484 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

[no-shadow] False positive with const enum and module augmentation< 8000 /bdi> #2484

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
sveyret opened this issue Sep 4, 2020 · 2 comments
Closed
3 tasks done

[no-shadow] False positive with const enum and module augmentation #2484

sveyret opened this issue Sep 4, 2020 · 2 comments
Labels
duplicate This issue or pull request already exists fix: user error issue was fixed by correcting the configuration / correcting the code package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@sveyret
Copy link
Contributor
sveyret commented Sep 4, 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

{
  "rules": {
    "no-shadow": ["error", { "hoist": "all" }]
  }
}
export const enum MyEnum {
  // error  'MyEnum' is already declared in the upper scope  no-shadow
  Value1,
  Value2,
  Value3,
}

declare module '@material-ui/core/styles/createMuiTheme' {
  interface Theme {
    // error  'Theme' is already declared in the upper scope  no-shadow
    windowSize: number
  }
}

Expected Result

There should be no eslint error, because nothing is shadowed.

Actual Result

Eslint indicate an error for both the const enum and the re-defined interface.

Additional Info

This is a regression, my code was compiling without complaining before I upgraded to latest versions.
I write this issue here because it is related to Typescript and may also be related to the correction of #325.

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 14.4.0
@sveyret sveyret added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Sep 4, 2020
@tadhgmister
Copy link
Contributor

are you using the base eslint rule o 8000 r ours? the config should look something like

{
  // note you must disable the base rule as it can report incorrect errors
  "no-shadow": "off",
  "@typescript-eslint/no-shadow": ["error"]
}

as mentioned in the docs

@bradzacher bradzacher added fix: user error issue was fixed by correcting the configuration / correcting the code duplicate This issue or pull request already exists and removed triage Waiting for team members to take a look labels Sep 4, 2020
@bradzacher
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists 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
0