diff --git a/.eslintrc.json b/.eslintrc.json index cc685df..511a610 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -69,6 +69,25 @@ "ts": "never", "tsx": "never" } + ], + "import/order": [ + "error", + { + "groups": ["builtin", "external", "internal"], + "pathGroups": [ + { + "pattern": "react", + "group": "external", + "position": "before" + } + ], + "pathGroupsExcludedImportTypes": ["react"], + "newlines-between": "always", + "alphabetize": { + "order": "asc", + "caseInsensitive": true + } + } ] } } diff --git a/App.tsx b/App.tsx index 376fd11..87f7633 100644 --- a/App.tsx +++ b/App.tsx @@ -1,11 +1,12 @@ -import { StatusBar } from 'expo-status-bar'; import React from 'react'; -import { SafeAreaProvider } from 'react-native-safe-area-context'; + +import { StatusBar } from 'expo-status-bar'; import { Provider as PaperProvider } from 'react-native-paper'; +import { SafeAreaProvider } from 'react-native-safe-area-context'; -import Navigation from 'navigation/index'; import useCachedResources from 'hooks/useCachedResources'; import useTheme from 'hooks/useTheme'; +import Navigation from 'navigation/index'; export default function App() { const isLoadingComplete = useCachedResources(); diff --git a/src/__tests__/EditScreenInfo.test.js b/src/__tests__/EditScreenInfo.test.js index 9fdd5b0..5ae8e50 100644 --- a/src/__tests__/EditScreenInfo.test.js +++ b/src/__tests__/EditScreenInfo.test.js @@ -1,4 +1,5 @@ import React from 'react'; + import { cleanup, render } from '@testing-library/react-native'; import EditScreenInfo from 'components/EditScreenInfo'; diff --git a/src/components/EditScreenInfo.tsx b/src/components/EditScreenInfo.tsx index c27509a..09cb189 100644 --- a/src/components/EditScreenInfo.tsx +++ b/src/components/EditScreenInfo.tsx @@ -1,5 +1,6 @@ -import * as WebBrowser from 'expo-web-browser'; import React from 'react'; + +import * as WebBrowser from 'expo-web-browser'; import { StyleSheet, TouchableOpacity, View } from 'react-native'; import { Text } from 'react-native-paper'; diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 76fba21..1035d47 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { FontAwesome } from '@expo/vector-icons'; import { StyleSheet, Pressable } from 'react-native'; diff --git a/src/components/StyledText.tsx b/src/components/StyledText.tsx index 3348183..a595fe3 100644 --- a/src/components/StyledText.tsx +++ b/src/components/StyledText.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { Text } from 'react-native-paper'; interface TextProps { diff --git a/src/components/ViewContainer.tsx b/src/components/ViewContainer.tsx index 8badcd2..2270ba6 100644 --- a/src/components/ViewContainer.tsx +++ b/src/components/ViewContainer.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { StyleSheet, View } from 'react-native'; const styles = StyleSheet.create({ diff --git a/src/database/firebase.tsx b/src/database/firebase.tsx index cb07524..0a55922 100644 --- a/src/database/firebase.tsx +++ b/src/database/firebase.tsx @@ -1,5 +1,3 @@ -import firebase from 'firebase'; -import 'firebase/firestore'; import { API_KEY, AUTH_DOMAIN, @@ -8,6 +6,9 @@ import { MESSAGING_SENDER_ID, APP_ID, } from '@env'; +import firebase from 'firebase'; +import 'firebase/firestore'; + import { Tree, Comment, Additional } from '@types'; const config = { diff --git a/src/hooks/useCachedResources.ts b/src/hooks/useCachedResources.ts index 5184bbc..dd04de2 100644 --- a/src/hooks/useCachedResources.ts +++ b/src/hooks/useCachedResources.ts @@ -1,7 +1,8 @@ +import * as React from 'react'; + import { FontAwesome } from '@expo/vector-icons'; import * as Font from 'expo-font'; import * as SplashScreen from 'expo-splash-screen'; -import * as React from 'react'; const spaceMono = require('assets/fonts/SpaceMono-Regular.ttf'); diff --git a/src/navigation/TabNavigator.tsx b/src/navigation/TabNavigator.tsx index 09ce267..b217fbe 100644 --- a/src/navigation/TabNavigator.tsx +++ b/src/navigation/TabNavigator.tsx @@ -1,14 +1,13 @@ -import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import * as React from 'react'; -import Colors from 'constants/Colors'; -import HomeScreen from 'src/screens/HomeScreen'; -import TreeScreen from 'src/screens/TreeScreen'; -import LoginScreen from 'src/screens/LoginScreen'; -import AddScreen from 'src/screens/AddScreen'; -import { RootTabParamList, RootTabScreenProps } from '@types'; +import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; +import { RootTabParamList, RootTabScreenProps } from '@types'; import Icon from 'components/Icon'; +import AddScreen from 'src/screens/AddScreen'; +import HomeScreen from 'src/screens/HomeScreen'; +import LoginScreen from 'src/screens/LoginScreen'; +import TreeScreen from 'src/screens/TreeScreen'; /** * A bottom tab navigator displays tab buttons on the bottom of the display to switch screens. diff --git a/src/navigation/index.tsx b/src/navigation/index.tsx index 911ce06..6404a23 100644 --- a/src/navigation/index.tsx +++ b/src/navigation/index.tsx @@ -4,14 +4,15 @@ * */ import * as React from 'react'; + import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; +import { RootStackParamList } from '@types'; import ModalScreen from 'screens/ModalScreen'; import NotFoundScreen from 'screens/NotFoundScreen'; -import { RootStackParamList } from '@types'; -import LinkingConfiguration from './LinkingConfiguration'; +import LinkingConfiguration from './LinkingConfiguration'; import TabNavigator from './TabNavigator'; /** diff --git a/src/screens/AddScreen.tsx b/src/screens/AddScreen.tsx index ce0e352..7d084ed 100644 --- a/src/screens/AddScreen.tsx +++ b/src/screens/AddScreen.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { StyleSheet, View } from 'react-native'; import { Title } from 'react-native-paper'; diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index c3bd6fa..ed33516 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { StyleSheet, View } from 'react-native'; import { Title } from 'react-native-paper'; diff --git a/src/screens/LoginScreen.tsx b/src/screens/LoginScreen.tsx index a8a7f92..f2a522d 100644 --- a/src/screens/LoginScreen.tsx +++ b/src/screens/LoginScreen.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { StyleSheet, View } from 'react-native'; import { Title } from 'react-native-paper'; diff --git a/src/screens/ModalScreen.tsx b/src/screens/ModalScreen.tsx index 2b9b61f..8eaf351 100644 --- a/src/screens/ModalScreen.tsx +++ b/src/screens/ModalScreen.tsx @@ -1,5 +1,6 @@ -import { StatusBar } from 'expo-status-bar'; import * as React from 'react'; + +import { StatusBar } from 'expo-status-bar'; import { Platform, StyleSheet, View } from 'react-native'; import { Title } from 'react-native-paper'; diff --git a/src/screens/NotFoundScreen.tsx b/src/screens/NotFoundScreen.tsx index 707f797..4de0182 100644 --- a/src/screens/NotFoundScreen.tsx +++ b/src/screens/NotFoundScreen.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; -import { StyleSheet, TouchableOpacity } from 'react-native'; -import { Title, Text } from 'react-native-paper'; + import PropTypes from 'prop-types'; +import { StyleSheet, TouchableOpacity } from 'react-native'; +import { Text, Title } from 'react-native-paper'; import { RootStackScreenProps } from '@types'; import ViewContainer from 'src/components/ViewContainer'; diff --git a/src/screens/TreeScreen.tsx b/src/screens/TreeScreen.tsx index 4abb495..af30add 100644 --- a/src/screens/TreeScreen.tsx +++ b/src/screens/TreeScreen.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { StyleSheet, View } from 'react-native'; import { Title } from 'react-native-paper';