diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..7a934a1 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "standard-with-typescript", + "plugin:react/recommended" + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + "project": "./tsconfig.json" + }, + "plugins": [ + "react" + ], + "rules": { + "@typescript-eslint/consistent-type-imports": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "react/react-in-jsx-scope": "off", + "@typescript-eslint/consistent-type-assertions": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-var-requires": "off", + "react/no-unescaped-entities": "off", + "@typescript-eslint/prefer-reduce-type-parameter": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-unused-expressions": "off", + "@typescript-eslint/restrict-plus-operands": "off" + } +} diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLinters/eslint.xml b/.idea/jsLinters/eslint.xml new file mode 100644 index 0000000..e94fc66 --- /dev/null +++ b/.idea/jsLinters/eslint.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/App.tsx b/App.tsx index 96a1316..f2952da 100644 --- a/App.tsx +++ b/App.tsx @@ -1,12 +1,12 @@ -import { AuthProvider } from './app/providers/AuthProvider'; -import { Navigation } from './app/navigation/Navigation'; -import { useFonts } from './app/hooks/useFonts'; -import { DataProvider } from './app/providers/DataProvider'; -import { StoryContainer } from './app/components/screens/home/stories/StoryContainer'; -import { GeneratePasswordProvider } from './app/providers/GeneratePasswordProvider'; +import { AuthProvider } from './app/providers/AuthProvider' +import { Navigation } from './app/navigation/Navigation' +import { useFonts } from './app/hooks/useFonts' +import { DataProvider } from './app/providers/DataProvider' +import { StoryContainer } from './app/components/screens/home/stories/StoryContainer' +import { GeneratePasswordProvider } from './app/providers/GeneratePasswordProvider' -export default function App() { - const { fontLoaded } = useFonts(); +export default function App () { + const { fontLoaded } = useFonts() if (fontLoaded) { return ( @@ -19,6 +19,6 @@ export default function App() { - ); + ) } } diff --git a/app/components/layout/Layout.tsx b/app/components/layout/Layout.tsx index 02f8eb9..7cb03c5 100644 --- a/app/components/layout/Layout.tsx +++ b/app/components/layout/Layout.tsx @@ -1,22 +1,23 @@ -import { View, ScrollView, StyleSheet } from 'react-native'; -import { FC, ReactNode } from 'react'; +import { View, ScrollView, StyleSheet } from 'react-native' +import { FC, ReactNode } from 'react' interface Props { - isScrollView?: boolean, - children: ReactNode, + isScrollView?: boolean + children: ReactNode } export const Layout: FC = ({ children, isScrollView = true }) => { - return ( - {isScrollView ? ( + {isScrollView + ? ( {children} - ) : ( - children - )} + ) + : ( + children + )} ) } diff --git a/app/components/layout/footer/Footer.tsx b/app/components/layout/footer/Footer.tsx index 14e5f42..9f220ea 100644 --- a/app/components/layout/footer/Footer.tsx +++ b/app/components/layout/footer/Footer.tsx @@ -1,17 +1,17 @@ -import { StyleSheet } from 'react-native'; -import { FC } from 'react'; -import { Padding } from '../../ui/Padding'; -import { menu } from './menu'; -import { NavItem } from './NavItem/NavItem'; -import { TypeRootStackParamList } from '../../../navigation/types'; +import { StyleSheet } from 'react-native' +import { FC } from 'react' +import { Padding } from '../../ui/Padding' +import { menu } from './menu' +import { NavItem } from './NavItem/NavItem' +import { TypeRootStackParamList } from '../../../navigation/types' interface Props { - navigate: (screenName: keyof TypeRootStackParamList) => void, - currentRoute: string, + navigate: (screenName: keyof TypeRootStackParamList) => void + currentRoute: string } export const Footer: FC = (props) => { - const { navigate, currentRoute } = props; + const { navigate, currentRoute } = props return ( @@ -38,6 +38,6 @@ const styles = StyleSheet.create({ paddingBottom: 20, paddingTop: 8, borderTopColor: '#E1E1E1', - borderTopWidth: 1, + borderTopWidth: 1 } }) diff --git a/app/components/layout/footer/NavItem/NavItem.tsx b/app/components/layout/footer/NavItem/NavItem.tsx index 7d59c43..48ffc77 100644 --- a/app/components/layout/footer/NavItem/NavItem.tsx +++ b/app/components/layout/footer/NavItem/NavItem.tsx @@ -1,24 +1,24 @@ -import { Text, Pressable, StyleSheet } from 'react-native'; -import { FC } from 'react'; -import { IFooterItem } from '../../../../typedefs/typedefs'; -import { AntDesign } from '@expo/vector-icons'; -import { TypeRootStackParamList } from '../../../../navigation/types'; +import { Text, Pressable, StyleSheet } from 'react-native' +import { FC } from 'react' +import { IFooterItem } from '../../../../typedefs/typedefs' +import { AntDesign } from '@expo/vector-icons' +import { TypeRootStackParamList } from '../../../../navigation/types' interface Props { - item: IFooterItem, - navigate: (screenName: keyof TypeRootStackParamList) => void, - currentRoute: string, + item: IFooterItem + navigate: (screenName: keyof TypeRootStackParamList) => void + currentRoute: string } export const NavItem: FC = (props) => { - const { item, navigate, currentRoute } = props; + const { item, navigate, currentRoute } = props - const isActive = currentRoute === item.title; + const isActive = currentRoute === item.title return ( navigate(item.title)} + onPress={() => { navigate(item.title) }} > { - const [data, setData] = useState({} as IData); - const [isReg, setIsReg] = useState(false); - const [isSecure, setIsSecure] = useState(true); + const [data, setData] = useState({} as IData) + const [isReg, setIsReg] = useState(false) + const [isSecure, setIsSecure] = useState(true) const { isLoading, login, register - } = useAuth(); + } = useAuth() - const { password, isClicked } = useGeneratePassword(); + const { password, isClicked } = useGeneratePassword() - const { isModalVisible, handleChangeModalVisible } = useGeneratePassword(); + const { isModalVisible, handleChangeModalVisible } = useGeneratePassword() const authHandler = async () => { - const { email, password } = data; + const { email, password } = data if (isReg) { - await register(email, password); + await register(email, password) } else { - await login(email, password); + await login(email, password) } - setData({} as IData); - navigation.navigate('Home'); - }; + setData({} as IData) + navigation.navigate('Home') + } const handleChangeSecure = useCallback(() => { - setIsSecure((prevState => !prevState)) + setIsSecure(prevState => !prevState) }, []) useEffect(() => { - setData({...data, password: password}); + setData({ ...data, password }) }, [isClicked]) return ( - + {isReg ? 'Sign Up' : 'Sign in'} - {isLoading ? ( + {isLoading + ? ( - ) : ( + ) + : ( <> setData({...data, email: val})} + onChange={val => { setData({ ...data, email: val }) }} /> setData({...data, password: val})} + onChange={val => { setData({ ...data, password: val }) }} isSecure={isSecure} onChangeSecure={handleChangeSecure} /> - handleChangeModalVisible()}> + { handleChangeModalVisible() }}> {isReg ? 'Generate password' : ''} @@ -80,16 +82,16 @@ export const Auth: FC = ({ navigation }: any) => {