From f0bf4e7afdcd8b02a62be45ab3e7d047ed865a79 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Mon, 19 Jul 2021 20:06:08 +0300 Subject: Apply Prettier --- .editorconfig | 8 + .prettierignore | 1 + App.js | 4 +- api.d.ts | 14 +- app.json | 4 +- app/app.tsx | 35 +- app/components/auto-image/auto-image.story.tsx | 26 +- app/components/auto-image/auto-image.tsx | 6 +- app/components/bullet-item/bullet-item.tsx | 16 +- app/components/button/button.presets.ts | 16 +- app/components/button/button.props.ts | 11 +- app/components/button/button.story.tsx | 44 +- app/components/button/button.tsx | 12 +- app/components/checkbox/checkbox.props.ts | 4 +- app/components/checkbox/checkbox.story.tsx | 45 +- app/components/checkbox/checkbox.tsx | 33 +- app/components/form-row/form-row.presets.ts | 4 +- app/components/form-row/form-row.props.tsx | 6 +- app/components/form-row/form-row.story.tsx | 46 +- app/components/form-row/form-row.tsx | 8 +- app/components/graph-ui/graph-ui.story.tsx | 14 +- app/components/graph-ui/graph-ui.tsx | 32 +- app/components/graph/graph.story.tsx | 14 +- app/components/graph/graph.tsx | 318 +- app/components/graph/graphgood.tsx | 155 +- app/components/header/header.props.ts | 6 +- app/components/header/header.story.tsx | 20 +- app/components/header/header.tsx | 28 +- app/components/icon/icon.props.ts | 4 +- app/components/icon/icon.story.tsx | 12 +- app/components/icon/icon.tsx | 12 +- app/components/icon/icons/index.ts | 4 +- app/components/index.ts | 32 +- app/components/local-button/local-button.story.tsx | 14 +- app/components/local-button/local-button.tsx | 43 +- app/components/local/local.story.tsx | 14 +- app/components/local/local.tsx | 34 +- app/components/screen/screen.presets.ts | 20 +- app/components/screen/screen.props.ts | 10 +- app/components/screen/screen.tsx | 42 +- app/components/switch/switch.props.ts | 2 +- app/components/switch/switch.story.tsx | 53 +- app/components/switch/switch.tsx | 25 +- app/components/text-field/text-field.story.tsx | 69 +- app/components/text-field/text-field.tsx | 23 +- app/components/text/text.presets.ts | 8 +- app/components/text/text.props.ts | 8 +- app/components/text/text.story.tsx | 39 +- app/components/text/text.tsx | 20 +- app/components/tweaks/tweaks.story.tsx | 14 +- app/components/tweaks/tweaks.tsx | 257 +- app/components/wallpaper/wallpaper.presets.ts | 6 +- app/components/wallpaper/wallpaper.props.ts | 4 +- app/components/wallpaper/wallpaper.story.tsx | 12 +- app/components/wallpaper/wallpaper.tsx | 12 +- app/config/env.js | 2 +- app/data/miserables.json | 662 +- app/data/rando.json | 2 +- app/data/randomdata.js | 16 +- app/data/randomdata.tsx | 16 +- app/data/randorev.json | 2 +- app/data/randorevog.json | 2 +- app/data/roam.json | 7139 +- app/i18n/i18n.ts | 10 +- app/i18n/index.ts | 6 +- app/i18n/translate.ts | 4 +- app/models/character-store/character-store.test.ts | 4 +- app/models/character-store/character-store.ts | 15 +- app/models/character/character.test.ts | 6 +- app/models/character/character.ts | 7 +- app/models/environment.ts | 4 +- app/models/extensions/with-environment.ts | 4 +- app/models/extensions/with-root-store.ts | 4 +- app/models/index.ts | 10 +- app/models/root-store/root-store-context.ts | 4 +- app/models/root-store/root-store.ts | 4 +- app/models/root-store/setup-root-store.ts | 14 +- app/navigators/index.ts | 6 +- app/navigators/main-navigator.tsx | 17 +- app/navigators/navigation-utilities.tsx | 27 +- app/navigators/root-navigator.tsx | 15 +- app/screens/demo/demo-list-screen.tsx | 34 +- app/screens/demo/demo-screen.tsx | 77 +- app/screens/graph/graph-screen.tsx | 200 +- app/screens/index.ts | 8 +- app/screens/welcome/welcome-screen.tsx | 68 +- app/services/api/api-config.ts | 4 +- app/services/api/api-problem.test.ts | 94 +- app/services/api/api-problem.ts | 56 +- app/services/api/api.ts | 18 +- app/services/api/api.types.ts | 16 +- app/services/api/character-api.ts | 14 +- app/services/api/index.ts | 4 +- app/services/reactotron/index.ts | 2 +- app/services/reactotron/reactotron-config.ts | 2 +- app/services/reactotron/reactotron.ts | 61 +- app/services/reactotron/tron.ts | 2 +- app/services/reactotron/tron.web.ts | 2 +- app/theme/color.ts | 4 +- app/theme/index.ts | 8 +- app/theme/palette.ts | 18 +- app/theme/typography.ts | 8 +- app/utils/delay.ts | 3 +- app/utils/ignore-warnings.ts | 2 +- app/utils/keychain.ts | 10 +- app/utils/storage/index.ts | 2 +- app/utils/storage/storage.test.ts | 38 +- app/utils/storage/storage.ts | 2 +- app/utils/validate.ts | 16 +- babel.config.js | 6 +- e2e/firstTest.spec.js | 14 +- e2e/init.js | 6 +- e2e/reload.js | 2 +- package-lock.json | 81647 +++++++++++++++++++ package.json | 3 +- react-native.config.js | 2 +- storybook/index.ts | 2 +- storybook/storybook-registry.ts | 20 +- storybook/storybook.tsx | 17 +- storybook/toggle-storybook.tsx | 16 +- storybook/toggle-storybook.web.tsx | 6 +- storybook/views/index.ts | 6 +- storybook/views/story-screen.tsx | 14 +- storybook/views/story.tsx | 8 +- storybook/views/use-case.tsx | 28 +- test/i18n.test.ts | 14 +- test/mock-async-storage.ts | 4 +- test/mock-file.ts | 2 +- test/mock-i18n.ts | 2 +- test/mock-react-native-image.ts | 6 +- test/setup.ts | 10 +- test/storyshots.test.ts | 6 +- tsconfig.json | 18 +- webpack.config.js | 11 +- yarn.lock | 35888 ++++---- 135 files changed, 108955 insertions(+), 19301 deletions(-) create mode 100644 .editorconfig create mode 100644 package-lock.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..78c6dde --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/.prettierignore b/.prettierignore index 883e252..830268d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,3 +4,4 @@ android .vscode ignite/ignite.json package.json +web-build diff --git a/App.js b/App.js index 9adab2e..2c22178 100644 --- a/App.js +++ b/App.js @@ -1,6 +1,6 @@ // This is the first file that ReactNative will run when it starts up. -import App from "./app/app.tsx" -import { registerRootComponent } from "expo" +import App from './app/app.tsx' +import { registerRootComponent } from 'expo' registerRootComponent(App) export default App diff --git a/api.d.ts b/api.d.ts index 3bbea6d..b2d8b98 100644 --- a/api.d.ts +++ b/api.d.ts @@ -1,15 +1,15 @@ export type OrgRoamGraphReponse = { - nodes: OrgRoamNode[] - links: OrgRoamLink[] + nodes: OrgRoamNode[] + links: OrgRoamLink[] } export type OrgRoamNode = { - id: string - file: string - title: string + id: string + file: string + title: string } export type OrgRoamLink = { - source: string - dest: string + source: string + dest: string } diff --git a/app.json b/app.json index 167a1ae..3ff56bc 100644 --- a/app.json +++ b/app.json @@ -13,9 +13,7 @@ "updates": { "fallbackToCacheTimeout": 0 }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true }, diff --git a/app/app.tsx b/app/app.tsx index d737864..459bc39 100644 --- a/app/app.tsx +++ b/app/app.tsx @@ -9,30 +9,33 @@ * The app navigation resides in ./app/navigators, so head over there * if you're interested in adding screens and navigators. */ -import "./i18n" -import "./utils/ignore-warnings" -import React, { useState, useEffect, useRef } from "react" -import { NavigationContainerRef } from "@react-navigation/native" -import { SafeAreaProvider, initialWindowMetrics } from "react-native-safe-area-context" -import { initFonts } from "./theme/fonts" // expo -import * as storage from "./utils/storage" +import './i18n' +import './utils/ignore-warnings' +import React, { useState, useEffect, useRef } from 'react' +import { NavigationContainerRef } from '@react-navigation/native' +import { + SafeAreaProvider, + initialWindowMetrics, +} from 'react-native-safe-area-context' +import { initFonts } from './theme/fonts' // expo +import * as storage from './utils/storage' import { useBackButtonHandler, RootNavigator, canExit, setRootNavigation, useNavigationPersistence, -} from "./navigators" -import { RootStore, RootStoreProvider, setupRootStore } from "./models" -import { ToggleStorybook } from "../storybook/toggle-storybook" +} from './navigators' +import { RootStore, RootStoreProvider, setupRootStore } from './models' +import { ToggleStorybook } from '../storybook/toggle-storybook' // This puts screens in a native ViewController or Activity. If you want fully native // stack navigation, use `createNativeStackNavigator` in place of `createStackNavigator`: // https://github.com/kmagiera/react-native-screens#using-native-stack-navigator -import { enableScreens } from "react-native-screens" +import { enableScreens } from 'react-native-screens' enableScreens() -export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE" +export const NAVIGATION_PERSISTENCE_KEY = 'NAVIGATION_STATE' /** * This is the root component of our app. @@ -43,10 +46,10 @@ function App() { setRootNavigation(navigationRef) useBackButtonHandler(navigationRef, canExit) - const { initialNavigationState, onNavigationStateChange } = useNavigationPersistence( - storage, - NAVIGATION_PERSISTENCE_KEY, - ) + const { + initialNavigationState, + onNavigationStateChange, + } = useNavigationPersistence(storage, NAVIGATION_PERSISTENCE_KEY) // Kick off initial async loading actions, like loading fonts and RootStore useEffect(() => { diff --git a/app/components/auto-image/auto-image.story.tsx b/app/components/auto-image/auto-image.story.tsx index f7ecc86..76e9dab 100644 --- a/app/components/auto-image/auto-image.story.tsx +++ b/app/components/auto-image/auto-image.story.tsx @@ -1,31 +1,37 @@ /* eslint-disable */ -import * as React from "react" -import { storiesOf } from "@storybook/react-native" -import { StoryScreen, Story, UseCase } from "../../../storybook/views" -import { AutoImage } from "./auto-image" +import * as React from 'react' +import { storiesOf } from '@storybook/react-native' +import { StoryScreen, Story, UseCase } from '../../../storybook/views' +import { AutoImage } from './auto-image' declare let module -const bowser = require("../../screens/welcome/bowser.png") -const morty = { uri: "https://rickandmortyapi.com/api/character/avatar/2.jpeg" } +const bowser = require('../../screens/welcome/bowser.png') +const morty = { uri: 'https://rickandmortyapi.com/api/character/avatar/2.jpeg' } -storiesOf("AutoImage", module) +storiesOf('AutoImage', module) .addDecorator((fn) => {fn()}) - .add("Style Presets", () => ( + .add('Style Presets', () => ( - + - + )) diff --git a/app/components/auto-image/auto-image.tsx b/app/components/auto-image/auto-image.tsx index 39d71ca..a8bfe37 100644 --- a/app/components/auto-image/auto-image.tsx +++ b/app/components/auto-image/auto-image.tsx @@ -1,10 +1,10 @@ -import React, { useLayoutEffect, useState } from "react" +import React, { useLayoutEffect, useState } from 'react' import { Image as RNImage, ImageProps as DefaultImageProps, ImageURISource, Platform, -} from "react-native" +} from 'react-native' type ImageProps = DefaultImageProps & { source: ImageURISource @@ -31,7 +31,7 @@ export function AutoImage(props: ImageProps) { RNImage.getSize(props.source.uri as any, (width, height) => { setImageSize({ width, height }) }) - } else if (Platform.OS === "web") { + } else if (Platform.OS === 'web') { // web requires a different method to get it's size RNImage.getSize(props.source as any, (width, height) => { setImageSize({ width, height }) diff --git a/app/components/bullet-item/bullet-item.tsx b/app/components/bullet-item/bullet-item.tsx index d999e10..f6b2f17 100644 --- a/app/components/bullet-item/bullet-item.tsx +++ b/app/components/bullet-item/bullet-item.tsx @@ -1,15 +1,15 @@ -import * as React from "react" -import { View, ViewStyle, ImageStyle, TextStyle } from "react-native" -import { Text } from "../text/text" -import { Icon } from "../icon/icon" -import { spacing, typography } from "../../theme" +import * as React from 'react' +import { View, ViewStyle, ImageStyle, TextStyle } from 'react-native' +import { Text } from '../text/text' +import { Icon } from '../icon/icon' +import { spacing, typography } from '../../theme' const BULLET_ITEM: ViewStyle = { - flexDirection: "row", + flexDirection: 'row', marginTop: spacing[4], paddingBottom: spacing[4], borderBottomWidth: 1, - borderBottomColor: "#3A3048", + borderBottomColor: '#3A3048', } const BULLET_CONTAINER: ViewStyle = { marginRight: spacing[4] - 1, @@ -22,7 +22,7 @@ const BULLET: ImageStyle = { const BULLET_TEXT: TextStyle = { flex: 1, fontFamily: typography.primary, - color: "#BAB6C8", + color: '#BAB6C8', fontSize: 15, lineHeight: 22, } diff --git a/app/components/button/button.presets.ts b/app/components/button/button.presets.ts index b140fd2..bc0ad3f 100644 --- a/app/components/button/button.presets.ts +++ b/app/components/button/button.presets.ts @@ -1,5 +1,5 @@ -import { ViewStyle, TextStyle } from "react-native" -import { color, spacing } from "../../theme" +import { ViewStyle, TextStyle } from 'react-native' +import { color, spacing } from '../../theme' /** * All text will start off looking like this. @@ -8,8 +8,8 @@ const BASE_VIEW: ViewStyle = { paddingVertical: spacing[2], paddingHorizontal: spacing[2], borderRadius: 4, - justifyContent: "center", - alignItems: "center", + justifyContent: 'center', + alignItems: 'center', } const BASE_TEXT: TextStyle = { @@ -34,12 +34,16 @@ export const viewPresets: Record = { ...BASE_VIEW, paddingHorizontal: 0, paddingVertical: 0, - alignItems: "flex-start", + alignItems: 'flex-start', } as ViewStyle, } export const textPresets: Record = { - primary: { ...BASE_TEXT, fontSize: 9, color: color.palette.white } as TextStyle, + primary: { + ...BASE_TEXT, + fontSize: 9, + color: color.palette.white, + } as TextStyle, link: { ...BASE_TEXT, color: color.text, diff --git a/app/components/button/button.props.ts b/app/components/button/button.props.ts index 1377a7e..5f26136 100644 --- a/app/components/button/button.props.ts +++ b/app/components/button/button.props.ts @@ -1,6 +1,11 @@ -import { StyleProp, TextStyle, TouchableOpacityProps, ViewStyle } from "react-native" -import { ButtonPresetNames } from "./button.presets" -import { TxKeyPath } from "../../i18n" +import { + StyleProp, + TextStyle, + TouchableOpacityProps, + ViewStyle, +} from 'react-native' +import { ButtonPresetNames } from './button.presets' +import { TxKeyPath } from '../../i18n' export interface ButtonProps extends TouchableOpacityProps { /** diff --git a/app/components/button/button.story.tsx b/app/components/button/button.story.tsx index 4861772..5dc21c1 100644 --- a/app/components/button/button.story.tsx +++ b/app/components/button/button.story.tsx @@ -1,30 +1,48 @@ -import * as React from "react" -import { ViewStyle, TextStyle, Alert } from "react-native" -import { storiesOf } from "@storybook/react-native" -import { StoryScreen, Story, UseCase } from "../../../storybook/views" -import { Button } from "./button" +import * as React from 'react' +import { ViewStyle, TextStyle, Alert } from 'react-native' +import { storiesOf } from '@storybook/react-native' +import { StoryScreen, Story, UseCase } from '../../../storybook/views' +import { Button } from './button' declare let module -const buttonStyleArray: ViewStyle[] = [{ paddingVertical: 100 }, { borderRadius: 0 }] +const buttonStyleArray: ViewStyle[] = [ + { paddingVertical: 100 }, + { borderRadius: 0 }, +] -const buttonTextStyleArray: TextStyle[] = [{ fontSize: 20 }, { color: "#a511dc" }] +const buttonTextStyleArray: TextStyle[] = [ + { fontSize: 20 }, + { color: '#a511dc' }, +] -storiesOf("Button", module) +storiesOf('Button', module) .addDecorator((fn) => {fn()}) - .add("Style Presets", () => ( + .add('Style Presets', () => ( -