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 = { ...@@ -27,6 +27,7 @@ module.exports = {
"linebreak-style": ["error", "unix"], "linebreak-style": ["error", "unix"],
quotes: ["error", "double"], quotes: ["error", "double"],
semi: ["error", "always"], semi: ["error", "always"],
"@typescript-eslint/no-unused-vars": 2,
"no-empty-function": "off", "no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-empty-function": "off",
"react/display-name": "off", "react/display-name": "off",
......
...@@ -15,5 +15,6 @@ module.exports = { ...@@ -15,5 +15,6 @@ module.exports = {
"tabWidth": 2, "tabWidth": 2,
"trailingComma": "es5", "trailingComma": "es5",
"useTabs": false, "useTabs": false,
"parser": "typescript" "parser": "typescript",
"enOfline": "auto"
} }
...@@ -3,8 +3,6 @@ import React from "react"; ...@@ -3,8 +3,6 @@ import React from "react";
import { Text, StyleSheet, TouchableOpacity, View, Image } from "react-native"; import { Text, StyleSheet, TouchableOpacity, View, Image } from "react-native";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import Spacer from "../../components/Spacer/Spacer"; import Spacer from "../../components/Spacer/Spacer";
import { useAppSelector } from "../../hooks/reduxHooks";
import { IUser } from "../../types/firestore/User";
import Layout from "../../constants/Layout"; import Layout from "../../constants/Layout";
type props = { type props = {
...@@ -16,7 +14,6 @@ type props = { ...@@ -16,7 +14,6 @@ type props = {
}; };
const HorizontalCards = ({ image, member, title, rate, onPress }: props) => { const HorizontalCards = ({ image, member, title, rate, onPress }: props) => {
const user: IUser = useAppSelector((state) => state.user);
return ( return (
<View> <View>
<TouchableOpacity onPress={() => onPress()}> <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 FirebaseConfig from "../../../../config/firebase";
import firebase from "firebase/app"; import firebase from "firebase/app";
import "firebase/firestore"; import "firebase/firestore";
......
...@@ -20,7 +20,7 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => { ...@@ -20,7 +20,7 @@ const PlainButton = ({ text, desc, onPress, descText }: props) => {
<MaterialIcons <MaterialIcons
name="group" name="group"
size={15} size={15}
color={Colors.icon.inactive} color={Colors.icon.tab.inactive}
/> />
</View> </View>
<View style={{ flex: 1, paddingRight: 7 }}> <View style={{ flex: 1, paddingRight: 7 }}>
......
import * as React from "react"; import * as React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { RootTabParamList, RootTabScreenProps } from "../types/navigation"; import { RootTabParamList } from "../types/navigation";
import TabOneScreen from "../screens/TabOneScreen";
import { FontAwesome } from "@expo/vector-icons"; import { FontAwesome } from "@expo/vector-icons";
import { Pressable } from "react-native"; import { Pressable } from "react-native";
import Colors from "../constants/Colors"; import Colors from "../constants/Colors";
...@@ -17,34 +16,11 @@ const BottomTab = createBottomTabNavigator<RootTabParamList>(); ...@@ -17,34 +16,11 @@ const BottomTab = createBottomTabNavigator<RootTabParamList>();
const BottomTabNavigator = () => { const BottomTabNavigator = () => {
return ( return (
<BottomTab.Navigator <BottomTab.Navigator
initialRouteName="TabOne" initialRouteName="Ecosystem"
screenOptions={{ screenOptions={{
tabBarActiveTintColor: Colors.icon.tab.active, //TODO ganti warna nya 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 <BottomTab.Screen
name="Ecosystem" name="Ecosystem"
component={EcosystemStackNavigator} component={EcosystemStackNavigator}
......
import { combineReducers, createStore, applyMiddleware } from "redux";
import { configureStore } from "@reduxjs/toolkit"; import { configureStore } from "@reduxjs/toolkit";
import userReducer from "./user/reducer"; import userReducer from "./user/reducer";
......
import { Dispatch } from "react-redux/node_modules/@types/react"; import { Dispatch } from "react-redux/node_modules/@types/react";
import * as userService from "../../service/firestore/user"; import * as userService from "../../service/firestore/user";
import { IUser } from "../../types/firestore/User";
import * as authService from "../../service/firebase/auth"; import * as authService from "../../service/firebase/auth";
import { ActionErrorRes } from "../../types/redux";
import { AnyAction } from "redux";
export const getUser = (uid: string) => { export const getUser = (uid: string) => {
return async (dispatch: Dispatch<any>) => { return async (dispatch: Dispatch<any>) => {
...@@ -21,7 +18,7 @@ export const getUser = (uid: string) => { ...@@ -21,7 +18,7 @@ export const getUser = (uid: string) => {
}; };
export const setProfilePic = (url: string, id: string) => { export const setProfilePic = (url: string, id: string) => {
return async (dispatch: Dispatch<any>, getState: IUser) => { return async (dispatch: Dispatch<any>) => {
try { try {
await userService.addProfilePic(url, id); 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 { useNavigation } from "@react-navigation/core";
import { NativeStackNavigationProp } from "@react-navigation/native-stack";
import * as React from "react"; import * as React from "react";
import { StyleSheet } from "react-native"; import { StyleSheet } from "react-native";
import MainButton from "../components/button/MainButton"; import MainButton from "../components/button/MainButton";
...@@ -7,7 +6,6 @@ import Spacer from "../components/Spacer/Spacer"; ...@@ -7,7 +6,6 @@ import Spacer from "../components/Spacer/Spacer";
import { Text, View } from "../components/Themed"; import { Text, View } from "../components/Themed";
import Colors from "../constants/Colors"; import Colors from "../constants/Colors";
import { ProfileStackParamList } from "../types/navigation";
export default function SuccessChangePasswordScreen() { export default function SuccessChangePasswordScreen() {
const nav = useNavigation(); const nav = useNavigation();
...@@ -27,7 +25,7 @@ export default function SuccessChangePasswordScreen() { ...@@ -27,7 +25,7 @@ export default function SuccessChangePasswordScreen() {
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<MainButton <MainButton
text={"Kembali"} text={"Kembali"}
onPress={() => nav.navigate("AccountSettings")} onPress={() => nav.navigate("Profile", { screen: "AccountSettings" })}
colors={"Secondary"} colors={"Secondary"}
/> />
</View> </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"; ...@@ -8,6 +8,7 @@ import { MaterialIcons } from "@expo/vector-icons";
import MainButton from "../../components/button/MainButton"; import MainButton from "../../components/button/MainButton";
export default function ForgotPasswordDone({ export default function ForgotPasswordDone({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation, navigation,
}: RootTabScreenProps<"TabOne">) { }: RootTabScreenProps<"TabOne">) {
const nav = useNavigation(); const nav = useNavigation();
......
...@@ -8,11 +8,10 @@ import PlainForm from "../../components/Forms/PlainForm"; ...@@ -8,11 +8,10 @@ import PlainForm from "../../components/Forms/PlainForm";
import Spacer from "../../components/Spacer/Spacer"; import Spacer from "../../components/Spacer/Spacer";
import { MaterialIcons } from "@expo/vector-icons"; import { MaterialIcons } from "@expo/vector-icons";
import MainButton from "../../components/button/MainButton"; import MainButton from "../../components/button/MainButton";
import firebase from "firebase";
import { validateEmail } from "../../helpers/Validators";
import { forgotPassword } from "../../service/firebase/auth"; import { forgotPassword } from "../../service/firebase/auth";
export default function InputForgotPassword({ export default function InputForgotPassword({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation, navigation,
}: RootTabScreenProps<"TabOne">) { }: RootTabScreenProps<"TabOne">) {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
...@@ -51,7 +50,7 @@ export default function InputForgotPassword({ ...@@ -51,7 +50,7 @@ export default function InputForgotPassword({
.then(() => .then(() =>
nav.navigate("Auth", { screen: "ForgotPasswordDone" }) nav.navigate("Auth", { screen: "ForgotPasswordDone" })
) )
.catch((e) => .catch(() =>
Alert.alert( Alert.alert(
"Email tidak ditemukan", "Email tidak ditemukan",
"Silahkan masukkan email yang terdaftar" "Silahkan masukkan email yang terdaftar"
......
import { useNavigation } from "@react-navigation/core"; import React from "react";
import React, { useEffect } from "react";
import { StyleSheet, Image } from "react-native"; import { StyleSheet, Image } from "react-native";
import { View } from "../../components/Themed"; import { View } from "../../components/Themed";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
...@@ -7,9 +6,9 @@ import { RootTabScreenProps } from "../../types/navigation"; ...@@ -7,9 +6,9 @@ import { RootTabScreenProps } from "../../types/navigation";
import Layout from "../../constants/Layout"; import Layout from "../../constants/Layout";
export default function LandingScreen({ export default function LandingScreen({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation, navigation,
}: RootTabScreenProps<"TabOne">) { }: RootTabScreenProps<"TabOne">) {
const nav = useNavigation();
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Image <Image
......
...@@ -11,9 +11,8 @@ import { RootTabScreenProps } from "../../types/navigation"; ...@@ -11,9 +11,8 @@ import { RootTabScreenProps } from "../../types/navigation";
import Spacer from "../../components/Spacer/Spacer"; import Spacer from "../../components/Spacer/Spacer";
import { useAppDispatch } from "../../hooks/reduxHooks"; import { useAppDispatch } from "../../hooks/reduxHooks";
import { loginUser } from "../../redux/user/actions"; 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 LoginScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation(); const nav = useNavigation();
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
...@@ -23,8 +22,8 @@ const LoginScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { ...@@ -23,8 +22,8 @@ const LoginScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const handleSubmit = () => { const handleSubmit = () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
dispatch(loginUser(email, password)) dispatch(loginUser(email, password))
.then((e: IUser) => nav) .then(() => nav)
.catch((e: ActionErrorRes) => Alert.alert("Invalid credentials")); .catch(() => Alert.alert("Invalid credentials"));
}; };
return ( return (
......
...@@ -9,6 +9,7 @@ import Spacer from "../../components/Spacer/Spacer"; ...@@ -9,6 +9,7 @@ import Spacer from "../../components/Spacer/Spacer";
import Layout from "../../constants/Layout"; import Layout from "../../constants/Layout";
export default function OnBoardingScreen({ export default function OnBoardingScreen({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation, navigation,
}: RootTabScreenProps<"TabOne">) { }: RootTabScreenProps<"TabOne">) {
const nav = useNavigation(); const nav = useNavigation();
......
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import * as React from "react"; import * as React from "react";
import { useEffect, useState } from "react"; import { useState } from "react";
import { ScrollView, StyleSheet } from "react-native"; import { ScrollView, StyleSheet } from "react-native";
import PlainForm from "../../components/Forms/PlainForm"; import PlainForm from "../../components/Forms/PlainForm";
import Spacer from "../../components/Spacer/Spacer"; import Spacer from "../../components/Spacer/Spacer";
import MainButton from "../../components/button/MainButton"; import MainButton from "../../components/button/MainButton";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import DropdownForm from "../../components/Forms/DropdownForm"; 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 { RootTabScreenProps } from "../../types/navigation";
import { useNavigation } from "@react-navigation/core";
const RegisterGoogleFacebookScreen = ({ const RegisterGoogleFacebookScreen = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
navigation, navigation,
}: RootTabScreenProps<"TabOne">) => { }: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation();
const [firstName, setFirstName] = useState(""); const [firstName, setFirstName] = useState("");
const [lastName, setLastName] = useState(""); const [lastName, setLastName] = useState("");
const [phoneNo, setPhoneNo] = useState(""); const [phoneNo, setPhoneNo] = useState("");
......
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import * as React from "react"; import * as React from "react";
import { useEffect, useState } from "react"; import { useState } from "react";
import { ScrollView, StyleSheet } from "react-native"; import { ScrollView, StyleSheet, Alert } from "react-native";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import PlainForm from "../../components/Forms/PlainForm"; import PlainForm from "../../components/Forms/PlainForm";
import IconForm from "../../components/Forms/IconForm"; import IconForm from "../../components/Forms/IconForm";
...@@ -11,10 +11,10 @@ import DropdownForm from "../../components/Forms/DropdownForm"; ...@@ -11,10 +11,10 @@ import DropdownForm from "../../components/Forms/DropdownForm";
import { RootTabScreenProps } from "../../types/navigation"; import { RootTabScreenProps } from "../../types/navigation";
import { useNavigation } from "@react-navigation/core"; import { useNavigation } from "@react-navigation/core";
import { validateEmail, validateEmpty } from "../../helpers/Validators"; import { validateEmail, validateEmpty } from "../../helpers/Validators";
import RegisterGoogleFacebookScreen from "./RegisterGoogleFacebookScreen";
import { useAppDispatch } from "../../hooks/reduxHooks"; import { useAppDispatch } from "../../hooks/reduxHooks";
import { signupUser } from "../../redux/user/actions"; import { signupUser } from "../../redux/user/actions";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const nav = useNavigation(); const nav = useNavigation();
const [firstName, setFirstName] = useState(""); const [firstName, setFirstName] = useState("");
...@@ -23,7 +23,6 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { ...@@ -23,7 +23,6 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
const [phoneNo, setPhoneNo] = useState(""); const [phoneNo, setPhoneNo] = useState("");
const [picked, setPicked] = useState(""); const [picked, setPicked] = useState("");
const [isError, setIsError] = useState(false);
const [categories, setCategories] = useState([ const [categories, setCategories] = useState([
{ label: "Agrikultur", value: "B" }, { label: "Agrikultur", value: "B" },
{ label: "Pertanian", value: "D" }, { label: "Pertanian", value: "D" },
...@@ -55,7 +54,7 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { ...@@ -55,7 +54,7 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
) { ) {
dispatch(signupUser(firstName, lastName, email, password)); dispatch(signupUser(firstName, lastName, email, password));
} else { } 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 * as React from "react";
import { StyleSheet } from "react-native"; import { StyleSheet } from "react-native";
import { Text, View } from "../../components/Themed"; import { View } from "../../components/Themed";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
import AlphabetGroupList from "../../components/GroupList/AlphabetGroupList"; import AlphabetGroupList from "../../components/GroupList/AlphabetGroupList";
const BusinessCategoryScreen = () => { const BusinessCategoryScreen = () => {
const nav = useNavigation();
const data = [ const data = [
{ value: "Accomodation and Food Services", key: "1" }, { value: "Accomodation and Food Services", key: "1" },
{ {
......
import { useNavigation } from "@react-navigation/core";
import * as React from "react"; import * as React from "react";
import { StyleSheet } from "react-native"; import { StyleSheet } from "react-native";
import { Text, View } from "../../components/Themed"; import { Text, View } from "../../components/Themed";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
const BusinessListScreen = () => { const BusinessListScreen = () => {
const nav = useNavigation();
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View> <View>
......
Supports Markdown
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