Skip to content

Commit

Permalink
style: 💄 eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskaransarkaria committed Sep 7, 2021
1 parent d62e82a commit ef66896
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 32 deletions.
5 changes: 4 additions & 1 deletion src/components/AddToBasket/AddToBasket.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
...list.slice(listIndx + 1),
];
const addNewItemToBasket = (id: string, list: any): BasketProduct[] => [
const addNewItemToBasket = (
id: string,
list: BasketProduct[]
): BasketProduct[] => [
{
id: id,
quantity: 1,
Expand Down
8 changes: 1 addition & 7 deletions src/components/SearchProducts/SearchProducts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import '@testing-library/jest-dom';
import { tick } from 'svelte';
import { get } from 'svelte/store';
import userEvent from '@testing-library/user-event';
import {
render,
screen,
cleanup,
fireEvent,
createEvent,
} from '@testing-library/svelte';
import { render, screen, cleanup } from '@testing-library/svelte';
import SearchProducts from './SearchProducts.svelte';
import { refreshProducts, refreshTags } from '@/libs/requests';
import { products, reset as resetProductsStore } from '@/stores/products';
Expand Down
11 changes: 7 additions & 4 deletions src/libs/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ export const refreshCategory = async (
url: string
): Promise<ReadonlyArray<Category>> => retrieveStateFn(url, getCategory, [])();

export const refreshProducts = async (url: string) =>
retrieveStateFn(url, getProductArray, [])();
export const refreshProducts = async (
url: string
): Promise<readonly Product[]> => retrieveStateFn(url, getProductArray, [])();

export const refreshCategories = async (url: string) =>
export const refreshCategories = async (
url: string
): Promise<readonly Category[]> =>
retrieveStateFn(url, getCategoriesArray, [])();

export const refreshTags = async (url: string) =>
export const refreshTags = async (url: string): Promise<readonly Tag[]> =>
retrieveStateFn(url, getTagsArray, [])();

const getCategory: GetFn<ReadonlyArray<Category>> = (
Expand Down
17 changes: 0 additions & 17 deletions src/mocks/store.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/stores/basket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export interface BasketProduct {

export const basket: Writable<BasketProduct[]> = writable([]);

export const reset = () => basket.set([]);
export const reset: () => void = () => basket.set([]);
2 changes: 1 addition & 1 deletion src/stores/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const initialValue = {

export const categories = writable<Category>(initialValue);

export const reset = () => categories.set(initialValue);
export const reset: () => void = () => categories.set(initialValue);
2 changes: 1 addition & 1 deletion src/stores/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import type { Product } from '@/types/product';

export const products = writable<readonly Product[]>([]);

export const reset = () => products.set([]);
export const reset: () => void = () => products.set([]);

0 comments on commit ef66896

Please sign in to comment.