From 26ede1da6aadd741e8c2e668862629463367cf4c Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 9 Aug 2024 04:12:37 +0200 Subject: Lint JavaScript --- src/build/rss.mjs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/build/rss.mjs') diff --git a/src/build/rss.mjs b/src/build/rss.mjs index 6394af5..73b7803 100644 --- a/src/build/rss.mjs +++ b/src/build/rss.mjs @@ -1,14 +1,14 @@ -import RSS from 'rss'; -import i18n from './i18n.mjs'; +import RSS from "rss"; +import i18n from "./i18n.mjs"; const getRSS = (articles, baseUrl, lang) => { - console.log(i18n[lang]['rss']['title']); + console.log(i18n[lang]["rss"]["title"]); const rssFeed = new RSS({ - title: i18n[lang]['rss']['title'], - description: i18n[lang]['rss']['description'], + title: i18n[lang]["rss"]["title"], + description: i18n[lang]["rss"]["description"], // eslint-disable-next-line camelcase custom_namespaces: { - 'visible_description': i18n[lang]['rss']['description'] + visible_description: i18n[lang]["rss"]["description"], }, site_url: "https://ache.one", feed_url: `${baseUrl}rss.xml`, @@ -19,31 +19,34 @@ const getRSS = (articles, baseUrl, lang) => { image_url: `${baseUrl}ache.svg`, language: lang, pubDate: Date(), - ttl: '1440', + ttl: "1440", }); for (const article of articles.slice(0, 10)) { - let image_url = (article.imageUrl[0] != '/') ? `/${article.imageUrl}` : article.imageUrl; + let image_url = + article.imageUrl[0] != "/" ? `/${article.imageUrl}` : article.imageUrl; rssFeed.item({ title: article.title, - description: '
' + article.content + '
', + description: "
" + article.content + "
", // eslint-disable-next-line camelcase image_url, url: `${baseUrl}articles/${article.name}`, guid: article.domTitle, - author: 'ache', + author: "ache", date: article.metaData.pubDateISO, categories: article.metaData.tags, // eslint-disable-next-line camelcase - custom_elements: [ - {logo: image_url}, - {intro: article.introDesc}, - ], + custom_elements: [{ logo: image_url }, { intro: article.introDesc }], }); } - return rssFeed.xml({indent: false}).replace(/<\?xml version="1.0" encoding="UTF-8"\?>/g, ''); + return rssFeed + .xml({ indent: false }) + .replace( + /<\?xml version="1.0" encoding="UTF-8"\?>/g, + '', + ); }; export default getRSS; -- cgit v1.2.3-70-g09d2