Fix linter issues

This commit is contained in:
freearhey 2025-04-29 00:28:42 +03:00
parent a28122809a
commit dac7d19f40
13 changed files with 15 additions and 16 deletions

View file

@ -1,4 +1,4 @@
import { CSV, IssueLoader, CSVParser, Issue, IssueData } from '../../core'
import { CSV, IssueLoader, Issue, IssueData } from '../../core'
import { createChannelId, createFeedId } from '../../utils'
import { Channel, Feed, BlocklistRecord } from '../../models'
import { Storage, Collection, Logger } from '@freearhey/core'
@ -11,7 +11,6 @@ const dataStorage = new Storage(DATA_DIR)
const logger = new Logger({ level: -999 })
async function main() {
const parser = new CSVParser()
const issueLoader = new IssueLoader()
const dataLoader = new DataLoader({ storage: dataStorage })
@ -101,7 +100,7 @@ async function editFeeds(issues: Collection, data: DataLoaderData) {
)
if (!found) return
let channelId: string | undefined = found.channelId
const channelId: string | undefined = found.channelId
let feedId: string | undefined = found.id
if (issueData.has('feed_name')) {
const name = issueData.getString('feed_name') || found.name

View file

@ -238,7 +238,7 @@ function findDuplicatesBy(items: Collection, keys: string[]) {
const duplicates = new Collection()
const buffer = new Dictionary()
items.forEach((item, i = 0) => {
items.forEach((item: { [key: string]: string | number }) => {
const normId = keys.map(key => item[key].toString().toLowerCase()).join()
if (buffer.has(normId)) {
duplicates.add(item)

View file

@ -27,7 +27,7 @@ export class DataLoader {
async load(): Promise<DataLoaderData> {
const files = await this.storage.list('*.csv')
let data: DataLoaderData = {
const data: DataLoaderData = {
channels: new Collection(),
feeds: new Collection(),
categories: new Collection(),
@ -55,7 +55,7 @@ export class DataLoader {
const csv = await this.storage.load(file.basename())
const rows = csv.split(/\r\n/)
const headers = rows[0].split(',')
let errors = new Collection()
const errors = new Collection()
for (const [i, line] of rows.entries()) {
if (!line.trim()) continue
if (line.indexOf('\n') > -1) {

View file

@ -1,4 +1,4 @@
export type CSVParserRow = {
line: number
data: any
data: { [key: string]: string }
}

View file

@ -12,7 +12,7 @@ export class BlocklistRecordValidator extends Validator {
validate(blocklistRecord: BlocklistRecord): Collection {
const { channelsKeyById }: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = blocklistRecord
.getSchema()

View file

@ -9,7 +9,7 @@ export class CategoryValidator extends Validator {
}
validate(category: Category): Collection {
let errors = new Collection()
const errors = new Collection()
const joiResults = category.getSchema().validate(category.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -18,7 +18,7 @@ export class ChannelValidator extends Validator {
categoriesKeyById
}: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = channel.getSchema().validate(channel.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -12,7 +12,7 @@ export class CountryValidator extends Validator {
validate(country: Country): Collection {
const { languagesKeyByCode }: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = country.getSchema().validate(country.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -18,7 +18,7 @@ export class FeedValidator extends Validator {
timezonesKeyById
}: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = feed.getSchema().validate(feed.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -9,7 +9,7 @@ export class LanguageValidator extends Validator {
}
validate(language: Language): Collection {
let errors = new Collection()
const errors = new Collection()
const joiResults = language.getSchema().validate(language.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -12,7 +12,7 @@ export class RegionValidator extends Validator {
validate(region: Region): Collection {
const { countriesKeyByCode }: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = region.getSchema().validate(region.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -12,7 +12,7 @@ export class SubdivisionValidator extends Validator {
validate(subdivision: Subdivision): Collection {
const { countriesKeyByCode }: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = subdivision.getSchema().validate(subdivision.data(), { abortEarly: false })
if (joiResults.error) {

View file

@ -12,7 +12,7 @@ export class TimezoneValidator extends Validator {
validate(timezone: Timezone): Collection {
const { countriesKeyByCode }: DataLoaderData = this.data
let errors = new Collection()
const errors = new Collection()
const joiResults = timezone.getSchema().validate(timezone.data(), { abortEarly: false })
if (joiResults.error) {