Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hola-soy-milk committed Oct 29, 2023
1 parent 2cb2e33 commit b1327a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ import { SafeAreaView, StyleSheet, View, Text } from "react-native";
import Constants from "expo-constants";
import { colors } from "../styles/constants";

type Props = {
label: string;
};

export default function Header(props: Props) {
return (
<SafeAreaView style={styles.safeArea}>
<View style={styles.container}>
<Text style={styles.label}>{props.label}</Text>
</View>
</SafeAreaView>
);
}

const styles = StyleSheet.create({
safeArea: {
backgroundColor: colors.cardBackground,
Expand All @@ -151,6 +137,20 @@ const styles = StyleSheet.create({
textAlign: "center",
},
});
type Props = {
label: string;
};

export default function Header(props: Props) {
return (
<SafeAreaView style={styles.safeArea}>
<View style={styles.container}>
<Text style={styles.label}>{props.label}</Text>
</View>
</SafeAreaView>
);
}

```

From the [docs](https://reactnative.dev/docs/safeareaview):
Expand Down Expand Up @@ -178,6 +178,16 @@ import Header from "./components/Header";
import { colors } from "./styles/constants";
import { useFonts, Pacifico_400Regular } from "@expo-google-fonts/pacifico";

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
},
text: {
color: colors.text,
},
});

export default function App() {
const [fontsLoaded] = useFonts({
Pacifico_400Regular,
Expand All @@ -194,16 +204,6 @@ export default function App() {
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
},
text: {
color: colors.text,
},
});
```

Let's now set the header's text to be `"Pacifico_400Regular"` with the `fontFamily` style.
Expand Down
6 changes: 3 additions & 3 deletions guest-list-mobile/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function Index() {
// setGuests(fetchedGuests);
}

async function postGuest(guest: { firstName: string; lastName: string }) {
async function postGuest(guest: Guest) {
const { firstName, lastName } = guest;

Check warning on line 55 in guest-list-mobile/app/index.tsx

View workflow job for this annotation

GitHub Actions / Lint, Check Types

'firstName' is already declared in the upper scope on line 40 column 11

Check warning on line 55 in guest-list-mobile/app/index.tsx

View workflow job for this annotation

GitHub Actions / Lint, Check Types

'lastName' is already declared in the upper scope on line 40 column 22
const response = await fetch(`${API_URL}/guests`, {
method: 'POST',
Expand All @@ -66,7 +66,7 @@ export default function Index() {
} catch {}
}
if (typeof firstName === 'string' && typeof lastName === 'string') {
postGuest({ firstName, lastName });
postGuest({ id: '0', attending: false, firstName, lastName });

Check warning on line 69 in guest-list-mobile/app/index.tsx

View workflow job for this annotation

GitHub Actions / Lint, Check Types

Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler
}
loadGuests();

Check warning on line 71 in guest-list-mobile/app/index.tsx

View workflow job for this annotation

GitHub Actions / Lint, Check Types

Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler
}, [firstName, lastName]);

Check warning on line 72 in guest-list-mobile/app/index.tsx

View workflow job for this annotation

GitHub Actions / Lint, Check Types

React Hook useEffect has a missing dependency: 'guests'. Either include it or remove the dependency array. You can also do a functional update 'setGuests(g => ...)' if you only need 'guests' in the 'setGuests' call
Expand All @@ -77,7 +77,7 @@ export default function Index() {
data={guests}
renderItem={renderItem}
keyExtractor={(item: Guest) => item.id}
></FlatList>
/>
<Link style={styles.button} href="/new-guest">
New Guest
</Link>
Expand Down

0 comments on commit b1327a1

Please sign in to comment.