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

eslint-config-react-native-community package need to update #33642

Closed
pureliumy opened this issue Apr 14, 2022 · 10 comments
Closed

eslint-config-react-native-community package need to update #33642

pureliumy opened this issue Apr 14, 2022 · 10 comments
Labels
Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@pureliumy
Copy link

Description

Problem
There are many no-shadow and no-undef lint errors while using @react-native-community/[email protected].

Description
@react-native-community/[email protected] has updated @typescript-eslint/parser to 4.33.0. And there are some behaviors have been changed since @typescript-eslint/[email protected], so @react-native-community/eslint-config need to update.

For example. no-undef is recommended to be off after @typescript-eslint/[email protected], but this rule in @react-native-community/[email protected] is missing.

And I notice that these new rules are actually existed in current file already. So I think the problem will be resolved if you just publish a new version that includes the new rules.

Version

0.63.3

Output of npx react-native info

System:
OS: macOS 11.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 1.55 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: Not Found
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  1. install @react-native-community/[email protected] and [email protected].
yarn add @react-native-community/[email protected] [email protected] -D
  1. extends @react-native-community in your eslint config file.
// .eslintrc.js
module.exports = {
  extends: '@react-native-community',
}
  1. run lint script.
eslint -c --ext .js,.ts,.tsx  src/

Snack, code example, screenshot, or link to a repository

Code

export interface Props {
  children: React.ReactElement;
}

Error

11:34  error  'React' is not defined  no-undef
@alxmiron
Copy link

Please push @react-native-community/[email protected] to npm, because it has updates of @typescript-eslint/eslint-plugin ^5.15.0 and @typescript-eslint/parser ^5.15.0, that allows using of TS v4.5 type import modifiers.

Now it throws an error:
image

@Aure77
Copy link

Aure77 commented Apr 20, 2022

Temporary fix in your package.json (if you are using Yarn):

  "resolutions": {
    "@typescript-eslint/eslint-plugin": "5.15.0",
    "@typescript-eslint/parser": "5.15.0"
  },

to force @react-native-community/eslint-config to use 5.15.0 typescript eslint parser.

@sseppola
Copy link

sseppola commented Apr 22, 2022

Looks like the necessary changes have already been merged: #32800

Just missing npm publish

Edit: Another merged PR that fixes this issue: #33448
It also solves the flowtype error that occurs after applying @Aure77's fix.

@ginnymin
Copy link

Any updates on this?

@cortinico
Copy link
Contributor

Just missing npm publish

Just published 👍

@cortinico cortinico added Resolution: Fixed A PR that fixes this issue has been merged. and removed Needs: Triage 🔍 labels May 12, 2022
@SohelIslamImran
Copy link

@cortinico Why still 7?

@wwdrew
Copy link

wwdrew commented Jul 25, 2022

@cortinico Hi, a new commit (f3db6cc) has landed that updates this package to work with ESLint 8. Would it be possible to publish a new release of this package?

I was going to submit a separate PR to upgrade the version of this package used in the template, but thought it might be more worthwhile to wait until the ESLint 8 support has been finalised first.

@cortinico
Copy link
Contributor

@cortinico
Copy link
Contributor

Just pulished on NPM 👍

@wwdrew
Copy link

wwdrew commented Aug 1, 2022

Thanks so much @cortinico! I'm just testing it now with ESLint 8 and so far all looking great. If all goes well, I'll submit a PR to update the dependencies in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests

8 participants