chore(lint): switch to eslint

This commit is contained in:
Julian Tölle 2021-05-25 18:12:42 +02:00
parent f56548e432
commit 9b96d0fab4
29 changed files with 1609 additions and 113 deletions

View file

@ -1,8 +1,4 @@
import {
Injectable,
OnApplicationBootstrap,
OnModuleInit,
} from "@nestjs/common";
import { Injectable, OnApplicationBootstrap } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { SchedulerRegistry } from "@nestjs/schedule";
import { captureException } from "@sentry/node";

View file

@ -1,5 +1,4 @@
import { Module } from "@nestjs/common";
import { ConfigModule } from "../config/config.module";
import { SchedulerService } from "./scheduler.service";
import { SpotifyModule } from "./spotify/spotify.module";

View file

@ -12,7 +12,6 @@ export class SpotifyApiService {
async getRecentlyPlayedTracks({
accessToken,
lastRefreshTime,
}: SpotifyConnection): Promise<PlayHistoryObject[]> {
const parameters: { limit: number; after?: number } = {
limit: 50,

View file

@ -35,6 +35,8 @@ export class SpotifyService {
const users = await this.usersService.findAll();
for (const user of users) {
// We want to run this sequentially to avoid rate limits
// eslint-disable-next-line no-await-in-loop
await this.crawlListensForUser(user);
}
}
@ -142,7 +144,7 @@ export class SpotifyService {
spotifyID
);
} catch (err) {
if (err.response && err.response.status === 401) {
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
await this.refreshAppAccessToken();
return this.importTrack(spotifyID, false);
@ -192,7 +194,7 @@ export class SpotifyService {
spotifyID
);
} catch (err) {
if (err.response && err.response.status === 401) {
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
await this.refreshAppAccessToken();
return this.importAlbum(spotifyID, false);
@ -238,7 +240,7 @@ export class SpotifyService {
spotifyID
);
} catch (err) {
if (err.response && err.response.status === 401) {
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
await this.refreshAppAccessToken();
return this.importArtist(spotifyID, false);
@ -261,6 +263,8 @@ export class SpotifyService {
private async refreshAppAccessToken(): Promise<void> {
if (!this.appAccessTokenInProgress) {
this.logger.debug("refreshing spotify app access token");
/* eslint-disable no-async-promise-executor */
this.appAccessTokenInProgress = new Promise(async (resolve, reject) => {
try {
const newAccessToken =