Skip to content

Commit

Permalink
Fix Typecheck + Fix Eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
xDalete committed Oct 1, 2024
1 parent 6d60208 commit 16fd596
Show file tree
Hide file tree
Showing 13 changed files with 4,615 additions and 1,922 deletions.
9 changes: 3 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended"],
"ignorePatterns": ["out", "build"],
"overrides": [
{
"files": ["*"],
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ jobs:
- name: Install dependencies
run: npm install
- name: Run TypeScript compiler
run: npm exec tsc -- --noEmit
run: npm run typecheck
- name: Run Eslint checks
run: npm run lint
6,422 changes: 4,563 additions & 1,859 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@electron-toolkit/utils": "^1.0.2",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@types/graceful-fs": "^4.1.6",
"electron-updater": "^5.3.0",
"electron-updater": "^6.3.4",
"fastest-levenshtein": "^1.0.16",
"get-audio-duration": "^4.0.1-beta.0",
"graceful-fs": "^4.2.11",
Expand All @@ -37,15 +37,15 @@
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"electron": "^24.4.1",
"electron-builder": "^23.6.0",
"electron-builder": "^25.0.5",
"electron-vite": "^1.0.23",
"eslint": "^8.42.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-solid": "^0.12.1",
"prettier": "^2.8.8",
"solid-js": "^1.7.6",
"typescript": "^5.1.3",
"typescript": "5.0.4",
"vite": "^4.3.9",
"vite-plugin-solid": "^2.7.0"
}
Expand Down
34 changes: 32 additions & 2 deletions src/@types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { SongViewProps } from './renderer/src/components/song/SongView';
import type { SearchQuerySuccess } from './main/lib/search-parser/@search-types';
import { ConfigItem } from './main/lib/template-parser/parser/TemplateParser';
import { RequestAPI } from './RequestAPI';
Expand Down Expand Up @@ -197,4 +196,35 @@ export type LoadingSceneUpdate = {
max?: number
}

export type Scenes = "" | "loading" | "dir-select" | "main" | "error";
export type Scenes = "" | "loading" | "dir-select" | "main" | "error";

export type SongViewProps = {
isAllSongs?: boolean,
isQueue?: boolean,
playlist?: string,
};

export type NoticeType = {
id?: string,
class: "notice" | "warning" | "error",
title: string,
content: string,
timeoutMS?: number,
active?: boolean,
}

export type InfiniteScrollerRequest = {
index: number,
init: number,
direction: "up" | "down"
}

export type InfiniteScrollerResponse<T = any> = Optional<{
index: number,
items: T[]
}>

export type InfiniteScrollerInitResponse = Optional<{
initialIndex: number,
count: number
}>
3 changes: 1 addition & 2 deletions src/ListenAPI.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { LoadingSceneUpdate, Scenes, Song } from './@types';
import { NoticeType } from './renderer/src/components/notice/Notice';
import { LoadingSceneUpdate, NoticeType, Scenes, Song } from './@types';



Expand Down
8 changes: 3 additions & 5 deletions src/RequestAPI.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type { SearchQuery } from './main/lib/search-parser/@search-types';
import type { ConfigError, ConfigSuccess } from './main/lib/template-parser/parser/TemplateParser';
import type {
InfiniteScrollerInitResponse,
InfiniteScrollerRequest,
InfiniteScrollerResponse
} from './renderer/src/components/InfiniteScroller';
import type {
AudioSource,
ImageSource,
InfiniteScrollerInitResponse,
InfiniteScrollerRequest,
InfiniteScrollerResponse,
Optional,
QueueCreatePayload,
ResourceID,
Expand Down
22 changes: 1 addition & 21 deletions src/renderer/src/components/InfiniteScroller.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
import { Component, createSignal, For, JSX, onCleanup, onMount, Setter, Show, splitProps } from 'solid-js';
import { OmitPropsWithoutReturnType, Optional } from '../../../@types';
import { InfiniteScrollerInitResponse, InfiniteScrollerRequest, InfiniteScrollerResponse, OmitPropsWithoutReturnType } from '../../../@types';
import Impulse from '../lib/Impulse';
import { RequestAPI } from '../../../RequestAPI';



export type InfiniteScrollerRequest = {
index: number,
init: number,
direction: "up" | "down"
}

export type InfiniteScrollerResponse<T = any> = Optional<{
index: number,
items: T[]
}>

export type InfiniteScrollerInitResponse = Optional<{
initialIndex: number,
count: number
}>



type InfinityScrollerProps = {
apiKey: keyof OmitPropsWithoutReturnType<RequestAPI, InfiniteScrollerResponse>,
apiData?: any,
Expand Down
12 changes: 1 addition & 11 deletions src/renderer/src/components/notice/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@ import { Accessor, Component, createSignal } from 'solid-js';
import Fa from 'solid-fa';
import { faXmark } from '@fortawesome/free-solid-svg-icons';
import { GLOBAL_ICON_SCALE } from '../../App';
import { Optional } from '../../../../@types';
import { NoticeType, Optional } from '../../../../@types';
import { none, orDefault, some } from '../../lib/rust-like-utils-client/Optional';
import { hideNotice } from './NoticeContainer';
import "../../assets/css/notice/notice.css";
import Gradient from '../Gradient';
import Impulse from '../../lib/Impulse';



export type NoticeType = {
id?: string,
class: "notice" | "warning" | "error",
title: string,
content: string,
timeoutMS?: number,
active?: boolean,
}

type NoticeProps = {
notice: NoticeType,
updateGradient: Impulse,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/components/notice/NoticeContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { For, onMount } from 'solid-js';
import "../../assets/css/notice/notice-container.css";
import { createStore } from 'solid-js/store';
import Notice, { NoticeType } from './Notice';
import Notice from './Notice';
import { TokenNamespace } from '../../lib/tungsten/token';
import { Result } from '../../../../@types';
import { NoticeType, Result } from '../../../../@types';
import { fail, ok } from '../../lib/rust-like-utils-client/Result';
import Impulse from '../../lib/Impulse';

Expand Down
8 changes: 1 addition & 7 deletions src/renderer/src/components/song/SongView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Search from '../search/Search';
import SongItem from './SongItem';
import { Component, createEffect, createSignal, onCleanup, onMount } from 'solid-js';
import { Optional, ResourceID, SongsQueryPayload, Tag } from '../../../../@types';
import { Optional, ResourceID, SongsQueryPayload, SongViewProps, Tag } from '../../../../@types';
import "../../assets/css/song/song-view.css";
import { SearchQueryError } from '../../../../main/lib/search-parser/@search-types';
import { none, some } from '../../lib/rust-like-utils-client/Optional';
Expand All @@ -12,12 +12,6 @@ import PlayNext from './context-menu/items/PlayNext';



export type SongViewProps = {
isAllSongs?: boolean,
isQueue?: boolean,
playlist?: string,
};

const SongView: Component<SongViewProps> = props => {
const querySignal = createSignal("");
const [query] = querySignal;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/lib/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class State<T extends {}> {
return this;
}

get<K extends keyof T>(key: K): T[K] | undefined {
get<K extends keyof T>(key: K): T[keyof T] | undefined {
return this.schema.get(key);
}
}
1 change: 0 additions & 1 deletion src/renderer/src/lib/song.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export function createDefaultSong(): Song {
path: "",
audio: "",
bg: "",
dir: "",

artist: "Artist",
title: "Title",
Expand Down

0 comments on commit 16fd596

Please sign in to comment.