From 01bb18b774137e3739baa0df4ef696cb36fa1470 Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Sun, 28 Aug 2022 14:27:47 +0300 Subject: [PATCH] format --- .prettierrc.json | 2 +- package.json | 2 +- src/components/ArticleItem/ArticleItem.tsx | 10 ++++++++-- src/components/ArticlePost/ArticlePost.astro | 8 ++++++-- src/components/ArticlesList/ArticlesList.tsx | 5 ++++- src/components/BaseHead.astro | 16 ++++++++++++++-- src/components/ContactForm/ContactForm.astro | 9 ++++++++- src/components/Header/Header.astro | 5 ++++- src/i18n/en/ui.ts | 3 ++- src/i18n/ru/ui.ts | 3 ++- src/layouts/default.astro | 6 +++++- src/pages/[...slug].astro | 4 +++- src/templates/Articles.astro | 7 ++++++- src/types/main.d.ts | 5 ++++- src/utils/string.ts | 4 +++- 15 files changed, 71 insertions(+), 18 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index e7407ec..f3d832f 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,5 @@ { - "printWidth": 150, + "printWidth": 120, "semi": true, "singleQuote": false, "tabWidth": 2, diff --git a/package.json b/package.json index 4767fe8..1f6ee7a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "start": "astro dev", "build": "astro build", "preview": "astro preview --host", - "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,mdx}\"", + "format": "prettier --write ./src/\"**/*.{js,jsx,ts,tsx,json,md,mdx,astro}\"", "lint": "eslint '**/*.{js,mjs,ts,tsx}'" }, "devDependencies": { diff --git a/src/components/ArticleItem/ArticleItem.tsx b/src/components/ArticleItem/ArticleItem.tsx index 4ba2e3c..0c0e074 100644 --- a/src/components/ArticleItem/ArticleItem.tsx +++ b/src/components/ArticleItem/ArticleItem.tsx @@ -14,13 +14,19 @@ export const ArticleItem: Component = (props) => { const hrefLangPrefix = props.data.lang && props.data.lang !== DEFAULT_LANGUAGE ? "/en" : ""; return ( diff --git a/src/components/ArticlePost/ArticlePost.astro b/src/components/ArticlePost/ArticlePost.astro index 223098b..c67e59b 100644 --- a/src/components/ArticlePost/ArticlePost.astro +++ b/src/components/ArticlePost/ArticlePost.astro @@ -21,7 +21,9 @@ const { title, coverImage, tags, author, published_at } = data; { tags.map((tag) => (
  • - +
  • )) } @@ -31,7 +33,9 @@ const { title, coverImage, tags, author, published_at } = data;

    {title}

    - +
    { diff --git a/src/components/ArticlesList/ArticlesList.tsx b/src/components/ArticlesList/ArticlesList.tsx index b059d0c..9b7356c 100644 --- a/src/components/ArticlesList/ArticlesList.tsx +++ b/src/components/ArticlesList/ArticlesList.tsx @@ -84,7 +84,10 @@ const ArticlesList: Component = (props) => { return (

    {year}

    - } /> + } + />
    ); }} diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index ae4de95..5db2629 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -30,8 +30,20 @@ const { title = SITE_METADATA.title, description, canonicalUrl } = Astro.props a - - + + diff --git a/src/components/ContactForm/ContactForm.astro b/src/components/ContactForm/ContactForm.astro index c28cd56..44165e0 100644 --- a/src/components/ContactForm/ContactForm.astro +++ b/src/components/ContactForm/ContactForm.astro @@ -19,7 +19,14 @@ const t = useTranslation(Astro); - + diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro index 63536d1..86938d0 100644 --- a/src/components/Header/Header.astro +++ b/src/components/Header/Header.astro @@ -24,7 +24,10 @@ const { pathname } = Astro.url; { nav.map((link) => (
  • - +
  • diff --git a/src/i18n/en/ui.ts b/src/i18n/en/ui.ts index 28b5028..a140144 100644 --- a/src/i18n/en/ui.ts +++ b/src/i18n/en/ui.ts @@ -13,7 +13,8 @@ export default { "pageTitle.projects": "Projects", "pageTitle.contacts": "Contacts", /* Page descriptions */ - "pageDescription.articles": "Technical articles, tutorials and various reference materials related to IT topics can be found here.", + "pageDescription.articles": + "Technical articles, tutorials and various reference materials related to IT topics can be found here.", "pageDescription.projects": "A few of my main projects that have been developed and published in open access.", "pageDescription.contacts": "Use the feedback form or write to me on social networks.", /* Navigation */ diff --git a/src/i18n/ru/ui.ts b/src/i18n/ru/ui.ts index e71f55e..f7ad02c 100644 --- a/src/i18n/ru/ui.ts +++ b/src/i18n/ru/ui.ts @@ -13,7 +13,8 @@ export default { "pageTitle.projects": "Проекты", "pageTitle.contacts": "Контакты", /* Page descriptions */ - "pageDescription.articles": "Технические статьи, туториалы и различные справочные материалы которые связаны с IT тематикой находятся здесь.", + "pageDescription.articles": + "Технические статьи, туториалы и различные справочные материалы которые связаны с IT тематикой находятся здесь.", "pageDescription.projects": "Несколько моих основных проектов которые были разработаны и выложены в открытый доступ.", "pageDescription.contacts": "Воспользуйтесь формой обратной связи или напишите мне в социальные сети.", /* Navigation */ diff --git a/src/layouts/default.astro b/src/layouts/default.astro index 93f0ce9..e32b72a 100644 --- a/src/layouts/default.astro +++ b/src/layouts/default.astro @@ -16,7 +16,11 @@ const { title, description, lang = "ru", noIndex = false, canonicalUrl } = Astro --- - + {noIndex && } diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index 723a907..8e0a3ca 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -49,7 +49,9 @@ const { pathname } = Astro.url; {alternateLangs .filter((lang) => lang !== siteLang) .map((lang) => ( - {languages[lang]} + + {languages[lang]} + )) .reduce((prev, curr) => [prev, ", ", curr])} diff --git a/src/templates/Articles.astro b/src/templates/Articles.astro index e53d204..0778c86 100644 --- a/src/templates/Articles.astro +++ b/src/templates/Articles.astro @@ -15,7 +15,12 @@ const articles = transformArticles(data); const canonicalUrl = new URL(Astro.url.pathname, Astro.site); --- - +
    (type: K, listener: (this: Window, ev: CustomEventMap[K]) => void): void; + addEventListener( + type: K, + listener: (this: Window, ev: CustomEventMap[K]) => void + ): void; } interface CustomEventMap { diff --git a/src/utils/string.ts b/src/utils/string.ts index 085aa38..026d02a 100644 --- a/src/utils/string.ts +++ b/src/utils/string.ts @@ -7,5 +7,7 @@ export function isEmail(email: string): boolean { } export function isURL(url: string): boolean { - return new RegExp(/(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\\/~+#-]*[\w@?^=%&\\/~+#-])/).test(url); + return new RegExp(/(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\\/~+#-]*[\w@?^=%&\\/~+#-])/).test( + url + ); }