Skip to content

Commit 9c53d36

Browse files
committed
fix: linter issues
1 parent 1a71078 commit 9c53d36

69 files changed

Lines changed: 1447 additions & 1108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,11 @@ export default tseslint.config(
165165
},
166166
},
167167
{
168-
files: ['**/*.{ts,tsx,mts,cts,js}'],
168+
files: ['**/*.{ts,tsx,mts,cts,js,cjs}'],
169169
ignores: ['./plugins/*/*.ts', './plugins/multisrc/*/template.ts'],
170170
rules: {
171171
'no-unused-vars': 'off',
172+
'@typescript-eslint/no-var-requires': 'off',
172173
'@typescript-eslint/no-unused-vars': 'warn',
173174
'@typescript-eslint/no-namespace': 'off',
174175
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
@@ -191,7 +192,14 @@ export default tseslint.config(
191192
globals: {
192193
...globals.serviceworker,
193194
...globals.browser,
195+
...globals.node,
194196
},
195197
},
196198
},
199+
{
200+
files: ['**/fictioneer/custom/*/*.js'],
201+
rules: {
202+
'no-undef': 'off',
203+
},
204+
},
197205
);

package-lock.json

Lines changed: 14 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/arabic/dilartube.ts

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { CheerioAPI, load as parseHTML } from 'cheerio';
1+
import { load as parseHTML } from 'cheerio';
22
import { fetchApi } from '@libs/fetch';
33
import { Plugin } from '@/types/plugin';
4-
import { Filters, FilterTypes } from '@libs/filterInputs';
4+
import { Filters } from '@libs/filterInputs';
55
import { defaultCover } from '@libs/defaultCover';
66

77
class dilartube implements Plugin.PluginBase {
88
id = 'dilartube';
99
name = 'dilar tube';
10-
version = '1.0.1';
10+
version = '1.0.2';
1111
icon = 'src/ar/dilartube/icon.png';
1212
site = 'https://golden.rest/';
1313

@@ -53,7 +53,7 @@ class dilartube implements Plugin.PluginBase {
5353

5454
async popularNovels(
5555
page: number,
56-
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
56+
{ showLatestNovels }: Plugin.PopularNovelsOptions<typeof this.filters>,
5757
): Promise<Plugin.NovelItem[]> {
5858
let link = `${this.site}api/releases?page=${page}`;
5959
if (showLatestNovels) {
@@ -82,36 +82,38 @@ class dilartube implements Plugin.PluginBase {
8282
const chapterItems: Plugin.ChapterItem[] = [];
8383
const fullUrl = this.site + 'api/' + novelUrl;
8484
const chapterUrl = this.site + 'api/' + novelUrl + '/releases';
85-
const manga = await fetchApi(fullUrl).then(r => r.json());
85+
const manga: MangaResponse = await fetchApi(fullUrl).then(r => r.json());
8686
const chapters = await fetchApi(chapterUrl).then(r => r.json());
8787
const mangaData = manga.mangaData;
8888
const chapterData = chapters.releases;
8989

9090
const novel: Plugin.SourceNovel = {
9191
path: novelUrl,
92-
name: mangaData.arabic_title || 'Untitled',
92+
name: mangaData.arabic_title ?? mangaData.title ?? 'Untitled',
9393
author:
9494
(mangaData.authors.length > 0 ? mangaData.authors[0].name : '') ||
9595
'Unknown',
9696
summary: mangaData.summary || '',
9797
cover: `${this.site}uploads/manga/cover/${mangaData.id}/${mangaData.cover}`,
9898
chapters: [],
9999
};
100-
const translationStatusId: string = mangaData.translation_status;
100+
const translationStatusId = mangaData.translation_status.toString();
101101
const translationText =
102102
{
103103
'1': 'مستمره',
104104
'0': 'منتهية',
105105
'2': 'متوقفة',
106106
'3': 'غير مترجمه',
107107
}[translationStatusId] || 'غير معروف';
108-
const statusWords = new Set(['مكتمل', 'جديد', 'مستمر']);
109-
const mainGenres = mangaData.categories
110-
.map((category: { name: any }) => category.name)
108+
// const statusWords = new Set(['مكتمل', 'جديد', 'مستمر']);
109+
const mainGenres = Array.from(
110+
new Set(mangaData.categories.map(g => g.name)),
111+
)
112+
.filter(Boolean)
111113
.join(',');
112114
novel.genres = `${translationText},${mainGenres}`;
113115

114-
const statusId: string = mangaData.story_status;
116+
const statusId = mangaData.story_status.toString();
115117
const statusText =
116118
{
117119
'2': 'Ongoing',
@@ -138,12 +140,18 @@ class dilartube implements Plugin.PluginBase {
138140
const parsedData = JSON.parse(jsonData as string);
139141

140142
const chapterText = parsedData.readerDataAction.readerData.release.content;
141-
return chapterText;
143+
// return html with p tags
144+
return chapterText
145+
.split(/\r?\n/)
146+
.map((line: string) => line.trim())
147+
.filter(Boolean)
148+
.map((line: string) => `<p>${line}</p>`)
149+
.join('');
142150
}
143151

144152
async searchNovels(
145153
searchTerm: string,
146-
page: number,
154+
// page: number,
147155
): Promise<Plugin.NovelItem[]> {
148156
const formData = new FormData();
149157
formData.append('query', searchTerm);
@@ -156,6 +164,7 @@ class dilartube implements Plugin.PluginBase {
156164
return this.parseNovels(data);
157165
}
158166

167+
filters: Filters | undefined = undefined;
159168
// filters = {
160169
// types: {
161170
// value: [],
@@ -245,8 +254,8 @@ type Manga = {
245254
publisher_name: string | null;
246255
discord_url: string | null;
247256
mobile_exclusive: boolean;
248-
authors: any[];
249-
artists: any[];
257+
// authors: any[];
258+
// artists: any[];
250259
categories: Category[];
251260
type: Type;
252261
};
@@ -327,7 +336,7 @@ type MangaData = {
327336
uniq_visitors_count: number;
328337
publisher_id: number | null;
329338
publisher_name: string | null;
330-
arabic_title: string;
339+
arabic_title: string | null;
331340
english: string;
332341
synonyms: string;
333342
japanese: string;
@@ -360,11 +369,12 @@ type MangaData = {
360369
};
361370

362371
type MangaResponse = {
363-
membersMentioning: any[];
364-
memberRates: any | null;
365-
mangaLogs: Record<string, any>;
372+
// membersMentioning: any[];
373+
// memberRates: any | null;
374+
// mangaLogs: Record<string, any>;
366375
mangaData: MangaData;
367376
};
377+
368378
type ChapterRelease = {
369379
id: number;
370380
manga_id: number;
@@ -385,7 +395,7 @@ type ChapterRelease = {
385395
has_rev_link: boolean;
386396
};
387397
type searchManga = {
388-
filter: any;
398+
// filter: any;
389399
id: number;
390400
title: string;
391401
summary: string;
@@ -417,8 +427,8 @@ type searchManga = {
417427
publisher_name: string | null;
418428
discord_url: string | null;
419429
mobile_exclusive: boolean;
420-
authors: any[];
421-
artists: any[];
430+
// authors: any[];
431+
// artists: any[];
422432
categories: Category[];
423433
type: Type;
424434
};

plugins/arabic/rewayatclub.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CheerioAPI, load as parseHTML } from 'cheerio';
1+
import { load as parseHTML } from 'cheerio';
22
import { fetchApi } from '@libs/fetch';
33
import { Plugin } from '@/types/plugin';
44
import { Filters, FilterTypes } from '@libs/filterInputs';
@@ -7,7 +7,7 @@ import { defaultCover } from '@libs/defaultCover';
77
class RewayatClub implements Plugin.PagePlugin {
88
id = 'rewayatclub';
99
name = 'Rewayat Club';
10-
version = '1.0.2';
10+
version = '1.0.3';
1111
icon = 'src/ar/rewayatclub/icon.png';
1212
site = 'https://rewayat.club/';
1313

@@ -34,7 +34,10 @@ class RewayatClub implements Plugin.PagePlugin {
3434

3535
async popularNovels(
3636
page: number,
37-
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
37+
{
38+
showLatestNovels,
39+
filters,
40+
}: Plugin.PopularNovelsOptions<typeof this.filters>,
3841
): Promise<Plugin.NovelItem[]> {
3942
let link = `https://api.rewayat.club/api/novels/`;
4043
let body: NovelData = {
@@ -253,7 +256,7 @@ type ChapterEntry = {
253256
hits: number;
254257
id: number;
255258
};
256-
read: any[];
259+
// read: any[];
257260
};
258261

259262
type ChapterData = {

plugins/arabic/sunovels.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { defaultCover } from '@libs/defaultCover';
77
class Sunovels implements Plugin.PagePlugin {
88
id = 'sunovels';
99
name = 'Sunovels';
10-
version = '1.0.0';
10+
version = '1.0.1';
1111
icon = 'src/ar/sunovels/icon.png';
1212
site = 'https://sunovels.com/';
1313

@@ -52,7 +52,7 @@ class Sunovels implements Plugin.PagePlugin {
5252

5353
async popularNovels(
5454
page: number,
55-
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions<Filters>,
55+
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>,
5656
): Promise<Plugin.NovelItem[]> {
5757
const pageCorrected = page - 1;
5858
let link = `${this.site}library?`;
@@ -137,7 +137,7 @@ class Sunovels implements Plugin.PagePlugin {
137137
name: item.chapterName,
138138
releaseTime: new Date(item.releaseTime).toISOString(),
139139
path: item.chapterUrl,
140-
chapterNumber: item.chapterNumber,
140+
chapterNumber: Number(item.chapterNumber),
141141
});
142142
});
143143
return chapter;
@@ -169,8 +169,7 @@ class Sunovels implements Plugin.PagePlugin {
169169
const dateAttr = loadedCheerio(el)
170170
.find('time.chapter-update')
171171
.attr('datetime');
172-
const date = new Date(dateAttr);
173-
const releaseTime = date.toISOString();
172+
const releaseTime = dateAttr ? new Date(dateAttr).toISOString() : '';
174173
const chapternumber = loadedCheerio(el)
175174
.find('strong.chapter-title')
176175
.text()

plugins/chinese/Quanben.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const parseUrl = (url?: string): URL | undefined => {
1717
const getStandardNovelPath = (url?: string): string | undefined => {
1818
const parsedUrl = parseUrl(url);
1919
if (!parsedUrl) return undefined;
20-
const match = parsedUrl.pathname.match(/^(\/amp)?(\/n\/[^\/]+\/)/);
20+
const match = parsedUrl.pathname.match(/^(\/amp)?(\/n\/[^/]+\/)/);
2121
return match?.[2];
2222
};
2323

@@ -47,7 +47,7 @@ class QuanbenPlugin implements Plugin.PluginBase {
4747
id = 'quanben';
4848
name = 'Quanben';
4949
site = 'https://www.quanben.io/';
50-
version = '1.0.1';
50+
version = '1.0.2';
5151
icon = 'src/cn/quanben/icon.png';
5252
defaultCover = defaultCover;
5353

@@ -180,7 +180,7 @@ class QuanbenPlugin implements Plugin.PluginBase {
180180

181181
const $ = parseHTML(await res.text());
182182
const chapters: Plugin.ChapterItem[] = [];
183-
const novelName = novelPath.match(/\/n\/([^\/]+)\//)?.[1];
183+
const novelName = novelPath.match(/\/n\/([^/]+)\//)?.[1];
184184
if (!novelName) return [];
185185

186186
$('ul.list3 li a').each((_i, el) => {
@@ -224,7 +224,7 @@ class QuanbenPlugin implements Plugin.PluginBase {
224224
// Helper function to extract and clean chapter content from HTML body
225225
private extractChapterContent(body: string): string {
226226
const $ = parseHTML(body);
227-
let $content = $('#contentbody, #content, .content').first();
227+
const $content = $('#contentbody, #content, .content').first();
228228
if (!$content.length) return 'Error: Chapter content not found.';
229229

230230
$content

0 commit comments

Comments
 (0)