Bläddra i källkod

fix: lint errors

Sv443 4 månader sedan
förälder
incheckning
c29678ca93
5 ändrade filer med 9 tillägg och 9 borttagningar
  1. 2 2
      src/filter.ts
  2. 3 3
      src/songData.ts
  3. 1 1
      test/album.spec.ts
  4. 2 2
      test/search.spec.ts
  5. 1 1
      test/translations.spec.ts

+ 2 - 2
src/filter.ts

@@ -1,7 +1,7 @@
 import type { MetaSearchHit, ScoredResults, SearchFilterArgs } from "./types";
 
-export function filterSearchResults(args: SearchFilterArgs, results: MetaSearchHit[]): MetaSearchHit[] {
-  let scored: ScoredResults<MetaSearchHit>[] = [];
+export function filterSearchResults(_args: SearchFilterArgs, _results: MetaSearchHit[]): MetaSearchHit[] {
+  const scored: ScoredResults<MetaSearchHit>[] = [];
 
   // TODO:
   // 1. check direct match

+ 3 - 3
src/songData.ts

@@ -1,6 +1,6 @@
 import { axios, baseAxiosOpts } from "./axios";
 import { charReplacements } from "./constants";
-import type { Album, ApiSearchResult, ApiSongResult, GetMetaArgs, GetMetaResult, MetaSearchHit, SongMeta, SongTranslation } from "./types";
+import type { Album, ApiSearchResult, ApiSongResult, GetMetaArgs, GetMetaResult, MetaSearchHit, SongTranslation } from "./types";
 
 /**
  * Returns meta information about the top results of a search using the genius API
@@ -26,7 +26,7 @@ export async function getMeta({
     if(response.hits.length === 0)
       return null;
 
-    let hits: MetaSearchHit[] = response.hits
+    const hits: MetaSearchHit[] = response.hits
       .filter(h => h.type === "song")
       .map(({ result }) => ({
         url: result.url,
@@ -146,7 +146,7 @@ function normalize(str: string): string {
     });
   }
 
-  return str
+  return str // eslint-disable-next-line no-control-regex
     .replace(/[\u0000-\u001F\u007F-\u009F\u200B]/g, "") // 0-width spaces & control characters
     .replace(/\u00A0/g, " "); // non-standard 1-width spaces
 }

+ 1 - 1
test/album.spec.ts

@@ -1,7 +1,7 @@
 import { baseUrl, defaultFetchOpts } from "./constants";
 import { checkAlbumProps, checkArtistProps } from "./hooks";
 
-describe(`GET /album/:id`, () => {
+describe("GET /album/:id", () => {
   //#region /album/:id
 
   it("Album details yields correct props", async () => {

+ 2 - 2
test/search.spec.ts

@@ -2,7 +2,7 @@ import { randomBytes } from "crypto";
 import { baseUrl, defaultFetchOpts } from "./constants";
 import { checkSongProps } from "./hooks";
 
-describe(`GET /search/top`, () => {
+describe("GET /search/top", () => {
   //#region /search/top
 
   it("Top search yields expected props", async () => {
@@ -32,7 +32,7 @@ describe(`GET /search/top`, () => {
 
     expect(Array.isArray(body?.all)).toBe(true);
 
-    body?.all?.forEach((hit: any) => checkSongProps(hit));
+    body?.all?.forEach((hit: unknown) => checkSongProps(hit));
 
     expect(body?.all?.length).toEqual(body?.matches ?? -1);
   });

+ 1 - 1
test/translations.spec.ts

@@ -1,7 +1,7 @@
 import { baseUrl, defaultFetchOpts } from "./constants";
 import { checkTranslationProps } from "./hooks";
 
-describe(`GET /translations/:id`, () => {
+describe("GET /translations/:id", () => {
   //#region /translations/:id
 
   it("Translation yields correct props", async () => {