Skip to content

Commit 6c56462

Browse files
committed
fix linter errors by removing csv row type checking
1 parent ec4156e commit 6c56462

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

web-app/src/app/services/feeds/utils.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,7 @@ export async function checkFeedUrlExistsInCsv(
167167
if (!response.ok) throw new Error('Failed to fetch CSV');
168168
const csvText = await response.text();
169169
const parsed = Papa.parse<FeedCsvRow>(csvText, { header: true });
170-
if (
171-
parsed.data == null ||
172-
!Array.isArray(parsed.data) ||
173-
!parsed.data.every(isFeedCsvRow)
174-
) {
175-
return null;
176-
}
170+
if (parsed.data == null || !Array.isArray(parsed.data)) return null;
177171
const rows = parsed.data;
178172
const match = rows.find((row) => row['urls.direct_download'] === feedUrl);
179173
return typeof match?.id === 'string' ? match.id : null;
@@ -189,18 +183,3 @@ interface FeedCsvRow {
189183
'urls.direct_download'?: string;
190184
id: string;
191185
}
192-
193-
/**
194-
* Type guard to check if a row from the CSV matches the FeedCsvRow interface.
195-
* @param row CSV row
196-
* @returns check if csv has valid column names
197-
*/
198-
function isFeedCsvRow(row: unknown): row is FeedCsvRow {
199-
if (typeof row !== 'object' || row === null) return false;
200-
const obj = row as Record<string, unknown>;
201-
return (
202-
typeof obj.id === 'string' &&
203-
(obj['urls.direct_download'] === undefined ||
204-
typeof obj['urls.direct_download'] === 'string')
205-
);
206-
}

0 commit comments

Comments
 (0)