From 4aa2802efc7fa4105bf3b50df319c298ef136e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ry=C5=82ko?= Date: Sun, 21 Apr 2024 16:54:09 +0200 Subject: [PATCH] Update .prettierrc and .editorconfig --- .editorconfig | 17 ++++++++++++ .prettierrc | 11 +++++++- gatsby-config.ts | 7 ++--- gatsby-node.ts | 27 +++++-------------- gatsby-ssr.tsx | 4 +-- src/components/seo.tsx | 3 +-- src/constants/site-metadata.ts | 3 +-- src/pages/404.tsx | 5 +--- src/pages/index.tsx | 30 ++++----------------- src/pages/metadata.tsx | 8 ++---- src/pages/resume.tsx | 16 ++++++++++++ src/templates/blog-post.tsx | 48 ++++++---------------------------- 12 files changed, 71 insertions(+), 108 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..44100bd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[{*.ts, *.tsx}] +quote_type = single +max_line_length = 120 + +[{*.mdx, *.md, *.json}] +max_line_length = off +trim_trailing_whitespace = false diff --git a/.prettierrc b/.prettierrc index 0c06006..5218eea 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,14 @@ { "arrowParens": "avoid", "semi": true, - "singleQuote": true + "singleQuote": true, + "tabWidth": 2, + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "options": { + "printWidth": 120 + } + } + ] } diff --git a/gatsby-config.ts b/gatsby-config.ts index 870b77c..d7202f1 100644 --- a/gatsby-config.ts +++ b/gatsby-config.ts @@ -123,13 +123,10 @@ const config: GatsbyConfig = { `, serialize: ({ query: { site, posts } }: any) => posts.nodes - .sort( - (a: any, b: any) => Date.parse(b.date) - Date.parse(a.date), - ) + .sort((a: any, b: any) => Date.parse(b.date) - Date.parse(a.date)) .map((node: any) => { const url = `${site.siteMetadata.siteUrl}${node.fields.slug}`; - const description = - node.frontmatter.description || node.excerpt; + const description = node.frontmatter.description || node.excerpt; const content = `

${description}

Keep reading.


`; return { title: node.frontmatter.title, diff --git a/gatsby-node.ts b/gatsby-node.ts index 4fccac0..440c184 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -5,11 +5,7 @@ import { createFilePath } from 'gatsby-source-filesystem'; const blogPost = path.resolve(`./src/templates/blog-post.tsx`); -export const createPages: GatsbyNode['createPages'] = async ({ - graphql, - actions, - reporter, -}: any) => { +export const createPages: GatsbyNode['createPages'] = async ({ graphql, actions, reporter }: any) => { const { createPage } = actions; const result = await graphql(` query AllMdx { @@ -28,10 +24,7 @@ export const createPages: GatsbyNode['createPages'] = async ({ `); if (result.errors) { - reporter.panicOnBuild( - `There was an error loading your blog posts`, - result.errors, - ); + reporter.panicOnBuild(`There was an error loading your blog posts`, result.errors); return; } @@ -40,8 +33,7 @@ export const createPages: GatsbyNode['createPages'] = async ({ if (posts.length > 0) { posts.forEach((post, index) => { const previousPostId = index === 0 ? null : posts[index - 1].id; - const nextPostId = - index === posts.length - 1 ? null : posts[index + 1].id; + const nextPostId = index === posts.length - 1 ? null : posts[index + 1].id; createPage({ path: post.fields.slug, @@ -56,11 +48,7 @@ export const createPages: GatsbyNode['createPages'] = async ({ } }; -export const onCreateNode: GatsbyNode['onCreateNode'] = ({ - node, - actions, - getNode, -}) => { +export const onCreateNode: GatsbyNode['onCreateNode'] = ({ node, actions, getNode }) => { if (node.internal.type !== `Mdx`) { return; } @@ -78,9 +66,8 @@ export const onCreateNode: GatsbyNode['onCreateNode'] = ({ // https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/ // https://www.gatsbyjs.com/docs/how-to/local-development/graphql-typegen/ -export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] = - ({ actions }) => { - actions.createTypes(`#graphql +export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] = ({ actions }) => { + actions.createTypes(`#graphql type Site { siteMetadata: SiteMetadata! } @@ -89,4 +76,4 @@ export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] title: String! } `); - }; +}; diff --git a/gatsby-ssr.tsx b/gatsby-ssr.tsx index 19da81d..31f70ee 100644 --- a/gatsby-ssr.tsx +++ b/gatsby-ssr.tsx @@ -1,8 +1,6 @@ import type { GatsbySSR } from 'gatsby'; import { SITE_METADATA } from './src/constants/site-metadata'; -export const onRenderBody: GatsbySSR['onRenderBody'] = ({ - setHtmlAttributes, -}) => { +export const onRenderBody: GatsbySSR['onRenderBody'] = ({ setHtmlAttributes }) => { setHtmlAttributes({ lang: SITE_METADATA.lang }); }; diff --git a/src/components/seo.tsx b/src/components/seo.tsx index 5cddb03..914eaa9 100644 --- a/src/components/seo.tsx +++ b/src/components/seo.tsx @@ -13,8 +13,7 @@ const Seo: React.FC = ({ title, description, noIndex, children }) => { const metaDescription = description || siteDescription; const metaTitle = [title, siteTitle].filter(Boolean).join(' | '); - const twitterHandle = - siteSocial.find(({ name }) => name === 'twitter')?.url ?? ''; + const twitterHandle = siteSocial.find(({ name }) => name === 'twitter')?.url ?? ''; return ( <> diff --git a/src/constants/site-metadata.ts b/src/constants/site-metadata.ts index 6fd755a..961e561 100644 --- a/src/constants/site-metadata.ts +++ b/src/constants/site-metadata.ts @@ -2,8 +2,7 @@ export const SITE_METADATA = { lang: 'pl', url: 'https://dawidrylko.com/', title: 'Dawid Ryłko', - description: - 'Dawid Ryłko. Moja osobista strona internetowa i blog. 68 97 119 105 100 32 82 121 108 107 111', + description: 'Dawid Ryłko. Moja osobista strona internetowa i blog. 68 97 119 105 100 32 82 121 108 107 111', author: { name: 'Dawid Ryłko', }, diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 0b73cc9..b41987b 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -27,10 +27,7 @@ const NotFoundPage: React.FC = ({ location }) => { }; export const Head: HeadFC = () => ( - + ); export default NotFoundPage; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 29a4dd0..3b4cfe5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -51,18 +51,11 @@ const BlogIndex: React.FC> = ({ data, location }) => { {posts.map(post => { const title = post.frontmatter.title || post.fields.slug; const description = post.frontmatter.description || post.excerpt; - const img = getImage( - post.frontmatter.featuredImg?.childImageSharp?.gatsbyImageData || - null, - ); + const img = getImage(post.frontmatter.featuredImg?.childImageSharp?.gatsbyImageData || null); return (
  • -
    +

    @@ -70,18 +63,11 @@ const BlogIndex: React.FC> = ({ data, location }) => {

    -
    - {img && ( - - )} + {img && }

    pagePaths.map((path, index) => [(index + 1).toString(), path]); const createBlogPostsArray = ({ blogPosts: { postPaths } }: DataType) => - postPaths - .map(({ fields: { slug } }) => slug) - .map((path, index) => [(index + 1).toString(), path]); + postPaths.map(({ fields: { slug } }) => slug).map((path, index) => [(index + 1).toString(), path]); const title = 'Metadata 🤖'; @@ -77,9 +75,7 @@ export const query = graphql` } buildTime(formatString: "YYYY-MM-DD HH:mm:ss") } - nonBlogPages: allSitePage( - filter: { component: { regex: "/^(?!.*templates/blog-post).*$/" } } - ) { + nonBlogPages: allSitePage(filter: { component: { regex: "/^(?!.*templates/blog-post).*$/" } }) { pageCount: totalCount pagePaths: distinct(field: { path: SELECT }) } diff --git a/src/pages/resume.tsx b/src/pages/resume.tsx index b566f5f..a5c7236 100644 --- a/src/pages/resume.tsx +++ b/src/pages/resume.tsx @@ -6,6 +6,7 @@ import Layout from '../components/layout'; import ReturnLink from '../components/return-link'; import Seo from '../components/seo'; import Table from '../components/table'; +import Bio from '../components/bio'; const experience = [ ['Silesian Solutions', 'Founder', 'Oct 2015 - Present'], @@ -23,11 +24,26 @@ const ResumePage: React.FC = ({ location }) => { return (

    {title}

    + +

    Summary

    +

    + Hello, I'm Dawid Ryłko, a seasoned developer with a wealth of experience spanning several years. My professional + journey has been fueled by a passion for optimization and a knack for unconventional solutions. Beyond coding, I + am an avid enthusiast of movies and games. +

    +

    + In the dynamic realm of technology, I am unwaveringly dedicated to self-improvement and staying abreast of the + latest innovations. My commitment to excellence is the cornerstone of my approach to software development. +

    Experience

    Education


    + + Download Full Résumé + +
    ); diff --git a/src/templates/blog-post.tsx b/src/templates/blog-post.tsx index ce5bb06..44b17f9 100644 --- a/src/templates/blog-post.tsx +++ b/src/templates/blog-post.tsx @@ -31,53 +31,30 @@ type Data = { next: PostNode; }; -const BlogPostTemplate: React.FC> = ({ - data, - location, - children, -}) => { +const BlogPostTemplate: React.FC> = ({ data, location, children }) => { const { siteTitle, siteAuthor } = useSiteMetadata(); const { previous, next, mdx: post } = data; - const img = getImage( - post.frontmatter.featuredImg?.childImageSharp?.gatsbyImageData || null, - ); + const img = getImage(post.frontmatter.featuredImg?.childImageSharp?.gatsbyImageData || null); return ( -
    +

    {post.frontmatter.title}

    -
    - {img && ( - - )} + {img && }
    {children}

    @@ -115,22 +92,13 @@ const BlogPostTemplate: React.FC> = ({ }; export const Head = function ({ data: { mdx: post } }: any) { - return ( - - ); + return ; }; export default BlogPostTemplate; export const blogPageQuery = graphql` - query BlogPostBySlug( - $id: String! - $previousPostId: String - $nextPostId: String - ) { + query BlogPostBySlug($id: String!, $previousPostId: String, $nextPostId: String) { mdx(id: { eq: $id }) { id frontmatter {