From 6ed8b3c2afd21f894e1501021b4188ebf573fd07 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 3 Sep 2025 07:41:19 +0300 Subject: [PATCH] Fix linter issues --- scripts/commands/playlist/test.ts | 3 ++- scripts/core/streamTester.ts | 11 +++++++++-- scripts/models/broadcastArea.ts | 6 +++--- scripts/tables/countriesTable.ts | 10 +++++----- scripts/tables/regionsTable.ts | 4 ++-- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/scripts/commands/playlist/test.ts b/scripts/commands/playlist/test.ts index 6cbd9ebc59..ca53d56ad1 100644 --- a/scripts/commands/playlist/test.ts +++ b/scripts/commands/playlist/test.ts @@ -1,6 +1,7 @@ import { Logger, Storage, Collection } from '@freearhey/core' import { ROOT_DIR, STREAMS_DIR, DATA_DIR } from '../../constants' import { PlaylistParser, StreamTester, CliTable, DataProcessor, DataLoader } from '../../core' +import type { TestResult } from '../../core/streamTester' import { Stream } from '../../models' import { program, OptionValues } from 'commander' import { eachLimit } from 'async-es' @@ -92,7 +93,7 @@ async function runTest(stream: Stream) { const key = stream.filepath + stream.getId() + stream.url results[key] = chalk.white('LOADING...') - const result = await tester.test(stream) + const result: TestResult = await tester.test(stream) let status = '' const errorStatusCodes = ['HTTP_404_NOT_FOUND'] diff --git a/scripts/core/streamTester.ts b/scripts/core/streamTester.ts index bbe2b0638f..b6c6540617 100644 --- a/scripts/core/streamTester.ts +++ b/scripts/core/streamTester.ts @@ -6,7 +6,14 @@ import { ProxyParser } from './proxyParser.js' import { OptionValues } from 'commander' import { SocksProxyAgent } from 'socks-proxy-agent' -type StreamTesterProps = { +export type TestResult = { + status: { + ok: boolean + code: string + } +} + +export type StreamTesterProps = { options: OptionValues } @@ -37,7 +44,7 @@ export class StreamTester { this.client = axios.create(request) } - async test(stream: Stream) { + async test(stream: Stream): Promise { if (TESTING) { const results = (await import('../../tests/__data__/input/playlist_test/results.js')).default diff --git a/scripts/models/broadcastArea.ts b/scripts/models/broadcastArea.ts index bda69be252..da49fe5402 100644 --- a/scripts/models/broadcastArea.ts +++ b/scripts/models/broadcastArea.ts @@ -18,9 +18,9 @@ export class BroadcastArea { countriesKeyByCode: Dictionary, regionsKeyByCode: Dictionary ): this { - let citiesIncluded = new Collection() - let subdivisionsIncluded = new Collection() - let countriesIncluded = new Collection() + const citiesIncluded = new Collection() + const subdivisionsIncluded = new Collection() + const countriesIncluded = new Collection() let regionsIncluded = new Collection() this.codes.forEach((value: string) => { diff --git a/scripts/tables/countriesTable.ts b/scripts/tables/countriesTable.ts index 0be11c1b3d..8c9d2173a4 100644 --- a/scripts/tables/countriesTable.ts +++ b/scripts/tables/countriesTable.ts @@ -48,7 +48,7 @@ export class CountriesTable implements Table { (logItem: LogItem) => logItem.filepath === `countries/${country.code.toLowerCase()}.m3u` ) - let countryItem = { + const countryItem = { index: country.name, count: 0, link: `https://iptv-org.github.io/iptv/countries/${country.code.toLowerCase()}.m3u`, @@ -77,7 +77,7 @@ export class CountriesTable implements Table { logItem.filepath === `subdivisions/${subdivision.code.toLowerCase()}.m3u` ) - let subdivisionItem = { + const subdivisionItem = { index: subdivision.name, name: subdivision.name, count: 0, @@ -148,7 +148,7 @@ export class CountriesTable implements Table { } const undefinedLogItem = logCountries.find( - (logItem: LogItem) => logItem.filepath === `countries/undefined.m3u` + (logItem: LogItem) => logItem.filepath === 'countries/undefined.m3u' ) if (undefinedLogItem) { @@ -170,12 +170,12 @@ export class CountriesTable implements Table { item.children .orderBy(item => item.index) .forEach(item => { - row += `\r\n\ - ${item.name} ${item.link}` + row += `\r\n - ${item.name} ${item.link}` item.children .orderBy(item => item.index) .forEach(item => { - row += `\r\n\ - ${item.name} ${item.link}` + row += `\r\n - ${item.name} ${item.link}` }) }) diff --git a/scripts/tables/regionsTable.ts b/scripts/tables/regionsTable.ts index 25f2e71bcb..2bf4b74f4f 100644 --- a/scripts/tables/regionsTable.ts +++ b/scripts/tables/regionsTable.ts @@ -1,5 +1,5 @@ -import { Storage, Collection, File } from '@freearhey/core' -import { HTMLTable, LogParser, LogItem } from '../core' +import { Storage, Collection } from '@freearhey/core' +import { LogParser, LogItem } from '../core' import { LOGS_DIR, README_DIR } from '../constants' import { Region } from '../models' import { Table } from './table'