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

New @typescript-eslint v4 rules: no-shadow, no-redeclare #127

Closed
nihalgonsalves opened this issue Sep 2, 2020 · 3 comments
Closed

New @typescript-eslint v4 rules: no-shadow, no-redeclare #127

nihalgonsalves opened this issue Sep 2, 2020 · 3 comments

Comments

@nihalgonsalves
Copy link

nihalgonsalves commented Sep 2, 2020

@typescript-eslint v4 adds these new rules:

This is required since the base rules report false positives in TypeScript (e.g. no-shadow reports enums) with the v4 typescript-eslint release (due to breaking changes in the scope analysis engine).

  • The no-shadow rule should be turned off and replaced with @typescript-eslint/no-shadow
  • The no-redeclare rule should be turned off and replaced with @typescript-eslint/no-redeclare
@marcoreni
Copy link

Jumping in to report that the same is valid for @typescript-eslint/no-redeclare.

See v4 release notes here: https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0

@nihalgonsalves nihalgonsalves changed the title @typescript-eslint v4 and no-shadow New @typescript-eslint v4 rules: no-shadow, no-redeclare Sep 2, 2020
@iamturns
Copy link
Owner

iamturns commented Sep 5, 2020

Fixed in #129 and release as v10.0.0 (thanks again @kripod )

@iamturns iamturns closed this as completed Sep 5, 2020
@japalo
Copy link

japalo commented Sep 8, 2020

I still had issues with this when using create react app. The issues went away after downgrading both this package and typescript. If this helps anyone out there getting stuck on this until every package is updated with the same workaround, it helped me to do the following:

First remove your node_modules. (rm -rf node_modules)
Then make sure your typescript is set to:

"typescript": "3.7.2"

Then, install previous version of this package:

yarn add -D eslint-config-airbnb-typescript@9.0.0 \
            eslint-plugin-jsx-a11y@^6.3.1 \
            eslint-plugin-react@^7.20.3 \
            eslint-plugin-react-hooks@^4.0.8 \
            @typescript-eslint/eslint-plugin@^3.6.1

NOTE: this is not a fix. This is a workaround while waiting for react-scripts to release their fix. They are aware of the problem. If you want to track it, here is the issue: facebook/create-react-app#9515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants