Skip to content

Commit

Permalink
Lint format (#7)
Browse files Browse the repository at this point in the history
* install biome

* format

* script

* lint

* ignore
  • Loading branch information
katayama8000 authored May 5, 2024
1 parent 876ae5c commit 426b5e8
Show file tree
Hide file tree
Showing 27 changed files with 254 additions and 202 deletions.
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
8 changes: 2 additions & 6 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
Expand All @@ -29,9 +27,7 @@
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router"
],
"plugins": ["expo-router"],
"experiments": {
"typedRoutes": true
}
Expand Down
27 changes: 14 additions & 13 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { Link, Tabs } from 'expo-router';
import { Pressable } from 'react-native';
import FontAwesome from "@expo/vector-icons/FontAwesome";
import { Link, Tabs } from "expo-router";
import type React from "react";
import { Pressable } from "react-native";

import Colors from '@/constants/Colors';
import { useColorScheme } from '@/components/useColorScheme';
import { useClientOnlyValue } from '@/components/useClientOnlyValue';
import { useClientOnlyValue } from "@/components/useClientOnlyValue";
import { useColorScheme } from "@/components/useColorScheme";
import Colors from "@/constants/Colors";

// You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>['name'];
name: React.ComponentProps<typeof FontAwesome>["name"];
color: string;
}) {
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
Expand All @@ -21,15 +21,16 @@ export default function TabLayout() {
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
tabBarActiveTintColor: Colors[colorScheme ?? "light"].tint,
// Disable the static render of the header on web
// to prevent a hydration error in React Navigation v6.
headerShown: useClientOnlyValue(false, true),
}}>
}}
>
<Tabs.Screen
name="index"
options={{
title: 'Tab One',
title: "Tab One",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
headerRight: () => (
<Link href="/modal" asChild>
Expand All @@ -38,7 +39,7 @@ export default function TabLayout() {
<FontAwesome
name="info-circle"
size={25}
color={Colors[colorScheme ?? 'light'].text}
color={Colors[colorScheme ?? "light"].text}
style={{ marginRight: 15, opacity: pressed ? 0.5 : 1 }}
/>
)}
Expand All @@ -50,7 +51,7 @@ export default function TabLayout() {
<Tabs.Screen
name="two"
options={{
title: 'Tab Two',
title: "Tab Two",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
Expand Down
20 changes: 8 additions & 12 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { StyleSheet } from 'react-native';
import EditScreenInfo from '@/components/EditScreenInfo';
import { Text, View } from '@/components/Themed';
import EditScreenInfo from "@/components/EditScreenInfo";
import { Text, View } from "@/components/Themed";
import { StyleSheet } from "react-native";

export default function TabOneScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab One</Text>
<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<EditScreenInfo path="app/(tabs)/index.tsx" />
</View>
);
Expand All @@ -19,16 +15,16 @@ export default function TabOneScreen() {
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
alignItems: "center",
justifyContent: "center",
},
title: {
fontSize: 20,
fontWeight: 'bold',
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: '80%',
width: "80%",
},
});
34 changes: 12 additions & 22 deletions app/(tabs)/two.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
import { StyleSheet } from 'react-native';
import { StyleSheet } from "react-native";

import EditScreenInfo from '@/components/EditScreenInfo';
import { Text, View } from '@/components/Themed';
import { Link } from 'expo-router';
import EditScreenInfo from "@/components/EditScreenInfo";
import { Text, View } from "@/components/Themed";
import { Link } from "expo-router";

export default function TabTwoScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab Two</Text>
<Text>hello</Text>
<Link
href="/sample"
style={{ color: 'blue', fontSize: 20, marginTop: 20 }}>
<Link href="/sample" style={{ color: "blue", fontSize: 20, marginTop: 20 }}>
sample
</Link>
<Link
href="/auth/sign-in"
style={{ color: 'blue', fontSize: 20, marginTop: 20 }}>
<Link href="/auth/sign-in" style={{ color: "blue", fontSize: 20, marginTop: 20 }}>
sign-in
</Link>
<Link
href="/auth/sign-up"
style={{ color: 'blue', fontSize: 20, marginTop: 20 }}>
<Link href="/auth/sign-up" style={{ color: "blue", fontSize: 20, marginTop: 20 }}>
sign-up
</Link>

<View
style={styles.separator}
lightColor="#eee"
darkColor="rgba(255,255,255,0.1)"
/>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<EditScreenInfo path="app/(tabs)/two.tsx" />
</View>
);
Expand All @@ -38,16 +28,16 @@ export default function TabTwoScreen() {
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
alignItems: "center",
justifyContent: "center",
},
title: {
fontSize: 20,
fontWeight: 'bold',
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: '80%',
width: "80%",
},
});
3 changes: 2 additions & 1 deletion app/+html.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ScrollViewStyleReset } from 'expo-router/html';
import { ScrollViewStyleReset } from "expo-router/html";

// This file is web-only and used to configure the root HTML for every
// web page during static rendering.
Expand All @@ -19,6 +19,7 @@ export default function Root({ children }: { children: React.ReactNode }) {
<ScrollViewStyleReset />

{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation> */}
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
{/* Add any additional <head> elements that you want globally available on web... */}
</head>
Expand Down
17 changes: 8 additions & 9 deletions app/+not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Link, Stack } from 'expo-router';
import { StyleSheet } from 'react-native';

import { Text, View } from '@/components/Themed';
import { Text, View } from "@/components/Themed";
import { Link, Stack } from "expo-router";
import { StyleSheet } from "react-native";

export default function NotFoundScreen() {
return (
<>
<Stack.Screen options={{ title: 'Oops!' }} />
<Stack.Screen options={{ title: "Oops!" }} />
<View style={styles.container}>
<Text style={styles.title}>This screen doesn't exist.</Text>

Expand All @@ -21,20 +20,20 @@ export default function NotFoundScreen() {
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
alignItems: "center",
justifyContent: "center",
padding: 20,
},
title: {
fontSize: 20,
fontWeight: 'bold',
fontWeight: "bold",
},
link: {
marginTop: 15,
paddingVertical: 15,
},
linkText: {
fontSize: 14,
color: '#2e78b7',
color: "#2e78b7",
},
});
30 changes: 13 additions & 17 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import FontAwesome from '@expo/vector-icons/FontAwesome';
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { useEffect } from 'react';

import { useColorScheme } from '@/components/useColorScheme';
import FontAwesome from "@expo/vector-icons/FontAwesome";
import { DarkTheme, DefaultTheme, ThemeProvider } from "@react-navigation/native";
import { useFonts } from "expo-font";
import { Stack } from "expo-router";
import * as SplashScreen from "expo-splash-screen";
import { useEffect } from "react";

import { useColorScheme } from "@/components/useColorScheme";

export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
} from "expo-router";

export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: '(tabs)',
initialRouteName: "(tabs)",
};

// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();

export default function RootLayout() {
const [loaded, error] = useFonts({
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
...FontAwesome.font,
});

Expand All @@ -52,10 +48,10 @@ function RootLayoutNav() {
const colorScheme = useColorScheme();

return (
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="modal" options={{ presentation: 'modal' }} />
<Stack.Screen name="modal" options={{ presentation: "modal" }} />
</Stack>
</ThemeProvider>
);
Expand Down
34 changes: 15 additions & 19 deletions app/auth/sign-in.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { View, Text } from '@/components/Themed';
import { supabase } from '@/lib/supabase';
import { useRouter } from 'expo-router';
import React, { useState } from 'react';
import { Alert, Button, TextInput, StyleSheet } from 'react-native';
import { View } from "@/components/Themed";
import { supabase } from "@/lib/supabase";
import { useRouter } from "expo-router";
import React, { useState } from "react";
import { Alert, Button, StyleSheet, TextInput } from "react-native";

const SignInScreen = () => {
const [email, setEmail] = useState<string>('');
const [password, setPassword] = useState<string>('');
const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
const { push } = useRouter();

Expand All @@ -20,8 +20,8 @@ const SignInScreen = () => {
if (error) {
Alert.alert(error.message);
} else {
Alert.alert('Signed in!');
push('/sample');
Alert.alert("Signed in!");
push("/sample");
}
setLoading(false);
};
Expand All @@ -33,8 +33,8 @@ const SignInScreen = () => {
onChangeText={(text) => setEmail(text)}
value={email}
placeholder="email@address.com"
autoCapitalize={'none'}
style={{ color: 'white' }}
autoCapitalize={"none"}
style={{ color: "white" }}
/>
</View>
<View style={styles.verticallySpaced}>
Expand All @@ -43,16 +43,12 @@ const SignInScreen = () => {
value={password}
secureTextEntry={true}
placeholder="Password"
autoCapitalize={'none'}
style={{ color: 'white' }}
autoCapitalize={"none"}
style={{ color: "white" }}
/>
</View>
<View style={[styles.verticallySpaced, styles.mt20]}>
<Button
title="Sign in"
disabled={loading}
onPress={() => signInWithEmail()}
/>
<Button title="Sign in" disabled={loading} onPress={() => signInWithEmail()} />
</View>
</View>
);
Expand All @@ -66,7 +62,7 @@ const styles = StyleSheet.create({
verticallySpaced: {
paddingTop: 4,
paddingBottom: 4,
alignSelf: 'stretch',
alignSelf: "stretch",
},
mt20: {
marginTop: 20,
Expand Down
Loading

0 comments on commit 426b5e8

Please sign in to comment.