Skip to content

Commit e4eca86

Browse files
committed
removed tslint for more consistency with the default RN template
1 parent 79b0923 commit e4eca86

File tree

9 files changed

+79
-77
lines changed

9 files changed

+79
-77
lines changed

App.tsx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* Generated with the TypeScript template
6+
* https://github.com/emin93/react-native-template-typescript
7+
*/
8+
9+
import * as React from 'react';
10+
import {
11+
Platform,
12+
StyleSheet,
13+
Text,
14+
View
15+
} from 'react-native';
16+
17+
const instructions = Platform.select({
18+
ios: 'Press Cmd+R to reload,\n' +
19+
'Cmd+D or shake for dev menu',
20+
android: 'Double tap R on your keyboard to reload,\n' +
21+
'Shake or press menu button for dev menu',
22+
});
23+
24+
interface Props {};
25+
export default class App extends React.Component<Props> {
26+
render() {
27+
return (
28+
<View style={styles.container}>
29+
<Text style={styles.welcome}>
30+
Welcome to React Native!
31+
</Text>
32+
<Text style={styles.instructions}>
33+
To get started, edit App.tsx
34+
</Text>
35+
<Text style={styles.instructions}>
36+
{instructions}
37+
</Text>
38+
</View>
39+
);
40+
}
41+
}
42+
43+
const styles = StyleSheet.create({
44+
container: {
45+
flex: 1,
46+
justifyContent: 'center',
47+
alignItems: 'center',
48+
backgroundColor: '#F5FCFF',
49+
},
50+
welcome: {
51+
fontSize: 20,
52+
textAlign: 'center',
53+
margin: 10,
54+
},
55+
instructions: {
56+
textAlign: 'center',
57+
color: '#333333',
58+
marginBottom: 5,
59+
},
60+
});

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Clean and minimalist React Native template for a quick start with TypeScript.
44

55
This template can be used with the React Native CLI, which means it doesn't mess with the platform specific files. Instead of including a lot of dependencies, my aim when creating this template was to provide a very easy and minimalist way to start your React Native project with TypeScript. Of course you can always include other dependencies as you need them.
66

7+
## :star: Features
8+
9+
- Seamless integration with the React Native CLI
10+
- Always latest dependencies
11+
- React Native TypeScript transformer directly integrated into the packager! (No separate process for TSC)
12+
- Unit testing in TypeScript with Jest
13+
714
## :arrow_forward: Quick Start
815

916
```
@@ -20,8 +27,6 @@ node setup.js
2027
- [React Native TypeScript transformer](https://github.com/ds300/react-native-typescript-transformer)
2128
- [Type definitions for React & React Native](https://github.com/DefinitelyTyped/DefinitelyTyped)
2229
- [TS Jest](https://github.com/kulshekhar/ts-jest)
23-
- [TSLint](https://github.com/palantir/tslint)
24-
- [TSLint React](https://github.com/palantir/tslint-react)
2530

2631
This template always uses the latest versions of the dependencies at the time when the setup script (`node setup.js`) is being executed. This means you don't have to worry about old versions.
2732

@@ -35,7 +40,7 @@ The React Native CLI supports automatic installation of production dependencies
3540

3641
The React Native CLI will do everything just as without a template and afterwards overwrite the files with the ones from this template. This means you don't have to worry about incompatibility issues with later React Native upgrades.
3742

38-
## :hearts: Contributing
43+
## :computer: Contributing
3944

4045
Contributions are very welcome. Please try to stay consistent with the other files I've created.
4146

__tests__/App.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import * as React from "react";
2-
import "react-native";
3-
import { create } from "react-test-renderer";
1+
import 'react-native';
2+
import * as React from 'react';
3+
import App from '../App';
44

5-
import App from "../src/App";
5+
// Note: test renderer must be required after react-native.
6+
import * as renderer from 'react-test-renderer';
67

7-
it("renders correctly", () => {
8-
const tree = create(<App exampleProp="helloWorld" />);
8+
it('renders correctly', () => {
9+
const tree = renderer.create(
10+
<App />
11+
);
912
});

devDependencies.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[
22
"typescript",
3-
"tslint",
4-
"tslint-react",
53
"react-native-typescript-transformer",
64
"ts-jest",
75
"@types/react",

index.js renamed to index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { AppRegistry } from 'react-native';
2-
import App from './src/App';
2+
import App from './App';
33

44
AppRegistry.registerComponent('HelloWorld', () => App);

setup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(),
1212
console.log('🔄 Please wait...');
1313

1414
packageJson.scripts.start = `${packageJson.scripts.start} --config ../../../../rn-cli.config.js`;
15-
packageJson.scripts.lint = 'tslint -c tslint.json "src/**/*.{ts,tsx}"';
1615
packageJson.jest = Object.assign(packageJson.jest, jestJson);
1716
writeFile('package.json', JSON.stringify(packageJson, null, 2));
1817

src/App.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"jsx": "react",
55
"noEmit": true,
66
"moduleResolution": "node",
7+
"noImplicitAny": true
78
},
89
"exclude": [
910
"node_modules"

tslint.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)