Fakultas Ilmu Komputer UI

Commit 62e3bffa authored by Bagus Prabowo's avatar Bagus Prabowo
Browse files

Merge branch 'eslint-fix' into 'master'

Refactor: Eslint Configuration Fix

See merge request !72
parents 4eee1812 d627b3ce
Pipeline #86121 passed with stage
in 9 minutes and 20 seconds
......@@ -27,6 +27,7 @@ module.exports = {
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "always"],
"@typescript-eslint/no-unused-vars": 2,
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off",
"react/display-name": "off",
......
......@@ -15,5 +15,6 @@ module.exports = {
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"parser": "typescript"
"parser": "typescript",
"enOfline": "auto"
}
......@@ -3,8 +3,6 @@ import React from "react";
import { Text, StyleSheet, TouchableOpacity, View, Image } from "react-native";
import Colors from "../../constants/Colors";
import Spacer from "../../components/Spacer/Spacer";
import { useAppSelector } from "../../hooks/reduxHooks";
import { IUser } from "../../types/firestore/User";
import Layout from "../../constants/Layout";
type props = {
......@@ -16,7 +14,6 @@ type props = {
};
const HorizontalCards = ({ image, member, title, rate, onPress }: props) => {
const user: IUser = useAppSelector((state) => state.user);
return (
<View>
<TouchableOpacity onPress={() => onPress()}>
......
import { cleanup, render, fireEvent } from "@testing-library/react-native";
import { cleanup } from "@testing-library/react-native";
import FirebaseConfig from "../../../../config/firebase";
import firebase from "firebase/app";
import "firebase/firestore";
......
......@@ -20,7 +20,7 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => {
<MaterialIcons
name="group"
size={15}
color={Colors.icon.inactive}
color={Colors.icon.tab.inactive}
/>
</View>
<View style={{ flex: 1, paddingRight: 7 }}>
......
import * as React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { RootTabParamList, RootTabScreenProps } from "../types/navigation";
import TabOneScreen from "../screens/TabOneScreen";
import { RootTabParamList } from "../types/navigation";
import { FontAwesome } from "@expo/vector-icons";
import { Pressable } from "react-native";
import Colors from "../constants/Colors";
......@@ -17,34 +16,11 @@ const BottomTab = createBottomTabNavigator<RootTabParamList>();
const BottomTabNavigator = () => {
return (
<BottomTab.Navigator
initialRouteName="TabOne"
initialRouteName="Ecosystem"
screenOptions={{
tabBarActiveTintColor: Colors.icon.tab.active, //TODO ganti warna nya
}}
>
<BottomTab.Screen
name="TabOne"
component={TabOneScreen}
options={() => ({
title: "Tab One",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
headerRight: () => (
<Pressable
onPress={() => null}
style={({ pressed }) => ({
opacity: pressed ? 0.5 : 1,
})}
>
<FontAwesome
name="info-circle"
size={25}
color={Colors.text.title} //TODO ganti warna
style={{ marginRight: 15 }}
/>
</Pressable>
),
})}
/>
<BottomTab.Screen
name="Ecosystem"
component={EcosystemStackNavigator}
......
import { combineReducers, createStore, applyMiddleware } from "redux";
import { configureStore } from "@reduxjs/toolkit";
import userReducer from "./user/reducer";
......
import { Dispatch } from "react-redux/node_modules/@types/react";
import * as userService from "../../service/firestore/user";
import { IUser } from "../../types/firestore/User";
import * as authService from "../../service/firebase/auth";
import { ActionErrorRes } from "../../types/redux";
import { AnyAction } from "redux";
export const getUser = (uid: string) => {
return async (dispatch: Dispatch<any>) => {
......@@ -21,7 +18,7 @@ export const getUser = (uid: string) => {
};
export const setProfilePic = (url: string, id: string) => {
return async (dispatch: Dispatch<any>, getState: IUser) => {
return async (dispatch: Dispatch<any>) => {
try {
await userService.addProfilePic(url, id);
......
import { useNavigation } from "@react-navigation/core";
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../components/Themed";
import Colors from "../constants/Colors";
const BusinessCategoryScreen = () => {
const nav = useNavigation();
return (
<View style={styles.container}>
<View>
<Text>Layar Buat Ekosistem Bisnis</Text>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
paddingHorizontal: 24,
justifyContent: "center",
},
});
export default BusinessCategoryScreen;
import { useNavigation } from "@react-navigation/core";
import { NativeStackNavigationProp } from "@react-navigation/native-stack";
import * as React from "react";
import { StyleSheet } from "react-native";
import MainButton from "../components/button/MainButton";
......@@ -7,7 +6,6 @@ import Spacer from "../components/Spacer/Spacer";
import { Text, View } from "../components/Themed";
import Colors from "../constants/Colors";
import { ProfileStackParamList } from "../types/navigation";
export default function SuccessChangePasswordScreen() {
const nav = useNavigation();
......@@ -27,7 +25,7 @@ export default function SuccessChangePasswordScreen() {
<View style={styles.buttonContainer}>
<MainButton
text={"Kembali"}
onPress={() => nav.navigate("AccountSettings")}
onPress={() => nav.navigate("Profile", { screen: "AccountSettings" })}
colors={"Secondary"}
/>
</View>
......
import { useNavigation } from "@react-navigation/core";
import * as React from "react";
import { StyleSheet } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import MainButton from "../components/button/MainButton";
import SmallButton from "../components/button/SmallButton";
import { Text, View } from "../components/Themed";
import Colors from "../constants/Colors";
import { RootTabScreenProps } from "../types/navigation";
export default function TabOneScreen({
navigation,
}: RootTabScreenProps<"TabOne">) {
const nav = useNavigation();
return (
<View style={styles.container}>
<TouchableOpacity onPress={() => nav.navigate("Auth")}>
<Text>To Auth</Text>
</TouchableOpacity>
<SmallButton
text="test"
colors="primary"
onPress={() => nav.navigate("Auth")}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
backgroundColor: Colors.background,
},
title: {
fontSize: 20,
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: "80%",
},
});
......@@ -8,6 +8,7 @@ import { MaterialIcons } from "@expo/vector-icons";
import MainButton from "../../components/button/MainButton";
export default function ForgotPasswordDone({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation,
}: RootTabScreenProps<"TabOne">) {
const nav = useNavigation();
......
......@@ -8,11 +8,10 @@ import PlainForm from "../../components/Forms/PlainForm";
import Spacer from "../../components/Spacer/Spacer";
import { MaterialIcons } from "@expo/vector-icons";
import MainButton from "../../components/button/MainButton";
import firebase from "firebase";
import { validateEmail } from "../../helpers/Validators";
import { forgotPassword } from "../../service/firebase/auth";
export default function InputForgotPassword({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation,
}: RootTabScreenProps<"TabOne">) {
const [email, setEmail] = useState("");
......@@ -51,7 +50,7 @@ export default function InputForgotPassword({
.then(() =>
nav.navigate("Auth", { screen: "ForgotPasswordDone" })
)
.catch((e) =>
.catch(() =>
Alert.alert(
"Email tidak ditemukan",
"Silahkan masukkan email yang terdaftar"
......
import { useNavigation } from "@react-navigation/core";
import React, { useEffect } from "react";
import React from "react";
import { StyleSheet, Image } from "react-native";
import { View } from "../../components/Themed";
import Colors from "../../constants/Colors";
......@@ -7,9 +6,9 @@ import { RootTabScreenProps } from "../../types/navigation";
import Layout from "../../constants/Layout";
export default function LandingScreen({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation,
}: RootTabScreenProps<"TabOne">) {
const nav = useNavigation();
return (
<View style={styles.container}>
<Image
......
......@@ -11,9 +11,8 @@ import { RootTabScreenProps } from "../../types/navigation";
import Spacer from "../../components/Spacer/Spacer";
import { useAppDispatch } from "../../hooks/reduxHooks";
import { loginUser } from "../../redux/user/actions";
import { IUser } from "../../types/firestore/User";
import { ActionErrorRes } from "../../types/redux";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const LoginScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation();
const [email, setEmail] = useState("");
......@@ -23,8 +22,8 @@ const LoginScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const handleSubmit = () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
dispatch(loginUser(email, password))
.then((e: IUser) => nav)
.catch((e: ActionErrorRes) => Alert.alert("Invalid credentials"));
.then(() => nav)
.catch(() => Alert.alert("Invalid credentials"));
};
return (
......
......@@ -9,6 +9,7 @@ import Spacer from "../../components/Spacer/Spacer";
import Layout from "../../constants/Layout";
export default function OnBoardingScreen({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation,
}: RootTabScreenProps<"TabOne">) {
const nav = useNavigation();
......
import { Text, View } from "../../components/Themed";
import * as React from "react";
import { useEffect, useState } from "react";
import { useState } from "react";
import { ScrollView, StyleSheet } from "react-native";
import PlainForm from "../../components/Forms/PlainForm";
import Spacer from "../../components/Spacer/Spacer";
import MainButton from "../../components/button/MainButton";
import Colors from "../../constants/Colors";
import DropdownForm from "../../components/Forms/DropdownForm";
import { getCategories } from "../../db/categories";
import { ddConverter } from "../../helpers/ddConverter";
import { ICategory, IDD } from "../../types/firestore";
import { RootTabScreenProps } from "../../types/navigation";
import { useNavigation } from "@react-navigation/core";
const RegisterGoogleFacebookScreen = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation,
}: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation();
const [firstName, setFirstName] = useState("");
const [lastName, setLastName] = useState("");
const [phoneNo, setPhoneNo] = useState("");
......
import { Text, View } from "../../components/Themed";
import * as React from "react";
import { useEffect, useState } from "react";
import { ScrollView, StyleSheet } from "react-native";
import { useState } from "react";
import { ScrollView, StyleSheet, Alert } from "react-native";
import Colors from "../../constants/Colors";
import PlainForm from "../../components/Forms/PlainForm";
import IconForm from "../../components/Forms/IconForm";
......@@ -11,10 +11,10 @@ import DropdownForm from "../../components/Forms/DropdownForm";
import { RootTabScreenProps } from "../../types/navigation";
import { useNavigation } from "@react-navigation/core";
import { validateEmail, validateEmpty } from "../../helpers/Validators";
import RegisterGoogleFacebookScreen from "./RegisterGoogleFacebookScreen";
import { useAppDispatch } from "../../hooks/reduxHooks";
import { signupUser } from "../../redux/user/actions";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation();
const [firstName, setFirstName] = useState("");
......@@ -23,7 +23,6 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const [password, setPassword] = useState("");
const [phoneNo, setPhoneNo] = useState("");
const [picked, setPicked] = useState("");
const [isError, setIsError] = useState(false);
const [categories, setCategories] = useState([
{ label: "Agrikultur", value: "B" },
{ label: "Pertanian", value: "D" },
......@@ -55,7 +54,7 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
) {
dispatch(signupUser(firstName, lastName, email, password));
} else {
setIsError(true);
Alert.alert("Form Tidak Lengkap", "Silahkan isi form dengan benar");
}
};
......
import { useNavigation } from "@react-navigation/core";
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../../components/Themed";
import { View } from "../../components/Themed";
import Colors from "../../constants/Colors";
import AlphabetGroupList from "../../components/GroupList/AlphabetGroupList";
const BusinessCategoryScreen = () => {
const nav = useNavigation();
const data = [
{ value: "Accomodation and Food Services", key: "1" },
{
......
import { useNavigation } from "@react-navigation/core";
import * as React from "react";
import { StyleSheet } from "react-native";
import { Text, View } from "../../components/Themed";
import Colors from "../../constants/Colors";
const BusinessListScreen = () => {
const nav = useNavigation();
return (
<View style={styles.container}>
<View>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment