Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.

Setup Community Lint Config and CI #401

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
libdefs.js
node_modules
build
21 changes: 0 additions & 21 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@react-native-community',
};
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on: push

jobs:
typecheck:
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [10.18.1]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn
- run: yarn lint
- run: yarn build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules
**/.DS_Store
.idea
build
.eslintcache
yarn-error.log
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: "all",
};
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
mkdir -p build
babel index.js > build/index.js
babel styles.js > build/styles.js
2 changes: 0 additions & 2 deletions build/styles.js

This file was deleted.

23 changes: 7 additions & 16 deletions examples/Basic/Basic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import React, {Component} from 'react';
import {
StyleSheet,
Text,
Expand Down Expand Up @@ -60,10 +60,10 @@ export default class Basic extends Component {
}

updateMenuState(isOpen) {
this.setState({ isOpen });
this.setState({isOpen});
}

onMenuItemSelected = item =>
onMenuItemSelected = (item) =>
this.setState({
isOpen: false,
selectedItem: item,
Expand All @@ -77,12 +77,9 @@ export default class Basic extends Component {
<SideMenu
menu={menu}
isOpen={this.state.isOpen}
onChange={isOpen => this.updateMenuState(isOpen)}
>
onChange={(isOpen) => this.updateMenuState(isOpen)}>
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
Expand All @@ -94,14 +91,8 @@ export default class Basic extends Component {
Current selected menu item is: {this.state.selectedItem}
</Text>
</View>
<TouchableOpacity
onPress={this.toggle}
style={styles.button}
>
<Image
source={image}
style={{ width: 32, height: 32 }}
/>
<TouchableOpacity onPress={this.toggle} style={styles.button}>
<Image source={image} style={{width: 32, height: 32}} />
</TouchableOpacity>
</SideMenu>
</SafeAreaView>
Expand Down
17 changes: 4 additions & 13 deletions examples/Basic/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,19 @@ const styles = StyleSheet.create({
},
});

export default function Menu({ onItemSelected }) {
export default function Menu({onItemSelected}) {
return (
<ScrollView scrollsToTop={false} style={styles.menu}>
<View style={styles.avatarContainer}>
<Image
style={styles.avatar}
source={{ uri }}
/>
<Image style={styles.avatar} source={{uri}} />
<Text style={styles.name}>Your name</Text>
</View>

<Text
onPress={() => onItemSelected('About')}
style={styles.item}
>
<Text onPress={() => onItemSelected('About')} style={styles.item}>
About
</Text>

<Text
onPress={() => onItemSelected('Contacts')}
style={styles.item}
>
<Text onPress={() => onItemSelected('Contacts')} style={styles.item}>
Contacts
</Text>
</ScrollView>
Expand Down
4 changes: 1 addition & 3 deletions examples/Basic/__tests__/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ import Index from '../index.android.js';
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
const tree = renderer.create(<Index />);
});
4 changes: 1 addition & 3 deletions examples/Basic/__tests__/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ import Index from '../index.ios.js';
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
const tree = renderer.create(<Index />);
});
2 changes: 1 addition & 1 deletion examples/Basic/index.android.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppRegistry } from 'react-native';
import {AppRegistry} from 'react-native';

import Basic from './Basic';

Expand Down
2 changes: 1 addition & 1 deletion examples/Basic/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppRegistry } from 'react-native';
import {AppRegistry} from 'react-native';

import Basic from './Basic';

Expand Down
Loading