Skip to content

Commit

Permalink
chore: setup knip and fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-r committed Dec 8, 2023
1 parent 50d77d9 commit 360bf02
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["react-app", "react-app/jest"]
}
3 changes: 3 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"entry": ["src/index.tsx"]
}
2 changes: 1 addition & 1 deletion src/components/NavbarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useLocation } from "react-router-dom";
import { useStableNavigate } from "../providers/Navigate";
import classes from "./NavbarLink.module.css";

export type RoutePath =
type RoutePath =
| "/"
| "/search"
| "/favorites"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { NavbarLink } from "./NavbarLink";
import classes from "./Navigation.module.css";
import { PlayerSpace } from "./Player";

export const NAVIGATION_WIDTH = 88;
const NAVIGATION_WIDTH = 88;

export const Navigation = memo(() => {
const { t } = useTranslation();
Expand Down
2 changes: 1 addition & 1 deletion src/components/PlayerActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface ButtonNextVideoProps extends ActionIconProps {
iconSize?: number;
}

export const ButtonPlayPause: FC<ButtonNextVideoProps> = memo(
const ButtonPlayPause: FC<ButtonNextVideoProps> = memo(
({ size, radius, iconSize }) => {
const playerState = usePlayerState();
const playerAudio = usePlayerAudio();
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransferList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next";

import classes from "./TransferList.module.css";

export type TransferListData = [string[], string[]];
type TransferListData = [string[], string[]];

interface TransferListProps {
data: string[];
Expand Down
6 changes: 0 additions & 6 deletions src/database/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ export const getAllPlaylists = (): CardPlaylist[] => {
return db.queryAll("playlists");
};

export const getLocalPlaylists = (): CardPlaylist[] => {
return db.queryAll("playlists", {
query: (row: Playlist) => row.title !== "Favorites" && !row.playlistId,
});
};

export const getPlaylist = (playlistId: number): Playlist => {
return db.queryAll("playlists", { query: { ID: playlistId } })[0];
};
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { useEffect, useState } from 'react'

// Source: https://usehooks-ts.com/react-hook/use-script

export type UseScriptStatus = 'idle' | 'loading' | 'ready' | 'error'
export interface UseScriptOptions {
type UseScriptStatus = 'idle' | 'loading' | 'ready' | 'error'

interface UseScriptOptions {
shouldPreventLoad?: boolean
removeOnUnmount?: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/PlayerMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useState,
} from "react";

export type PlayerMode = "audio" | "video";
type PlayerMode = "audio" | "video";

const PlayerModeContext = createContext<PlayerMode>("audio");
const SetPlayerModeContext = createContext<(mode: PlayerMode) => void>(
Expand Down
12 changes: 0 additions & 12 deletions src/serviceWorkerRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,3 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
);
});
}

export function unregister() {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready
.then((registration) => {
registration.unregister();
})
.catch((error) => {
console.error(error.message);
});
}
}
2 changes: 1 addition & 1 deletion src/translations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const languagesValues = [
},
];

export const resources = {
const resources = {
en: {
translation: en,
},
Expand Down
8 changes: 0 additions & 8 deletions src/types/interfaces/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ export type SearchDuration = "all" | "short" | "medium" | "long";
export type SearchDate = "all" | "hour" | "today" | "week" | "month" | "year";
export type SearchService = "invidious" | "youtube_music";

export interface SearchParams {
q: String;
type: SearchTypes;
sortBy: SearchSortBy;
date: SearchDate;
duration: SearchDuration;
}

export interface Search {
q: string;
type: SearchTypes;
Expand Down
2 changes: 1 addition & 1 deletion src/types/interfaces/SponsorBlock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type SponsorBlockCategory =
type SponsorBlockCategory =
| "sponsor"
| "intro"
| "outro"
Expand Down
19 changes: 0 additions & 19 deletions src/utils/downloadFile.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/getArrayDifference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { removeDuplicateVideoId } from "../database/utils";
import type { Card, CardVideo } from "../types/interfaces/Card";
import type { Playlist } from "../types/interfaces/Playlist";

export const getCardId = <T>(card: T): string | number =>
const getCardId = <T>(card: T): string | number =>
// @ts-ignore
card.ID || card.videoId || card.playlistId || card.authorId;

Expand Down

0 comments on commit 360bf02

Please sign in to comment.