Skip to content

Commit 9eba4e6

Browse files
authored
completed eslint ts setup and fixed eslint issues (#112)
* completed eslint ts setup and fixed eslint issues * minor change in direction 😄 * upgraded type definitions * declared custom global variable * moved global var definition below imports
1 parent e31c51d commit 9eba4e6

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
## :arrow_forward: Usage
2727

2828
### Note on the legacy CLI
29-
There seems to be quite some confusion about the legacy CLI. This template only works with the new CLI. Make sure you have uninstalled the legacy `react-native-cli` first (`npm uninstall -g react-native-cli`), for the above command to work. If you wish to not use `npx`, you can also install the new CLI globally (`npm i -g @react-native-community/cli` or `yarn global add @react-native-community/cli`).
29+
There seems to be quite some confusion about the legacy CLI. This template only works with the new CLI. Make sure you have uninstalled the legacy `react-native-cli` first (`npm uninstall -g react-native-cli`), for the below command to work. If you wish to not use `npx`, you can also install the new CLI globally (`npm i -g @react-native-community/cli` or `yarn global add @react-native-community/cli`).
3030

3131
Further information can be found here: https://github.com/react-native-community/cli#about
3232

template/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import {
2626
ReloadInstructions,
2727
} from 'react-native/Libraries/NewAppScreen';
2828

29+
declare var global: {HermesInternal: null | {}};
30+
2931
const App = () => {
30-
const usingHermes = typeof HermesInternal === 'object' && HermesInternal !== null;
3132
return (
3233
<>
3334
<StatusBar barStyle="dark-content" />
@@ -36,7 +37,7 @@ const App = () => {
3637
contentInsetAdjustmentBehavior="automatic"
3738
style={styles.scrollView}>
3839
<Header />
39-
{!usingHermes ? null : (
40+
{global.HermesInternal == null ? null : (
4041
<View style={styles.engine}>
4142
<Text style={styles.footer}>Engine: Hermes</Text>
4243
</View>

template/_eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native-community',
4+
parser: '@typescript-eslint/parser',
5+
plugins: ['@typescript-eslint'],
46
};

template/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
"@babel/core": "^7.6.2",
1818
"@babel/runtime": "^7.6.2",
1919
"@react-native-community/eslint-config": "^0.0.5",
20-
"@types/jest": "^24.0.18",
21-
"@types/react-native": "^0.60.22",
22-
"@types/react-test-renderer": "16.9.0",
20+
"@types/jest": "^24.0.24",
21+
"@types/react-native": "^0.60.25",
22+
"@types/react-test-renderer": "16.9.1",
23+
"@typescript-eslint/eslint-plugin": "^2.12.0",
2324
"@typescript-eslint/parser": "^2.12.0",
2425
"babel-jest": "^24.9.0",
2526
"eslint": "^6.5.1",

0 commit comments

Comments
 (0)