From d9e90dd0465b2522827ab7e8b1533907550edacd Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:15:53 +0200 Subject: [PATCH] format --- DEVELOPERS.md | 144 ++++++++++-------- apps/temp-community-forum/src/pages/index.tsx | 2 +- apps/temp-community-forum/src/utils/api.ts | 2 +- .../temp-community-tutorials/src/utils/api.ts | 2 +- .../ReactNativeTypeScriptTodolist/App.tsx | 26 ++-- .../__tests__/App-test.tsx | 12 +- .../native/components/Auth.tsx | 48 +++--- .../native/components/TodoList.tsx | 112 +++++++------- .../native/components/UserContext.tsx | 54 ++++--- .../native/lib/constants.ts | 24 ++- .../native/lib/initSupabase.ts | 8 +- .../components/Account.tsx | 2 +- .../components/Footer.tsx | 2 +- .../components/ProfileList.tsx | 2 +- packages/ui/Button.tsx | 6 +- packages/ui/index.tsx | 6 +- packages/ui/layouts/SidebarLayout.tsx | 17 ++- 17 files changed, 236 insertions(+), 233 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 45095d5a4fc..179e06199fd 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -23,11 +23,11 @@ First off, thanks for your interest in Supabase and for wanting to contribute! b Before you can build Supabase, you must install and configure the following dependencies on your machine: -* [Git](http://git-scm.com/) +- [Git](http://git-scm.com/) -* [Node.js v16.x (LTS)](http://nodejs.org) +- [Node.js v16.x (LTS)](http://nodejs.org) -* [npm](https://www.npmjs.com/) version 7+. +- [npm](https://www.npmjs.com/) version 7+. ### Forking Supabase on GitHub @@ -38,6 +38,7 @@ To contribute code to Supabase, you must fork the [Supabase Repository](https:// To build Supabase, you clone the source code repository: 2. Clone your GitHub forked repository: + ```sh git clone https://github.com//supabase.git ``` @@ -52,29 +53,36 @@ To build Supabase, you clone the source code repository: Before you start a development server, you must choose if you want to work on the [Supabase Website](https://supabase.com), [Supabase Docs](https://supabase.com/docs/), or [Supabase Studio](https://app.supabase.io). 1. Go to the [Supabase Website](https://supabase.com) directory - ```sh - cd www - ``` - Go to the [Supabase Docs](https://supabase.com/docs/) directory - ```sh - cd web - ``` - Go to the [Supabase Studio](https://app.supabase.io) directory - ```sh - cd studio - ``` + + ```sh + cd www + ``` + + Go to the [Supabase Docs](https://supabase.com/docs/) directory + + ```sh + cd web + ``` + + Go to the [Supabase Studio](https://app.supabase.io) directory + + ```sh + cd studio + ``` 2. Install npm dependencies: - npm - ```sh - npm install - ``` + npm - or with yarn - ```sh - yarn install - ``` + ```sh + npm install + ``` + + or with yarn + + ```sh + yarn install + ``` ## Start a Development Server @@ -88,73 +96,81 @@ To debug code, and to see changes in real time, it is often useful to have a loc 1. Start development server - npm - ```sh - npm run dev - ``` + npm - or with yarn - ```sh - yarn dev - ``` + ```sh + npm run dev + ``` + + or with yarn + + ```sh + yarn dev + ``` 2. To access the local server, enter the following URL into your web browser: - ```sh - http://localhost:3000/ - ``` + ```sh + http://localhost:3000/ + ``` ### Supabase Docs Development Server 1. Build development server - npm - ```sh - npm run build - ``` + npm - or with yarn - ```sh - yarn build - ``` + ```sh + npm run build + ``` + + or with yarn + + ```sh + yarn build + ``` 2. Start development server - npm - ```sh - npm run start - ``` + npm - or with yarn - ```sh - yarn start - ``` + ```sh + npm run start + ``` + + or with yarn + + ```sh + yarn start + ``` 3. To access the local server, enter the following URL into your web browser: - ```sh - http://localhost:3005/docs - ``` + ```sh + http://localhost:3005/docs + ``` ### Supabase Studio Development Server 1. Start development server - npm - ```sh - npm run dev - ``` + npm - or with yarn - ```sh - yarn dev - ``` + ```sh + npm run dev + ``` + + or with yarn + + ```sh + yarn dev + ``` 2. To access the local server, enter the following URL into your web browser: - ```sh - http://localhost:8082/ - ``` + ```sh + http://localhost:8082/ + ``` For more information on Supabase Studio, see the [Supabase Studio readme](./studio/README.md). @@ -168,7 +184,6 @@ Did you have an issue, like a merge conflict, or don't know how to open a pull r Stuck somewhere? Have any questions? please join the [Discord Community Server](https://discord.supabase.com/) or the [Github Discussions](https://github.com/supabase/supabase/discussions). We are here to help! - ## Monorepo This is a monorepo, using Turborepo. You must be using NPM 7 or higher. @@ -177,7 +192,6 @@ This is a monorepo, using Turborepo. You must be using NPM 7 or higher. - `npm install @supabase/ui -w ui`: installs into `./packages/ui` - `npm install @supabase/ui -w docs`: installs into `./packages/docs` - ### Development `npm run dev` diff --git a/apps/temp-community-forum/src/pages/index.tsx b/apps/temp-community-forum/src/pages/index.tsx index 06242005dd5..a0283d42e9e 100644 --- a/apps/temp-community-forum/src/pages/index.tsx +++ b/apps/temp-community-forum/src/pages/index.tsx @@ -17,7 +17,7 @@ export default function Main() { -
Categories
+
Categories
One
Two
diff --git a/apps/temp-community-forum/src/utils/api.ts b/apps/temp-community-forum/src/utils/api.ts index 420637fcf1f..88401ba7b7c 100644 --- a/apps/temp-community-forum/src/utils/api.ts +++ b/apps/temp-community-forum/src/utils/api.ts @@ -41,4 +41,4 @@ export async function fetchDiscussions() { }, }) return repository.discussions.nodes -} \ No newline at end of file +} diff --git a/apps/temp-community-tutorials/src/utils/api.ts b/apps/temp-community-tutorials/src/utils/api.ts index 13c5bd9041f..baa1b180f00 100644 --- a/apps/temp-community-tutorials/src/utils/api.ts +++ b/apps/temp-community-tutorials/src/utils/api.ts @@ -50,6 +50,6 @@ export async function fetchPosts() { return data } catch (err) { console.log(err) - return [] + return [] } } diff --git a/examples/ReactNativeTypeScriptTodolist/App.tsx b/examples/ReactNativeTypeScriptTodolist/App.tsx index e3543c1e35b..703eb39fb87 100644 --- a/examples/ReactNativeTypeScriptTodolist/App.tsx +++ b/examples/ReactNativeTypeScriptTodolist/App.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import {StyleSheet, View, Platform, StatusBar} from 'react-native'; -import {ThemeProvider, colors, Text} from 'react-native-elements'; -import {Styles} from './native/lib/constants'; -import {UserContextProvider, useUser} from './native/components/UserContext'; -import List from './native/components/TodoList'; -import Auth from './native/components/Auth'; +import React from 'react' +import { StyleSheet, View, Platform, StatusBar } from 'react-native' +import { ThemeProvider, colors, Text } from 'react-native-elements' +import { Styles } from './native/lib/constants' +import { UserContextProvider, useUser } from './native/components/UserContext' +import List from './native/components/TodoList' +import Auth from './native/components/Auth' const theme = { colors: { @@ -13,13 +13,13 @@ const theme = { ios: colors.platform.ios, }), }, -}; +} const Container = () => { - const {user} = useUser(); + const { user } = useUser() - return user ? : ; -}; + return user ? : +} export default function App() { return ( @@ -34,7 +34,7 @@ export default function App() { - ); + ) } const styles = StyleSheet.create({ @@ -47,4 +47,4 @@ const styles = StyleSheet.create({ paddingBottom: 4, alignSelf: 'stretch', }, -}); +}) diff --git a/examples/ReactNativeTypeScriptTodolist/__tests__/App-test.tsx b/examples/ReactNativeTypeScriptTodolist/__tests__/App-test.tsx index 178476699b6..351e77069fb 100644 --- a/examples/ReactNativeTypeScriptTodolist/__tests__/App-test.tsx +++ b/examples/ReactNativeTypeScriptTodolist/__tests__/App-test.tsx @@ -2,13 +2,13 @@ * @format */ -import 'react-native'; -import React from 'react'; -import App from '../App'; +import 'react-native' +import React from 'react' +import App from '../App' // Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; +import renderer from 'react-test-renderer' it('renders correctly', () => { - renderer.create(); -}); + renderer.create() +}) diff --git a/examples/ReactNativeTypeScriptTodolist/native/components/Auth.tsx b/examples/ReactNativeTypeScriptTodolist/native/components/Auth.tsx index df37a5454c3..b7e9f56abdc 100644 --- a/examples/ReactNativeTypeScriptTodolist/native/components/Auth.tsx +++ b/examples/ReactNativeTypeScriptTodolist/native/components/Auth.tsx @@ -1,37 +1,37 @@ -import React, {useState} from 'react'; -import {Alert, StyleSheet, View} from 'react-native'; -import {Styles} from '../lib/constants'; -import {supabase} from '../lib/initSupabase'; +import React, { useState } from 'react' +import { Alert, StyleSheet, View } from 'react-native' +import { Styles } from '../lib/constants' +import { supabase } from '../lib/initSupabase' -import {Button, Input} from 'react-native-elements'; +import { Button, Input } from 'react-native-elements' export default function Auth() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [loading, setLoading] = useState(''); + const [email, setEmail] = useState('') + const [password, setPassword] = useState('') + const [loading, setLoading] = useState('') const handleLogin = async (type: string, email: string, password: string) => { - setLoading(type); - const {error, user} = + setLoading(type) + const { error, user } = type === 'LOGIN' - ? await supabase.auth.signIn({email, password}) - : await supabase.auth.signUp({email, password}); + ? await supabase.auth.signIn({ email, password }) + : await supabase.auth.signUp({ email, password }) if (!error && user && type === 'SIGNUP') { - Alert.alert('Check your email for the login link!'); + Alert.alert('Check your email for the login link!') } if (error) { - Alert.alert(error.message); + Alert.alert(error.message) } - setLoading(''); - }; + setLoading('') + } return ( - + setEmail(text)} + leftIcon={{ type: 'font-awesome', name: 'envelope' }} + onChangeText={(text) => setEmail(text)} value={email} placeholder="email@address.com" autoCapitalize={'none'} @@ -40,15 +40,15 @@ export default function Auth() { setPassword(text)} + leftIcon={{ type: 'font-awesome', name: 'lock' }} + onChangeText={(text) => setPassword(text)} value={password} secureTextEntry={true} placeholder="Password" autoCapitalize={'none'} /> - + diff --git a/examples/nextjs-ts-user-management/components/Footer.tsx b/examples/nextjs-ts-user-management/components/Footer.tsx index e36287f59bd..af6f93e0554 100644 --- a/examples/nextjs-ts-user-management/components/Footer.tsx +++ b/examples/nextjs-ts-user-management/components/Footer.tsx @@ -6,7 +6,7 @@ export default function Footer({}) { Powered by -
+
{state.profiles.length === 0 ? ( -

There are no public profiles created yet

+

There are no public profiles created yet

) : (
{state.profiles?.map((profile: any) => ( diff --git a/packages/ui/Button.tsx b/packages/ui/Button.tsx index 7d5c6a735fd..5f63b34da22 100644 --- a/packages/ui/Button.tsx +++ b/packages/ui/Button.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import * as React from 'react' export const Button = () => { - return ; -}; + return +} diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index df9e98aef5b..eec7fc002d5 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -1,8 +1,8 @@ -import React from "react"; +import React from 'react' -import SidebarLayout from "./layouts/SidebarLayout"; +import SidebarLayout from './layouts/SidebarLayout' -export * from "./Button"; +export * from './Button' export const Layouts = { SidebarLayout, diff --git a/packages/ui/layouts/SidebarLayout.tsx b/packages/ui/layouts/SidebarLayout.tsx index 9806b68c392..652b68f6fd0 100644 --- a/packages/ui/layouts/SidebarLayout.tsx +++ b/packages/ui/layouts/SidebarLayout.tsx @@ -11,7 +11,13 @@ function classNames(...classes: string[]) { return classes.filter(Boolean).join(' ') } -export default function SidebarLayout({ children, sidebarContent }: { children: React.ReactNode, sidebarContent: React.ReactNode }) { +export default function SidebarLayout({ + children, + sidebarContent, +}: { + children: React.ReactNode + sidebarContent: React.ReactNode +}) { const [sidebarOpen, setSidebarOpen] = useState(false) return ( @@ -67,10 +73,7 @@ export default function SidebarLayout({ children, sidebarContent }: { children: alt="Workflow" />
-
- - {sidebarContent} -
+
{sidebarContent}
-
- {sidebarContent} -
+
{sidebarContent}