Skip to content

Commit

Permalink
Remove lint issues
Browse files Browse the repository at this point in the history
Dinika committed May 2, 2024
1 parent 4b5b446 commit b86072c
Showing 13 changed files with 15 additions and 31 deletions.
15 changes: 2 additions & 13 deletions src/components/CategoryIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import Box from '@material-ui/core/Box';
import FormControl from '@material-ui/core/FormControl';
import MenuItem from '@material-ui/core/MenuItem';
import Select from '@material-ui/core/Select';
import { makeStyles } from '@material-ui/core/styles';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import React, { useEffect, useState } from 'react';
import 'react-datepicker/dist/react-datepicker.css';
import { euroToChf } from '../redux/reducers/expenses';
import { Expense } from '../types';
import './DateRangePickerStyles.css';
import ShoppingCartOutlinedIcon from '@material-ui/icons/ShoppingCartOutlined';
import LocalMallOutlinedIcon from '@material-ui/icons/LocalMallOutlined';
import EcoOutlinedIcon from '@material-ui/icons/EcoOutlined';
import FastfoodOutlinedIcon from '@material-ui/icons/FastfoodOutlined';
import HomeOutlinedIcon from '@material-ui/icons/HomeOutlined';
import FlightTakeoffOutlinedIcon from '@material-ui/icons/FlightTakeoffOutlined';
import TramOutlinedIcon from '@material-ui/icons/TramOutlined';
import DirectionsCarOutlinedIcon from '@material-ui/icons/DirectionsCarOutlined';
import PetsOutlinedIcon from '@material-ui/icons/PetsOutlined';
import FavoriteOutlinedIcon from '@material-ui/icons/FavoriteOutlined';
import DevicesOtherOutlinedIcon from '@material-ui/icons/DevicesOtherOutlined';
import LocalPharmacyOutlinedIcon from '@material-ui/icons/LocalPharmacyOutlined';
import DashboardOutlinedIcon from '@material-ui/icons/DashboardOutlined';
import LocalFloristOutlinedIcon from '@material-ui/icons/LocalFloristOutlined';
import React from 'react';

export function CategoryIcon({ category }: { category: string }): JSX.Element {
let icon;
@@ -45,7 +34,7 @@ export function CategoryIcon({ category }: { category: string }): JSX.Element {
case 'car':
icon = <DirectionsCarOutlinedIcon color="secondary" />;
break;
case 'pet':
case 'git ':
icon = <PetsOutlinedIcon color="secondary" />;
break;
case 'family':
6 changes: 1 addition & 5 deletions src/components/EditExpenseDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { ADD_EXPENSE } from '../redux/actions';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';
import { makeStyles } from '@material-ui/core';
import MenuItem from '@material-ui/core/MenuItem';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import DatePicker from 'react-datepicker';
import { format } from 'date-fns';
import { CategoryIcon } from './CategoryIcon';
import { Currency, Expense, NewExpense } from '../types';
@@ -155,7 +151,7 @@ export const EditExpenseDialog = ({
currentExpense: Expense;
open: boolean;
handleClose(): void;
}) => {
}): JSX.Element => {
const [description, setDescription] = useState(currentExpense.description);
const [currency, setCurrency] = useState<Currency>(currentExpense.currency);
const [amount, setAmount] = useState<number>(currentExpense.amount);
2 changes: 1 addition & 1 deletion src/components/ExpenseInReview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, CardActions, MenuItem, TextField, makeStyles } from '@material-ui/core';
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';
import { Currency, ExpenseToReview } from '../types';
import { accounts, categories, currencies, wiseToCustomCategory } from './EditExpenseDialog';
import { useDispatch } from 'react-redux';
2 changes: 1 addition & 1 deletion src/components/ExpenseItem.tsx
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import { CategoryIcon } from './CategoryIcon';
import './DateRangePickerStyles.css';
import { EditExpenseDialog } from './EditExpenseDialog';

const useStyles = makeStyles((theme) => ({
const useStyles = makeStyles(() => ({
container: {
display: 'flex',
alignItems: 'center',
1 change: 0 additions & 1 deletion src/components/ImportExpensesDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Button, CircularProgress, DialogActions, DialogTitle, makeStyles, TextField } from '@material-ui/core';
import Dialog from '@material-ui/core/Dialog';
import DialogContent from '@material-ui/core/DialogContent';
import { Summary } from '../types';
import React, { useState } from 'react';
import { format } from 'date-fns';
import { useDispatch, useSelector } from 'react-redux';
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import reportWebVitals from './reportWebVitals';
import { Provider } from 'react-redux';
import { store } from './redux/store';
import { unstable_createMuiStrictModeTheme as createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
import { createBrowserRouter, Outlet, RouterProvider } from 'react-router-dom';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { ReviewExpenses } from './pages/ReviewExpenses';
import { Root } from './Root';

2 changes: 0 additions & 2 deletions src/pages/ExpensesApp.tsx
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import { ExpenseItem } from '../components/ExpenseItem';
import { TotalAmount } from '../components/TotalAmount';
import {
Status,
fetchExpenses,
fetchExpensesToReviewCount,
releaseExpensesInReview,
selectAmountInEuros,
selectExpensesInRange,
3 changes: 1 addition & 2 deletions src/pages/ReviewExpenses.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';
import { useSelector } from 'react-redux';
import { RootState } from '../redux/store';
import { Button, Card } from '@material-ui/core';
import { ExpenseInReview } from '../components/ExpenseInReview';
import { Link } from 'react-router-dom';

6 changes: 5 additions & 1 deletion src/redux/actions.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@ import { Expense } from '../types';

let nextExpenseId = 0;

export const addExpense = (expense: Expense) => ({
type Payload = Expense & {
id: number;
};

export const addExpense = (expense: Expense): { type: string; payload: Payload } => ({
type: ADD_EXPENSE,
payload: {
...expense,
2 changes: 1 addition & 1 deletion src/redux/reducers/expenses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnyAction, createAsyncThunk, createSlice, isAsyncThunkAction } from '@reduxjs/toolkit';
import { AnyAction, createAsyncThunk, createSlice } from '@reduxjs/toolkit';
import { Expense, ExpenseToReview, NewExpense, Summary } from '../../types';
import { client } from '../../utilities/client';
import { RootState } from '../store';
2 changes: 0 additions & 2 deletions src/redux/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { createStore } from 'redux';
import { rootReducer } from './reducers';
import { configureStore } from '@reduxjs/toolkit';
import expensesReducer from './reducers/expenses';
export const store = configureStore({ reducer: { expenses: expensesReducer } });
1 change: 1 addition & 0 deletions src/utilities/client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// A tiny wrapper around fetch(), borrowed from
// https://kentcdodds.com/blog/replace-axios-with-a-simple-custom-fetch-wrapper

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export async function client(endpoint, { body, ...customConfig } = {}) {
const headers = { 'Content-Type': 'application/json' };

2 changes: 1 addition & 1 deletion src/utilities/string-ops.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const normalizeString = (str: string | null) => (str ? str?.trim().toLowerCase() : '');
export const normalizeString = (str: string | null): string => (str ? str?.trim().toLowerCase() : '');

0 comments on commit b86072c

Please sign in to comment.