Skip to content

Commit 67f5e96

Browse files
committed
Refactor RSS component methods to disable TypeScript explicit any warnings
- Added eslint-disable comments for explicit any type in itemTs, itemKey, fetchFeed, isJSONFeed, and sortItems methods in rss.app.ts. - Updated new-item-from-multiple-feeds source to disable explicit any warning in forEach method.
1 parent a7b3339 commit 67f5e96

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/rss/app/rss.app.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default defineApp({
3030
},
3131
methods: {
3232
// in theory if alternate setting title and description or aren't unique this won't work
33-
itemTs(item = {} as (Item | any)): number {
33+
itemTs(item = {} as (Item | any)): number { // eslint-disable-line @typescript-eslint/no-explicit-any
3434
const {
3535
pubdate, pubDate, date_published,
3636
} = item;
@@ -40,7 +40,7 @@ export default defineApp({
4040
}
4141
return +new Date();
4242
},
43-
itemKey(item = {} as (Item | any)): string {
43+
itemKey(item = {} as (Item | any)): string { // eslint-disable-line @typescript-eslint/no-explicit-any
4444
const {
4545
id, guid, link, title,
4646
} = item;
@@ -53,7 +53,7 @@ export default defineApp({
5353
}
5454
return hash(item);
5555
},
56-
async fetchFeed(url: string): Promise<any> {
56+
async fetchFeed(url: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
5757
const res = await axios(this, {
5858
url,
5959
method: "GET",
@@ -87,7 +87,7 @@ export default defineApp({
8787
feedparser.on("error", reject);
8888
feedparser.on("end", resolve);
8989
feedparser.on("readable", function (this: FeedParser) {
90-
let item: any = this.read();
90+
let item: any = this.read(); // eslint-disable-line @typescript-eslint/no-explicit-any
9191

9292
while (item) {
9393
/*
@@ -120,7 +120,7 @@ export default defineApp({
120120
});
121121
return items;
122122
},
123-
isJSONFeed(response: any): boolean {
123+
isJSONFeed(response: any): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
124124
const acceptedJsonFeedMimes = [
125125
"application/feed+json",
126126
"application/json",
@@ -157,7 +157,7 @@ export default defineApp({
157157
return url;
158158
},
159159
sortItems(items) {
160-
return items.sort((itemA: any, itemB: any) => {
160+
return items.sort((itemA: any, itemB: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
161161
if (this.itemTs(itemA) > this.itemTs(itemB)) {
162162
return 1;
163163
}

components/rss/sources/new-item-from-multiple-feeds/new-item-from-multiple-feeds.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default defineSource({
4343
console.log(`Retrieved items from ${url}`);
4444
items.push(...feedItems);
4545
}
46-
this.rss.sortItems(items).forEach((item: any) => {
46+
this.rss.sortItems(items).forEach((item: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
4747
const meta = this.generateMeta(item);
4848
this.$emit(item, meta);
4949
});

0 commit comments

Comments
 (0)