Skip to content

Commit

Permalink
chore: lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Venipa committed Nov 4, 2024
1 parent ee7d643 commit 739d0a5
Show file tree
Hide file tree
Showing 18 changed files with 368 additions and 435 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module.exports = {
'vue/require-default-prop': 'off',
'vue/multi-word-component-names': 'off',
"no-unused-vars": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unnecessary-type-parameters": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ytmdesktop2",
"version": "0.14.0-rc0",
"version": "0.14.0",
"private": false,
"author": "Venipa <[email protected]>",
"main": "./out/main/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const runApp = async function () {
youtubeView.webContents.once("did-finish-load", () => resolve()),
);
}
return;
return Promise.resolve(null);
})
.finally(() => {
isGoogleLoginProcessing = false;
Expand Down
7 changes: 5 additions & 2 deletions src/main/plugins/apiProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TrackProvider from "./trackProvider.plugin";

@IpcContext
export default class ApiProvider extends BaseProvider implements AfterInit, OnDestroy {
private _thread: ApiWorker;
private _thread?: ApiWorker;
constructor(private _app: App) {
super("api");
}
Expand Down Expand Up @@ -57,7 +57,7 @@ export default class ApiProvider extends BaseProvider implements AfterInit, OnDe
async getTrackInformation() {
return (this.getProvider("track") as TrackProvider)?.trackData;
}
private _currentPallete: { id: string; color: string } = null;
private _currentPallete: { id: string; color: string } | null = null;
@IpcHandle(API_ROUTES.TRACK_ACCENT)
async getTrackAccent() {
const track = await this.getTrackInformation();
Expand Down Expand Up @@ -93,6 +93,8 @@ export default class ApiProvider extends BaseProvider implements AfterInit, OnDe
});
return isLiked;
});

return null;
}
@IpcHandle(API_ROUTES.TRACK_DISLIKE)
async postTrackDisLike(_ev, like: boolean) {
Expand All @@ -110,6 +112,7 @@ export default class ApiProvider extends BaseProvider implements AfterInit, OnDe
});
return _likeState;
});
return null;
}
@IpcHandle(API_ROUTES.TRACK_CURRENT_STATE)
async getTrackState() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/plugins/appProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createAppWindow } from "../utils/windowUtils";
const STATE_PAUSE_TIME = isDevelopment ? 30e3 : 30e4;
@IpcContext
export default class AppProvider extends BaseProvider implements AfterInit, BeforeStart {
private appLock: boolean;
private appLock: boolean = false;
constructor(private _app: App) {
super("app");
}
Expand Down Expand Up @@ -42,7 +42,7 @@ export default class AppProvider extends BaseProvider implements AfterInit, Befo
this._app.on("browser-window-focus", this.windowFocus.bind(this));
this._app.on("browser-window-blur", this.windowBlur.bind(this));
}
private _blurTimestamp: Date = null;
private _blurTimestamp: Date | null = null;
private _blurAfkHandle: any;
private get isPlaying() {
return !!this.getProvider("track")?.playing;
Expand Down
4 changes: 2 additions & 2 deletions src/main/plugins/customCssProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class CustomCSSProvider extends BaseProvider implements AfterInit
}
async AfterInit() {
this._initializeSCSS().then(() => {
if (this.settingsInstance.instance?.customcss?.enabled) this._event_toggleCss(null, true);
if (this.settingsInstance.instance?.customcss?.enabled) this._event_toggleCss("", true);
});
}
private async _initializeSCSS() {
Expand All @@ -105,6 +105,6 @@ export default class CustomCSSProvider extends BaseProvider implements AfterInit
}
readonly initializeSCSS = () =>
this._initializeSCSS().then(() =>
this._event_toggleCss(null, !!this.settingsInstance.instance?.customcss?.enabled),
this._event_toggleCss("", !!this.settingsInstance.instance?.customcss?.enabled),
);
}
14 changes: 7 additions & 7 deletions src/main/plugins/discordProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default class DiscordProvider extends BaseProvider implements AfterInit {
get enabled() {
return this._enabled;
}
private client: DiscordClient;
private _presence: Presence;
private client: DiscordClient | null = null;
private _presence: Presence | null = null;
get presence() {
return this._presence;
return this._presence!;
}
set presence(val: Presence) {
this._presence = val;
Expand Down Expand Up @@ -60,7 +60,7 @@ export default class DiscordProvider extends BaseProvider implements AfterInit {
this.logger.error(err);
});
this.client = null;
this.presence = null;
this._presence = null;
}
async enable() {
if (this.client) return;
Expand All @@ -69,7 +69,7 @@ export default class DiscordProvider extends BaseProvider implements AfterInit {
this._isConnected = true;
this.windowContext.sendToAllViews("discord.connected");
}
private async createClient(): Promise<[DiscordClient, Presence]> {
private async createClient(): Promise<[DiscordClient, Presence] | null> {
if (!this._enabled || this.isConnected) return null;
this._enabled = true;
const client = new DiscordClient({
Expand Down Expand Up @@ -125,9 +125,9 @@ export default class DiscordProvider extends BaseProvider implements AfterInit {
if (this.presence.buttons.length === 0 || !this.settingsInstance.instance.discord.buttons)
delete this.presence.buttons;
}
if (YoutubeMatcher.Thumbnail.test(presence.largeImageKey)) {
if (presence.largeImageKey && YoutubeMatcher.Thumbnail.test(presence.largeImageKey)) {
this.presence.largeImageKey = presence.largeImageKey;
}
} else this.presence.largeImageKey = DEFAULT_PRESENCE.largeImageKey!;
if (this.presence.startTimestamp === null) delete this.presence.startTimestamp;
if (this.presence.endTimestamp === null) delete this.presence.endTimestamp;
if (!this.client || !this.isConnected) return;
Expand Down
6 changes: 3 additions & 3 deletions src/main/plugins/lastfmProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class LastFMProvider extends BaseProvider implements AfterInit, O
this.client.setAuthorize({
token: lastFMState.token,
session: lastFMState.session,
name: string.escapeHTML(lastfm.name),
name: lastfm.name ? string.escapeHTML(lastfm.name!) : "",
});
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ export default class LastFMProvider extends BaseProvider implements AfterInit, O
win.webContents.on("did-navigate", async (ev, url, code, status) => {
this.logger.debug(`[URL]> ${url}, ${code}, ${status}`);
if (await hasSuccessInfo()) {
const userState: LastFMUserState = await win.webContents
const userState = await win.webContents
.executeJavaScript(`document.getElementById("tlmdata")?.dataset?.tealiumData`)
.then(parseJson<LastFMUserState>)
.catch(() => null);
Expand Down Expand Up @@ -162,7 +162,7 @@ export default class LastFMProvider extends BaseProvider implements AfterInit, O
}
@IpcHandle("action:" + IPC_EVENT_NAMES.LAST_FM_TOGGLE)
async handleLastFMToggle(_, state: boolean) {
if (state === undefined) return;
if (state === undefined) return null;
const settings = this.getProvider("settings");
settings.set("lastfm.enabled", !!state);
settings.saveToDrive();
Expand Down
2 changes: 1 addition & 1 deletion src/main/plugins/mediaControlProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class MediaControlProvider
extends BaseProvider
implements AfterInit, BeforeStart, OnDestroy
{
private _mediaProvider: MediaServiceProvider;
private _mediaProvider!: MediaServiceProvider;
private xosmsLog = this.logger.child("xosms");
constructor(private app: App) {
super("mediaController");
Expand Down
3 changes: 2 additions & 1 deletion src/main/plugins/updateProvider.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default class UpdateProvider extends BaseProvider implements BeforeStart,
async onAutoUpdateRun() {
if (!this.updateDownloaded && !this.updateQueuedForInstall) {
const [downloadPromise] = this.onDownloadUpdate();
if (!downloadPromise) return;
await downloadPromise;
}
if (!this.isAutoUpdate) autoUpdater.quitAndInstall(false, true);
Expand All @@ -125,7 +126,7 @@ export default class UpdateProvider extends BaseProvider implements BeforeStart,
private _downloadToken: CancellationToken | null = null;
@IpcOn("app.downloadUpdate")
onDownloadUpdate(): [Promise<string[]>, () => void] {
if (!this.updateAvailable || this.updateDownloaded || this.updateQueuedForInstall) return;
if (!this.updateAvailable || this.updateDownloaded || this.updateQueuedForInstall) return [] as any;
this._downloadToken = new CancellationToken();
return [
autoUpdater.downloadUpdate(this._downloadToken),
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/SettingsCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
type="checkbox"
class="checkbox checkbox-primary"
:checked="value"
@change="(ev) => updateSetting(!!ev.target.checked)"
@change="(ev: any) => updateSetting(!!ev.target.checked)"
/>
<span class="checkbox-mark"></span>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/src/components/SettingsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
<input
ref="fileInputRef"
:type="$attrs.type"
:placeholder="$attrs.placeholder"
:accept="$attrs.accept"
:placeholder="$attrs.placeholder as string"
:accept="$attrs.accept as string"
class="hidden"
@change="(ev) => updateSetting(ev.target)"
@change="(ev) => updateSetting(ev.target as any)"
/>
</template>
<input
v-else
:type="$attrs.type"
:placeholder="$attrs.placeholder"
:type="$attrs.type as string"
:placeholder="$attrs.placeholder as string"
:value="value"
class="input input-ghost"
@change="(ev) => updateSetting(ev.target)"
@change="(ev) => updateSetting(ev.target as any)"
/>
</div>
</template>
Expand Down
Loading

0 comments on commit 739d0a5

Please sign in to comment.