Merge pull request 'Automatically organize imports' (#83) from ivan/automatically-organize-imports into master

Reviewed-on: railbird/rn-playground#83
This commit is contained in:
Ivan Malison 2024-02-03 21:48:28 -07:00
commit 89361e17e6
29 changed files with 98 additions and 71 deletions

View File

@ -0,0 +1,11 @@
on:
push:
branches:
- master
jobs:
build:
name: Install
runs-on: nixos-x86_64-linux
steps:
- name: android-build
run: nix develop --impure --command bash -c 'export GRADLE_USER_HOME=$PWD; export HOME=$PWD; cd android; ./gradlew assembleDebug'

View File

@ -1,7 +1,6 @@
name: Tests name: Tests
on: on:
pull_request: pull_request:
env: env:
NIXPKGS_ALLOW_UNFREE: 1 NIXPKGS_ALLOW_UNFREE: 1
@ -19,8 +18,10 @@ jobs:
run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn config set link-folder . && yarn install' run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn config set link-folder . && yarn install'
- name: lint - name: lint
run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn run lint' run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn run lint'
- name: typecheck react-native-vision-camera
run: nix develop --impure --command bash -c 'export HOME=$PWD; cd ./react-native-vision-camera/package; yarn install && tsc'
- name: typecheck - name: typecheck
run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn tsc --noEmit' run: nix develop --impure --command bash -c 'export HOME=$PWD; yarn tsc'
- name: prettier - name: prettier
run: nix develop --impure --command bash -c 'export HOME=$PWD; prettier . --check' run: nix develop --impure --command bash -c 'export HOME=$PWD; prettier . --check'
- name: test - name: test

View File

@ -1,7 +1,7 @@
import React from "react";
import AppNavigator from "./navigation/app-navigator";
import { ClientProvider, useAuthHeader } from "./graphql/client";
import { DEV_USER_ID } from "@env"; import { DEV_USER_ID } from "@env";
import React from "react";
import { ClientProvider, useAuthHeader } from "./graphql/client";
import AppNavigator from "./navigation/app-navigator";
const SetAuthHeaderBasedOnEnv = () => { const SetAuthHeaderBasedOnEnv = () => {
const { setAuthHeader } = useAuthHeader(); const { setAuthHeader } = useAuthHeader();

View File

@ -1,16 +1,16 @@
import React from "react";
import * as scale from "d3-scale"; import * as scale from "d3-scale";
import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { BarChart, XAxis, YAxis } from "react-native-svg-charts"; import { BarChart, XAxis, YAxis } from "react-native-svg-charts";
import { useGraphData } from "../use-graph-data";
import { GraphData, YAxisProps } from "../graph-types"; import { GraphData, YAxisProps } from "../graph-types";
import { useGraphData } from "../use-graph-data";
import { CustomBars } from "../custom-bars"; import ChartLabel from "../chart-label/chart-label";
import { CustomGrid } from "../custom-grid";
import { graphStyles } from "../chart-styles"; import { graphStyles } from "../chart-styles";
import ChartView from "../chart-view"; import ChartView from "../chart-view";
import ChartLabel from "../chart-label/chart-label"; import { CustomBars } from "../custom-bars";
import { CustomGrid } from "../custom-grid";
interface Props { interface Props {
data: GraphData; data: GraphData;

View File

@ -1,6 +1,6 @@
import { path as d3 } from "d3-path"; import { path as d3 } from "d3-path";
import { ScaleLinearType, ScaleBandType } from "./graph-types"; import { ScaleBandType, ScaleLinearType } from "./graph-types";
type BarCalculationProps = { type BarCalculationProps = {
scaleX: ScaleBandType; scaleX: ScaleBandType;

View File

@ -1,8 +1,8 @@
import { Svg } from "react-native-svg"; import { Svg } from "react-native-svg";
import { Bar } from "./bar"; import { Bar } from "./bar";
import { ScaleBandType, ScaleLinearType } from "./graph-types";
import { calculateBarWidth } from "./custom-bar-utils"; import { calculateBarWidth } from "./custom-bar-utils";
import { ScaleBandType, ScaleLinearType } from "./graph-types";
export interface CombinedData { export interface CombinedData {
data: { value: number }[]; data: { value: number }[];

View File

@ -1,13 +1,13 @@
import React from "react";
import * as shape from "d3-shape"; import * as shape from "d3-shape";
import React from "react";
import { View } from "react-native"; import { View } from "react-native";
import { LineChart, XAxis, YAxis } from "react-native-svg-charts"; import { LineChart, XAxis, YAxis } from "react-native-svg-charts";
import { useGraphData } from "../use-graph-data";
import { CustomGrid } from "../custom-grid";
import { graphStyles } from "../chart-styles"; import { graphStyles } from "../chart-styles";
import ChartView from "../chart-view"; import ChartView from "../chart-view";
import { CustomGrid } from "../custom-grid";
import { CommonProps } from "../graph-types"; import { CommonProps } from "../graph-types";
import { useGraphData } from "../use-graph-data";
// TODO: separate PR will update useGraphData to take into account useCommonScale // TODO: separate PR will update useGraphData to take into account useCommonScale
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars

View File

@ -1,8 +1,8 @@
import { useMemo } from "react"; import { useMemo } from "react";
import { convertToGraphData } from "./graph-utils";
import { chartDefaults } from "./graph-config"; import { chartDefaults } from "./graph-config";
import { GraphData, GraphProps, XValue, YAxisData } from "./graph-types"; import { GraphData, GraphProps, XValue, YAxisData } from "./graph-types";
import { convertToGraphData } from "./graph-utils";
interface useGraphDataInterface { interface useGraphDataInterface {
xValues: Array<XValue>; xValues: Array<XValue>;

View File

@ -1,6 +1,6 @@
import { GET_SHOTS } from "../graphql/query";
import DisplayShots from "./display-shot"; import DisplayShots from "./display-shot";
import withQueryHandling from "./with-query-handling"; import withQueryHandling from "./with-query-handling";
import { GET_SHOTS } from "../graphql/query";
const ShotsContainer = withQueryHandling({ const ShotsContainer = withQueryHandling({
WrappedComponent: DisplayShots, WrappedComponent: DisplayShots,

View File

@ -1,19 +1,18 @@
import { useIsFocused } from "@react-navigation/native";
import React, { useCallback, useRef, useState } from "react"; import React, { useCallback, useRef, useState } from "react";
import { Button, StyleSheet, Text, View } from "react-native"; import { Button, StyleSheet, Text, View } from "react-native";
import { import {
Camera, Camera,
useCameraPermission,
useCameraDevice,
useCameraFormat,
PhotoFile,
VideoFile,
CameraRuntimeError, CameraRuntimeError,
Orientation, Orientation,
// @ts-ignore PhotoFile,
VideoFile,
useCameraDevice,
useCameraFormat,
useCameraPermission,
} from "react-native-vision-camera"; } from "react-native-vision-camera";
import { RecordingButton } from "./capture-button"; import { RecordingButton } from "./capture-button";
import { useIsForeground } from "./is-foreground"; import { useIsForeground } from "./is-foreground";
import { useIsFocused } from "@react-navigation/native";
export default function CameraScreen({ export default function CameraScreen({
route, route,
@ -92,6 +91,7 @@ export default function CameraScreen({
format={format} format={format}
onInitialized={onInitialized} onInitialized={onInitialized}
onError={onError} onError={onError}
// @ts-ignore
onVideoChunkReady={onVideoChunkReady} onVideoChunkReady={onVideoChunkReady}
video={true} video={true}
orientation={orientation} // TODO: #60 orientation={orientation} // TODO: #60

View File

@ -1,12 +1,12 @@
import { CameraRoll } from "@react-native-camera-roll/camera-roll";
import React, { useCallback, useRef, useState } from "react"; import React, { useCallback, useRef, useState } from "react";
import { import {
TouchableOpacity,
StyleSheet,
View,
StyleProp, StyleProp,
StyleSheet,
TouchableOpacity,
View,
ViewStyle, ViewStyle,
} from "react-native"; } from "react-native";
import { CameraRoll } from "@react-native-camera-roll/camera-roll";
// @ts-ignore // @ts-ignore
import { Camera } from "react-native-vision-camera/lib/typescript/Camera"; import { Camera } from "react-native-vision-camera/lib/typescript/Camera";
// @ts-ignore // @ts-ignore

View File

@ -1,4 +1,4 @@
import { useState, useEffect } from "react"; import { useEffect, useState } from "react";
import { AppState, AppStateStatus } from "react-native"; import { AppState, AppStateStatus } from "react-native";
export const useIsForeground = (): boolean => { export const useIsForeground = (): boolean => {

View File

@ -1,5 +1,5 @@
import { DocumentNode, OperationVariables, useQuery } from "@apollo/client";
import React from "react"; import React from "react";
import { useQuery, DocumentNode, OperationVariables } from "@apollo/client";
import { Text } from "react-native"; import { Text } from "react-native";
/** /**
* A higher-order component that provides loading and error handling for GraphQL queries. * A higher-order component that provides loading and error handling for GraphQL queries.

View File

@ -1,19 +1,19 @@
import {
ApolloClient,
ApolloLink,
ApolloProvider,
HttpLink,
InMemoryCache,
from,
} from "@apollo/client";
import { API_URI } from "@env";
import React, { import React, {
ReactNode, ReactNode,
createContext, createContext,
useContext, useContext,
useState,
useMemo, useMemo,
useState,
} from "react"; } from "react";
import {
ApolloClient,
ApolloLink,
InMemoryCache,
ApolloProvider,
HttpLink,
from,
} from "@apollo/client";
import { API_URI } from "@env";
type Props = { type Props = {
children: ReactNode; children: ReactNode;

View File

@ -1,13 +1,13 @@
import { useColorScheme } from "react-native";
import { import {
NavigationContainer,
DarkTheme, DarkTheme,
DefaultTheme, DefaultTheme,
NavigationContainer,
} from "@react-navigation/native"; } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { useColorScheme } from "react-native";
import Tabs from "./tab-navigator";
import Login from "../screens/login"; import Login from "../screens/login";
import Tabs from "./tab-navigator";
const Stack = createNativeStackNavigator(); const Stack = createNativeStackNavigator();

View File

@ -1,8 +1,8 @@
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Image } from "react-native"; import { Image } from "react-native";
import CameraScreen from "../component/video/camera"; import CameraScreen from "../component/video/camera";
import Session from "../screens/session"; import Session from "../screens/session";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import RecordScreen from "../screens/video-stack/record"; import RecordScreen from "../screens/video-stack/record";
// TODO: add ts support for assets folder to use imports // TODO: add ts support for assets folder to use imports

View File

@ -71,5 +71,10 @@
"prettier-plugin-organize-imports": "^3.2.4", "prettier-plugin-organize-imports": "^3.2.4",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
"private": true "private": true,
"prettier": {
"plugins": [
"prettier-plugin-organize-imports"
]
}
} }

@ -1 +1 @@
Subproject commit 0e05fc314fb759ec0944bf09c07aba9ad753fc2b Subproject commit 1312c5be53fdf1912922a1412642e48200cff0aa

View File

@ -1,14 +1,14 @@
import React, { useState, useEffect } from "react"; import auth, { FirebaseAuthTypes } from "@react-native-firebase/auth";
import React, { useEffect, useState } from "react";
import { import {
Alert, Alert,
Button, Button,
View, Keyboard,
Text, Text,
TextInput, TextInput,
TouchableWithoutFeedback, TouchableWithoutFeedback,
Keyboard, View,
} from "react-native"; } from "react-native";
import auth, { FirebaseAuthTypes } from "@react-native-firebase/auth";
// This code is beginning of Auth Implementation - actual implementation will differ and involve more UI // This code is beginning of Auth Implementation - actual implementation will differ and involve more UI
// Does not have a restart or proper handling of code confirmation, should only be used for obtaining token/testing // Does not have a restart or proper handling of code confirmation, should only be used for obtaining token/testing

View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { View, StyleSheet } from "react-native"; import { StyleSheet, View } from "react-native";
import BarGraph from "../component/charts/bar-graph/bar-graph"; import BarGraph from "../component/charts/bar-graph/bar-graph";
import { graph_data_two_measures } from "../mock/charts/mock-data"; import { graph_data_two_measures } from "../mock/charts/mock-data";

View File

@ -1,11 +1,11 @@
import React, { useCallback, useState } from "react"; import React, { useCallback, useState } from "react";
import { import {
View,
TextInput,
TouchableWithoutFeedback,
Text,
TouchableOpacity,
Keyboard, Keyboard,
Text,
TextInput,
TouchableOpacity,
TouchableWithoutFeedback,
View,
} from "react-native"; } from "react-native";
import DropDownPicker from "react-native-dropdown-picker"; import DropDownPicker from "react-native-dropdown-picker";
import { recordStyles as styles } from "./styles"; import { recordStyles as styles } from "./styles";

View File

@ -1,5 +1,5 @@
import React from "react";
import { render } from "@testing-library/react-native"; import { render } from "@testing-library/react-native";
import React from "react";
import BarGraph from "../../component/charts/bar-graph/bar-graph"; import BarGraph from "../../component/charts/bar-graph/bar-graph";
import { graph_data_two_measures } from "../../mock/charts/mock-data"; import { graph_data_two_measures } from "../../mock/charts/mock-data";

View File

@ -1,6 +1,6 @@
import React from "react";
import { render } from "@testing-library/react-native";
import "@testing-library/jest-native/extend-expect"; import "@testing-library/jest-native/extend-expect";
import { render } from "@testing-library/react-native";
import React from "react";
import ChartLabel from "../../component/charts/chart-label/chart-label"; import ChartLabel from "../../component/charts/chart-label/chart-label";

View File

@ -1,7 +1,7 @@
import "@testing-library/jest-native/extend-expect";
import { render } from "@testing-library/react-native";
import React from "react"; import React from "react";
import { Text } from "react-native"; import { Text } from "react-native";
import { render } from "@testing-library/react-native";
import "@testing-library/jest-native/extend-expect";
import ChartView from "../../component/charts/chart-view"; import ChartView from "../../component/charts/chart-view";

View File

@ -1,13 +1,13 @@
import React from "react";
import { render } from "@testing-library/react-native";
import "@testing-library/jest-native/extend-expect"; import "@testing-library/jest-native/extend-expect";
import { render } from "@testing-library/react-native";
import * as scale from "d3-scale"; import * as scale from "d3-scale";
import React from "react";
import { CustomBars } from "../../component/charts/custom-bars";
import { import {
calculateBarOrigin, calculateBarOrigin,
drawBarPath, drawBarPath,
} from "../../component/charts/custom-bar-utils"; } from "../../component/charts/custom-bar-utils";
import { CustomBars } from "../../component/charts/custom-bars";
const mockYScaleFunction = scale.scaleLinear(); const mockYScaleFunction = scale.scaleLinear();
const mockXScaleFunction = scale.scaleBand(); const mockXScaleFunction = scale.scaleBand();

View File

@ -1,5 +1,5 @@
import React from "react";
import { render } from "@testing-library/react-native"; import { render } from "@testing-library/react-native";
import React from "react";
import LineGraph from "../../component/charts/line-graph/line-graph"; import LineGraph from "../../component/charts/line-graph/line-graph";
import { line_chart_two_y_data } from "../../mock/charts/mock-data"; import { line_chart_two_y_data } from "../../mock/charts/mock-data";

View File

@ -1,6 +1,6 @@
import { renderHook } from "@testing-library/react-native"; import { renderHook } from "@testing-library/react-native";
import { useGraphData } from "../../component/charts/use-graph-data";
import { GraphData, GraphProps } from "../../component/charts/graph-types"; import { GraphData, GraphProps } from "../../component/charts/graph-types";
import { useGraphData } from "../../component/charts/use-graph-data";
describe("useGraphData", () => { describe("useGraphData", () => {
it("should return correctly processed data from convertToGraphData", () => { it("should return correctly processed data from convertToGraphData", () => {

View File

@ -1,9 +1,9 @@
import React from "react";
import { render, cleanup, waitFor } from "@testing-library/react-native";
import "@testing-library/jest-native/extend-expect";
import { gql, useQuery } from "@apollo/client"; import { gql, useQuery } from "@apollo/client";
import withQueryHandling from "../../component/with-query-handling"; import "@testing-library/jest-native/extend-expect";
import { cleanup, render, waitFor } from "@testing-library/react-native";
import React from "react";
import { Text } from "react-native"; import { Text } from "react-native";
import withQueryHandling from "../../component/with-query-handling";
jest.mock("@apollo/client", () => ({ jest.mock("@apollo/client", () => ({
...jest.requireActual("@apollo/client"), ...jest.requireActual("@apollo/client"),

View File

@ -1,5 +1,15 @@
{ {
"include": ["."], "include": ["."],
"exclude": ["node_modules", "./react-native-vision-camera/package"], "exclude": ["node_modules", "./react-native-vision-camera/package"],
"extends": ["expo/tsconfig.base"] "extends": ["expo/tsconfig.base"],
"compilerOptions": {
"allowJs": false,
"esModuleInterop": true,
"moduleResolution": "node",
"outDir": "lib",
"baseUrl": ".",
"paths": {
"react-native-vision-camera": ["./react-native-vision-camera/package/lib"]
}
}
} }