Description
Description:
We are getting the following error when using eslint for our project bootstrapped by React Native Template TypeScript:
WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.2.1 <3.6.0
YOUR TYPESCRIPT VERSION: 3.7.5
Please only submit bug reports when using the officially supported version.
After investigation, I found that this was caused by the eslint plugin @react-native-community/eslint-config in the React Native Template TypeScript package.json
dependency.
In the package.json
of the plugin eslint-config-react-native-community, it used quite old version ^1.5.0
for both @typescript-eslint/eslint-plugin and @typescript-eslint/parser, which supports up to typescript <3.6.0
.
But both @typescript-eslint/eslint-plugin and @typescript-eslint/parser have latest versions of ^2.20.0
which supports typescript >=3.2.1 <3.8.0
.
It might be better to make sure that the typescript version is in the range specified by @react-native-community/eslint-config in the React Native Template TypeScript (maybe pin the typescript version in the template is a way?).
Besides, it would also be needed to update the @typescript-eslint/eslint-plugin and @typescript-eslint/parser version in @react-native-community/eslint-config package.json
more frequently to ensure that they include more latest typescript version.
React Native version:
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 254.70 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.16.0 - /var/folders/5s/n_jyp2w15398z_jssgm979bh0000gn/T/yarn--1582470219059-0.421675122443812/node
Yarn: 1.22.0 - /var/folders/5s/n_jyp2w15398z_jssgm979bh0000gn/T/yarn--1582470219059-0.421675122443812/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.3
System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
Steps To Reproduce
npx react-native init MyApp --template react-native-template-typescript
yarn lint
Expected Results
No error or warning in the console.
Snack, code example, screenshot, or link to a repository:
Similar issue in Create React App: facebook/create-react-app#7255