From f8ae66e200df46e5badbcc71df5453a5440a4edc Mon Sep 17 00:00:00 2001 From: Ayane Satomi Date: Mon, 4 May 2020 18:44:28 +0800 Subject: [PATCH] Lint Signed-off-by: Ayane Satomi --- lib/index.ts | 44 +++++++++++++++++++------------------- lib/response.ts | 56 ++++++++++++++++++++++++------------------------- lib/sites.ts | 18 ++++++++-------- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index fc53a2df..5d65da99 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -6,32 +6,12 @@ import { createReadStream } from "fs"; import { Readable } from "stream"; import { SagiriClientError, SagiriServerError } from "./errors"; -import { generateMask, resolveResult } from "./util"; import { Response, Result } from "./response"; import sites from "./sites"; +import { generateMask, resolveResult } from "./util"; const log = debug("sagiri"); -export interface Options { - results?: number; - mask?: number[]; - excludeMask?: number[]; - // getRatings?: boolean; - testMode?: boolean; - db?: number; -} - -export interface SagiriResult { - url: string; - site: string; - index: number; - similarity: number; - thumbnail: string; - authorName: string; - authorUrl: string; - raw: Result; -} - type File = string | Buffer | Readable; /** @@ -151,5 +131,25 @@ const sagiri = (token: string, defaultOptions: Options = { results: 5 }) => { }; }; -export default sagiri; module.exports = sagiri; +export interface Options { + results?: number; + mask?: number[]; + excludeMask?: number[]; + // getRatings?: boolean; + testMode?: boolean; + db?: number; +} + +export interface SagiriResult { + url: string; + site: string; + index: number; + similarity: number; + thumbnail: string; + authorName: string; + authorUrl: string; + raw: Result; +} + +export default sagiri; diff --git a/lib/response.ts b/lib/response.ts index 67fced35..22c78393 100644 --- a/lib/response.ts +++ b/lib/response.ts @@ -1,26 +1,3 @@ -export interface Response { - header: Header; - results: Result[]; -} - -export interface Header { - account_type: string; - index: { [id: string]: HeaderIndex | undefined }; // do i wanna generic this to be id value? - long_limit: string; - long_remaining: number; - message?: string; - minimum_similarity: number; - query_image: string; - query_image_display: string; - results_requested: number; - results_returned: number; - search_depth: string; - short_limit: number; - short_remaining: number; - status: number; - user_id: string; -} - interface HeaderIndex { id: number; parent_id: number; @@ -28,11 +5,6 @@ interface HeaderIndex { status: number; } -export interface Result { - data: ResultData; - header: ResultHeader; -} - interface ResultData { ext_urls: string[]; title: string; @@ -106,3 +78,31 @@ export type Indices = | "34" | "35" | "36"; + +export interface Response { + header: Header; + results: Result[]; +} + +export interface Header { + account_type: string; + index: { [id: string]: HeaderIndex | undefined }; // do i wanna generic this to be id value? + long_limit: string; + long_remaining: number; + message?: string; + minimum_similarity: number; + query_image: string; + query_image_display: string; + results_requested: number; + results_returned: number; + search_depth: string; + short_limit: number; + short_remaining: number; + status: number; + user_id: string; +} + +export interface Result { + data: ResultData; + header: ResultHeader; +} diff --git a/lib/sites.ts b/lib/sites.ts index 1de5454d..338e561f 100644 --- a/lib/sites.ts +++ b/lib/sites.ts @@ -1,15 +1,6 @@ /* eslint-disable @typescript-eslint/camelcase */ import { Result } from "./response"; -export interface SiteData { - name: string; - index: number; - urlMatcher: RegExp; - backupUrl(result: Result): string; - // getRating(body: string): boolean; we remove this? - // isNSFW: boolean -} - // #region Site data objects const DoujinMangaLexicon: SiteData = { name: "The Doujinshi & Manga Lexicon", @@ -252,4 +243,13 @@ const sites: { [key: string]: SiteData | undefined } = { "36": MangaUpdates, }; +export interface SiteData { + name: string; + index: number; + urlMatcher: RegExp; + backupUrl(result: Result): string; + // getRating(body: string): boolean; we remove this? + // isNSFW: boolean +} + export default sites;