Skip to content

Commit 631ce3d

Browse files
committed
Initial commit
0 parents  commit 631ce3d

10 files changed

+221
-0
lines changed

Diff for: .eslintrc

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"react-native/react-native": true
5+
},
6+
"extends": ["airbnb", "plugin:react/recommended"],
7+
"globals": {
8+
"__DEV__": false
9+
},
10+
"parser": "babel-eslint",
11+
"plugins": [
12+
"react",
13+
"react-native"
14+
],
15+
"rules": {
16+
"arrow-parens": ["error", "as-needed"],
17+
"class-methods-use-this": "off",
18+
"comma-dangle": ["error", {
19+
"arrays": "always-multiline",
20+
"objects": "always-multiline",
21+
"imports": "always-multiline",
22+
"exports": "always-multiline",
23+
"functions": "ignore"
24+
}],
25+
"indent": ["error", 2, {
26+
"SwitchCase": 1
27+
}],
28+
"global-require": "off",
29+
"no-console": ["error", {
30+
"allow": ["warn", "error"]
31+
}],
32+
"no-underscore-dangle": ["error", {
33+
"allowAfterThis": true
34+
}],
35+
"no-use-before-define": ["error", {
36+
"variables": false
37+
}],
38+
"object-curly-newline": "off",
39+
"operator-linebreak": "off",
40+
"radix": "off",
41+
42+
"import/extensions": ["error", {
43+
"js": "never",
44+
"graphql": "always",
45+
"png": "always"
46+
}],
47+
"import/no-named-as-default": "off",
48+
"import/no-unresolved": ["error", {
49+
"ignore": ["^[~]"]
50+
}],
51+
52+
"react/jsx-filename-extension": ["error", {
53+
"extensions": [".js", ".jsx"]
54+
}],
55+
"react/jsx-indent": ["error", 2],
56+
"react/jsx-indent-props": ["error", 2],
57+
"react/jsx-one-expression-per-line": "off",
58+
"react/prefer-stateless-function": ["warn", {
59+
"ignorePureComponents": true
60+
}],
61+
62+
"react-native/no-inline-styles": "error"
63+
}
64+
}

Diff for: .npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LICENSE
2+
README.MD

Diff for: App.js

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

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Luciano Lima
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: README.md

Whitespace-only changes.

Diff for: devDependencies.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"babel-eslint": "^8.2.2",
3+
"eslint": "^4.19.1",
4+
"eslint-config-airbnb": "^17.0.0",
5+
"eslint-plugin-import": "^2.12.0",
6+
"eslint-plugin-jsx-a11y": "^6.0.3",
7+
"eslint-plugin-react": "^7.9.1",
8+
"eslint-plugin-react-native": "^3.2.1"
9+
}

Diff for: index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @format */
2+
3+
import {AppRegistry} from 'react-native';
4+
import App from './App';
5+
import {name as appName} from './app.json';
6+
7+
AppRegistry.registerComponent(appName, () => App);

Diff for: package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "react-native-template-basic",
3+
"version": "0.0.1",
4+
"author": "Luciano Lima <[email protected]>",
5+
"description": "Template to create a new React Native project with ESLint",
6+
"homepage": "https://github.com/lucianomlima/react-native-template-basic",
7+
"license": "MIT",
8+
"bugs": {
9+
"url": "https://github.com/lucianomlima/react-native-template-basic/issues"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "[email protected]:lucianomlima/react-native-template-basic.git"
14+
},
15+
"keywords": [
16+
"react-native",
17+
"template",
18+
"eslint"
19+
]
20+
}

Diff for: rn-cli.config.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const deleteFile = filename => {
5+
try {
6+
return fs.unlinkSync(path.join(__dirname, filename));
7+
} catch (error) {}
8+
}
9+
10+
console.log('🔁 Applying custom scripts...');
11+
12+
// Inject scripts in package.json
13+
const scripts = require('./scripts.json');
14+
const packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
15+
const updatedPackageJSON = Object.assign({}, packageJSON, scripts);
16+
fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(updatedPackageJSON, null, 2));
17+
18+
// Remove files
19+
deleteFile('LICENSE');
20+
deleteFile('README.md');
21+
deleteFile('devDependencies.json');
22+
deleteFile('scripts.json');
23+
deleteFile('rn-cli.config.js');
24+
25+
console.log(`🆗 Finished.`);

Diff for: scripts.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"scripts": {
3+
"android:build": "cd android && ./gradlew assembleRelease",
4+
"android:install": "react-native run-android --variant=\"Release\"",
5+
"android:shake": "$ANDROID_HOME/platform-tools/adb shell input keyevent 82",
6+
"ios:install": "react-native run-ios --configuration Release",
7+
"project:clean": "rm -Rf $TMPDIR/react-* node_modules && watchman watch-del-all && yarn cache clean && cd android && ./gradlew clean && cd .. && yarn",
8+
"lint": "eslint --ext .js src/** ",
9+
"start": "node node_modules/react-native/local-cli/cli.js start",
10+
"start:clean": "yarn start --reset-cache",
11+
"test": "jest",
12+
"test:watch": "yarn test -- --watch"
13+
}
14+
}

0 commit comments

Comments
 (0)