From 730174f34c0742f2a150bc4b047cbe3b5496924c Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 29 Jan 2023 03:58:06 +0000 Subject: [PATCH] add prettier-plugin-sort-imports --- .prettierrc | 13 +- package-lock.json | 225 ++++++++++++++++++++++ package.json | 1 + src/components/404/index.tsx | 2 +- src/components/Availability/index.tsx | 6 +- src/components/Footer/index.tsx | 6 +- src/components/Header/index.test.tsx | 2 +- src/components/Header/index.tsx | 6 +- src/components/Icon/index.test.tsx | 1 - src/components/Icon/index.tsx | 38 ++-- src/components/Location/index.tsx | 8 +- src/components/LogoUnit/index.tsx | 4 +- src/components/Meta/index.test.tsx | 2 +- src/components/Networks/NetworkLink.tsx | 4 +- src/components/Networks/index.tsx | 4 +- src/components/Project/index.tsx | 8 +- src/components/ProjectImage/index.tsx | 6 +- src/components/ProjectNav/Project.tsx | 4 +- src/components/ProjectNav/index.tsx | 4 +- src/components/ProjectPreview/index.tsx | 4 +- src/components/Projects/index.tsx | 2 +- src/components/Repository/index.test.tsx | 2 +- src/components/ThemeSwitch/Item.tsx | 4 +- src/components/ThemeSwitch/index.test.tsx | 2 +- src/components/ThemeSwitch/index.tsx | 8 +- src/components/Vcard/_utils.test.ts | 2 +- src/components/Vcard/index.test.tsx | 2 +- src/layouts/Site/index.test.tsx | 2 +- src/layouts/Site/index.tsx | 14 +- src/lib/content.ts | 2 +- src/lib/github.ts | 6 +- src/lib/markdown.ts | 2 +- src/pages/[slug].tsx | 12 +- src/pages/_app.tsx | 4 +- src/pages/_document.tsx | 2 +- src/pages/index.tsx | 10 +- 36 files changed, 330 insertions(+), 94 deletions(-) diff --git a/.prettierrc b/.prettierrc index 338a8b9..77d8d10 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,5 +2,16 @@ "semi": false, "singleQuote": true, "trailingComma": "none", - "tabWidth": 2 + "tabWidth": 2, + "importOrder": [ + "^(react/(.*)$)|^(react$)", + "^(next/(.*)$)|^(next$)", + "", + "^[./]" + ], + "importOrderSeparation": false, + "importOrderSortSpecifiers": true, + "importOrderBuiltinModulesToTop": true, + "importOrderMergeDuplicateImports": true, + "importOrderCombineTypeAndValueImports": true } diff --git a/package-lock.json b/package-lock.json index c238a21..9876551 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "@svgr/webpack": "^6.5.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", + "@trivago/prettier-plugin-sort-imports": "^4.0.0", "@types/jest": "^29.2.6", "@types/js-yaml": "^4.0.5", "@types/sharp": "^0.31.1", @@ -3822,6 +3823,124 @@ "node": ">= 10" } }, + "node_modules/@trivago/prettier-plugin-sort-imports": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-4.0.0.tgz", + "integrity": "sha512-Tyuk5ZY4a0e2MNFLdluQO9F6d1awFQYXVVujEPFfvKPPXz8DADNHzz73NMhwCSXGSuGGZcA/rKOyZBrxVNMxaA==", + "dev": true, + "dependencies": { + "@babel/core": "7.17.8", + "@babel/generator": "7.17.7", + "@babel/parser": "7.18.9", + "@babel/traverse": "7.17.3", + "@babel/types": "7.17.0", + "javascript-natural-sort": "0.7.1", + "lodash": "4.17.21" + }, + "peerDependencies": { + "@vue/compiler-sfc": "3.x", + "prettier": "2.x" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/core": { + "version": "7.17.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.8.tgz", + "integrity": "sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.7", + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.8", + "@babel/parser": "^7.17.8", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.17.3", + "@babel/types": "^7.17.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/generator": { + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz", + "integrity": "sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.17.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/parser": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.9.tgz", + "integrity": "sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/traverse": { + "version": "7.17.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.3.tgz", + "integrity": "sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.17.3", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.17.3", + "@babel/types": "^7.17.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/@babel/types": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", + "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -4245,6 +4364,81 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@vue/compiler-core": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", + "integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "source-map": "^0.6.1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz", + "integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==", + "dev": true, + "peer": true, + "dependencies": { + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz", + "integrity": "sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/compiler-dom": "3.2.45", + "@vue/compiler-ssr": "3.2.45", + "@vue/reactivity-transform": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7", + "postcss": "^8.1.10", + "source-map": "^0.6.1" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz", + "integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==", + "dev": true, + "peer": true, + "dependencies": { + "@vue/compiler-dom": "3.2.45", + "@vue/shared": "3.2.45" + } + }, + "node_modules/@vue/reactivity-transform": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz", + "integrity": "sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.45", + "@vue/shared": "3.2.45", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7" + } + }, + "node_modules/@vue/shared": { + "version": "3.2.45", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.45.tgz", + "integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==", + "dev": true, + "peer": true + }, "node_modules/@yaireo/relative-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@yaireo/relative-time/-/relative-time-1.0.2.tgz", @@ -6474,6 +6668,13 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "peer": true + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -7888,6 +8089,12 @@ "node": ">=8" } }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true + }, "node_modules/jest": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/jest/-/jest-29.3.1.tgz", @@ -9386,6 +9593,16 @@ "lz-string": "bin/bin.js" } }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "peer": true, + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -12191,6 +12408,14 @@ "source-map": "^0.6.0" } }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", + "dev": true, + "peer": true + }, "node_modules/space-separated-tokens": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.1.tgz", diff --git a/package.json b/package.json index f980470..c8cf2d2 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@svgr/webpack": "^6.5.1", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", + "@trivago/prettier-plugin-sort-imports": "^4.0.0", "@types/jest": "^29.2.6", "@types/js-yaml": "^4.0.5", "@types/sharp": "^0.31.1", diff --git a/src/components/404/index.tsx b/src/components/404/index.tsx index 26f0b8d..6b1fffb 100644 --- a/src/components/404/index.tsx +++ b/src/components/404/index.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, MouseEvent } from 'react' +import { MouseEvent, useEffect, useState } from 'react' import Link from 'next/link' import Button from '../Button' import styles from './index.module.css' diff --git a/src/components/Availability/index.tsx b/src/components/Availability/index.tsx index e840d75..36a6554 100644 --- a/src/components/Availability/index.tsx +++ b/src/components/Availability/index.tsx @@ -1,7 +1,7 @@ -import { useReducedMotion, LazyMotion, domAnimation, m } from 'framer-motion' -import { moveInBottom, getAnimationProps } from '../Transitions' -import styles from './index.module.css' +import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' import meta from '../../../_content/meta.json' +import { getAnimationProps, moveInBottom } from '../Transitions' +import styles from './index.module.css' export default function Availability() { const shouldReduceMotion = useReducedMotion() diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 7fa22b4..2b13261 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -1,9 +1,9 @@ -import LogoUnit from '../LogoUnit' -import Networks from '../Networks' -import styles from './index.module.css' import meta from '../../../_content/meta.json' import resume from '../../../_content/resume.json' +import LogoUnit from '../LogoUnit' +import Networks from '../Networks' import Vcard from '../Vcard' +import styles from './index.module.css' export default function Footer() { const year = new Date().getFullYear() diff --git a/src/components/Header/index.test.tsx b/src/components/Header/index.test.tsx index fb3ee90..b498982 100644 --- a/src/components/Header/index.test.tsx +++ b/src/components/Header/index.test.tsx @@ -1,4 +1,4 @@ -import { render, screen, act } from '@testing-library/react' +import { act, render, screen } from '@testing-library/react' import Header from '.' describe('Header', () => { diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 9901a2f..97a9bf9 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -1,9 +1,9 @@ -import Networks from '../Networks' +import { Suspense } from 'react' +import dynamic from 'next/dynamic' import Availability from '../Availability' import LogoUnit from '../LogoUnit' +import Networks from '../Networks' import styles from './index.module.css' -import dynamic from 'next/dynamic' -import { Suspense } from 'react' const DynamicLocation = dynamic(() => import('../Location'), { suspense: true diff --git a/src/components/Icon/index.test.tsx b/src/components/Icon/index.test.tsx index bd6a790..c6dbccd 100644 --- a/src/components/Icon/index.test.tsx +++ b/src/components/Icon/index.test.tsx @@ -1,5 +1,4 @@ import { render } from '@testing-library/react' - import Icon from '.' describe('Icon', () => { diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx index 352bc7c..cc32677 100644 --- a/src/components/Icon/index.tsx +++ b/src/components/Icon/index.tsx @@ -2,28 +2,28 @@ // import * as Feather from 'react-feather' import { ArrowDownCircle, - Edit, - GitHub, - Twitter, - Rss, - Sun, - Moon, - Compass, - FileText, - Key, - Image, - Mail, - MapPin, - Globe, - Briefcase, Award, BookOpen, - Star, - Info, - Dribbble, - ChevronDown, + Briefcase, Check, - Monitor + ChevronDown, + Compass, + Dribbble, + Edit, + FileText, + GitHub, + Globe, + Image, + Info, + Key, + Mail, + MapPin, + Monitor, + Moon, + Rss, + Star, + Sun, + Twitter } from 'react-feather' import Mastodon from '../../images/mastodon.svg' import styles from './index.module.css' diff --git a/src/components/Location/index.tsx b/src/components/Location/index.tsx index cf1252c..a55be32 100644 --- a/src/components/Location/index.tsx +++ b/src/components/Location/index.tsx @@ -1,9 +1,9 @@ -import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' -import { getAnimationProps, moveInTop } from '../Transitions' -import styles from './index.module.css' -import { useLocation } from '../../hooks/useLocation' import RelativeTime from '@yaireo/relative-time' +import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' +import { useLocation } from '../../hooks/useLocation' +import { getAnimationProps, moveInTop } from '../Transitions' import { Flag } from './Flag' +import styles from './index.module.css' export default function Location() { const { now, next } = useLocation() diff --git a/src/components/LogoUnit/index.tsx b/src/components/LogoUnit/index.tsx index 5424420..dc10591 100644 --- a/src/components/LogoUnit/index.tsx +++ b/src/components/LogoUnit/index.tsx @@ -1,8 +1,8 @@ import Link from 'next/link' +import { useRouter } from 'next/router' +import resume from '../../../_content/resume.json' import Logo from '../../images/logo.svg' import styles from './index.module.css' -import resume from '../../../_content/resume.json' -import { useRouter } from 'next/router' type Props = { small?: boolean diff --git a/src/components/Meta/index.test.tsx b/src/components/Meta/index.test.tsx index f6b24f6..c9abe5a 100644 --- a/src/components/Meta/index.test.tsx +++ b/src/components/Meta/index.test.tsx @@ -1,4 +1,4 @@ -import { render, act } from '@testing-library/react' +import { act, render } from '@testing-library/react' import Meta from '.' describe('Meta', () => { diff --git a/src/components/Networks/NetworkLink.tsx b/src/components/Networks/NetworkLink.tsx index 39a6af0..516ea22 100644 --- a/src/components/Networks/NetworkLink.tsx +++ b/src/components/Networks/NetworkLink.tsx @@ -1,7 +1,7 @@ +import { LazyMotion, domAnimation, m } from 'framer-motion' import Icon from '../Icon' -import styles from './index.module.css' -import { LazyMotion, m, domAnimation } from 'framer-motion' import { moveInTop } from '../Transitions' +import styles from './index.module.css' export const NetworkLink = ({ name, url }: { name: string; url: string }) => { const linkClasses = diff --git a/src/components/Networks/index.tsx b/src/components/Networks/index.tsx index ff700f2..659ea63 100644 --- a/src/components/Networks/index.tsx +++ b/src/components/Networks/index.tsx @@ -1,8 +1,8 @@ -import styles from './index.module.css' -import resume from '../../../_content/resume.json' import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' +import resume from '../../../_content/resume.json' import { getAnimationProps } from '../Transitions' import { NetworkLink } from './NetworkLink' +import styles from './index.module.css' type Props = { label: string diff --git a/src/components/Project/index.tsx b/src/components/Project/index.tsx index a19ff71..1e18596 100644 --- a/src/components/Project/index.tsx +++ b/src/components/Project/index.tsx @@ -1,11 +1,11 @@ -import ProjectTechstack from './Techstack' -import ProjectLinks from './Links' +import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' import type ImageType from '../../interfaces/image' import type ProjectType from '../../interfaces/project' import ProjectImage from '../ProjectImage' -import styles from './index.module.css' -import { LazyMotion, domAnimation, m, useReducedMotion } from 'framer-motion' import { getAnimationProps, moveInBottom, moveInTop } from '../Transitions' +import ProjectLinks from './Links' +import ProjectTechstack from './Techstack' +import styles from './index.module.css' const containerVariants = { enter: { diff --git a/src/components/ProjectImage/index.tsx b/src/components/ProjectImage/index.tsx index 73110c8..0c3c6d6 100644 --- a/src/components/ProjectImage/index.tsx +++ b/src/components/ProjectImage/index.tsx @@ -1,12 +1,12 @@ +import { useEffect, useState } from 'react' +import Image from 'next/image' import { - domAnimation, LazyMotion, + domAnimation, m, useAnimation, useReducedMotion } from 'framer-motion' -import Image from 'next/image' -import { useState, useEffect } from 'react' import ImageType from '../../interfaces/image' import { getAnimationProps } from '../Transitions' import styles from './index.module.css' diff --git a/src/components/ProjectNav/Project.tsx b/src/components/ProjectNav/Project.tsx index 16ca265..c12f7f8 100644 --- a/src/components/ProjectNav/Project.tsx +++ b/src/components/ProjectNav/Project.tsx @@ -1,8 +1,8 @@ -import { forwardRef, ForwardedRef } from 'react' +import { ForwardedRef, forwardRef } from 'react' import Link from 'next/link' +import ProjectType from '../../interfaces/project' import ProjectImage from '../ProjectImage' import styles from './index.module.css' -import ProjectType from '../../interfaces/project' export const Project = forwardRef( ( diff --git a/src/components/ProjectNav/index.tsx b/src/components/ProjectNav/index.tsx index ccb33cb..89300bd 100644 --- a/src/components/ProjectNav/index.tsx +++ b/src/components/ProjectNav/index.tsx @@ -1,7 +1,7 @@ -import { useEffect, createRef } from 'react' -import styles from './index.module.css' +import { createRef, useEffect } from 'react' import ProjectType from '../../interfaces/project' import { Project } from './Project' +import styles from './index.module.css' type Props = { projects: { slug: string }[] diff --git a/src/components/ProjectPreview/index.tsx b/src/components/ProjectPreview/index.tsx index 65dc861..1f79ae6 100644 --- a/src/components/ProjectPreview/index.tsx +++ b/src/components/ProjectPreview/index.tsx @@ -1,7 +1,7 @@ import Link from 'next/link' -import styles from './index.module.css' -import ProjectImage from '../ProjectImage' import ImageType from '../../interfaces/image' +import ProjectImage from '../ProjectImage' +import styles from './index.module.css' type Props = { title: string diff --git a/src/components/Projects/index.tsx b/src/components/Projects/index.tsx index e6c18d8..b471ae1 100644 --- a/src/components/Projects/index.tsx +++ b/src/components/Projects/index.tsx @@ -1,5 +1,5 @@ -import ProjectPreview from '../ProjectPreview' import ProjectType from '../../interfaces/project' +import ProjectPreview from '../ProjectPreview' import styles from './index.module.css' type Props = { diff --git a/src/components/Repository/index.test.tsx b/src/components/Repository/index.test.tsx index 1e093a5..504f847 100644 --- a/src/components/Repository/index.test.tsx +++ b/src/components/Repository/index.test.tsx @@ -1,7 +1,7 @@ import { render } from '@testing-library/react' -import Repository from '../Repository' import repos from '../../../tests/__fixtures__/repos.json' import Repo from '../../interfaces/repo' +import Repository from '../Repository' describe('Repository', () => { it('renders correctly', () => { diff --git a/src/components/ThemeSwitch/Item.tsx b/src/components/ThemeSwitch/Item.tsx index a18de89..3a44cc9 100644 --- a/src/components/ThemeSwitch/Item.tsx +++ b/src/components/ThemeSwitch/Item.tsx @@ -1,7 +1,7 @@ -import Icon from '../Icon' import * as Select from '@radix-ui/react-select' -import { getIconName } from './index' +import Icon from '../Icon' import styles from './Item.module.css' +import { getIconName } from './index' export function Item({ theme }: { theme: string }) { return ( diff --git a/src/components/ThemeSwitch/index.test.tsx b/src/components/ThemeSwitch/index.test.tsx index 9da3b7a..f3eb956 100644 --- a/src/components/ThemeSwitch/index.test.tsx +++ b/src/components/ThemeSwitch/index.test.tsx @@ -1,4 +1,4 @@ -import { render, fireEvent, cleanup, waitFor } from '@testing-library/react' +import { cleanup, fireEvent, render, waitFor } from '@testing-library/react' import ThemeSwitch from '.' describe('ThemeSwitch', () => { diff --git a/src/components/ThemeSwitch/index.tsx b/src/components/ThemeSwitch/index.tsx index bffb2c6..eb26b9b 100644 --- a/src/components/ThemeSwitch/index.tsx +++ b/src/components/ThemeSwitch/index.tsx @@ -1,10 +1,10 @@ -import Icon from '../Icon' -import styles from './index.module.css' +import { useEffect, useState } from 'react' +import Head from 'next/head' import * as Select from '@radix-ui/react-select' import { useTheme } from 'next-themes' -import Head from 'next/head' -import { useState, useEffect } from 'react' +import Icon from '../Icon' import { Item } from './Item' +import styles from './index.module.css' export function getIconName(theme: string) { return theme === 'light' ? 'Sun' : theme === 'dark' ? 'Moon' : 'Monitor' diff --git a/src/components/Vcard/_utils.test.ts b/src/components/Vcard/_utils.test.ts index 7ef2daa..4ca9e0a 100644 --- a/src/components/Vcard/_utils.test.ts +++ b/src/components/Vcard/_utils.test.ts @@ -1,6 +1,6 @@ -import { constructVcard, toDataURL, init } from './_utils' import meta from '../../../_content/meta.json' import resume from '../../../_content/resume.json' +import { constructVcard, init, toDataURL } from './_utils' const metaMock = { ...meta, diff --git a/src/components/Vcard/index.test.tsx b/src/components/Vcard/index.test.tsx index c7dcc2b..02c6785 100644 --- a/src/components/Vcard/index.test.tsx +++ b/src/components/Vcard/index.test.tsx @@ -1,4 +1,4 @@ -import { render, fireEvent, waitFor, screen } from '@testing-library/react' +import { fireEvent, render, screen, waitFor } from '@testing-library/react' import Vcard from '.' describe('Vcard', () => { diff --git a/src/layouts/Site/index.test.tsx b/src/layouts/Site/index.test.tsx index 56e80b3..a7dc4dd 100644 --- a/src/layouts/Site/index.test.tsx +++ b/src/layouts/Site/index.test.tsx @@ -1,4 +1,4 @@ -import { render, screen, act } from '@testing-library/react' +import { act, render, screen } from '@testing-library/react' import Site from '.' describe('Site', () => { diff --git a/src/layouts/Site/index.tsx b/src/layouts/Site/index.tsx index 1fa28f1..3a1d4d9 100644 --- a/src/layouts/Site/index.tsx +++ b/src/layouts/Site/index.tsx @@ -1,13 +1,13 @@ import { useRouter } from 'next/router' -import ThemeSwitch from '../../components/ThemeSwitch' -import Header from '../../components/Header' -import Footer from '../../components/Footer' -import MetaFavicon from '../../components/Meta/Favicon' -import meta from '../../../_content/meta.json' -import HostnameCheck from '../../components/HostnameCheck' -import styles from './index.module.css' import Script from 'next/script' +import meta from '../../../_content/meta.json' +import Footer from '../../components/Footer' +import Header from '../../components/Header' +import HostnameCheck from '../../components/HostnameCheck' +import MetaFavicon from '../../components/Meta/Favicon' +import ThemeSwitch from '../../components/ThemeSwitch' import { UMAMI_SCRIPT_URL, UMAMI_WEBSITE_ID } from '../../lib/umami' +import styles from './index.module.css' const isProduction = process.env.NODE_ENV === 'production' diff --git a/src/lib/content.ts b/src/lib/content.ts index 39c89d2..09daa73 100644 --- a/src/lib/content.ts +++ b/src/lib/content.ts @@ -1,6 +1,6 @@ import fs from 'fs' -import { join } from 'path' import yaml from 'js-yaml' +import { join } from 'path' import sharp from 'sharp' import type ImageType from '../interfaces/image' import type ProjectType from '../interfaces/project' diff --git a/src/lib/github.ts b/src/lib/github.ts index 57d6274..eaaa4ff 100644 --- a/src/lib/github.ts +++ b/src/lib/github.ts @@ -1,3 +1,6 @@ +import data from '../../_content/repos.json' +import Repo from '../interfaces/repo' + // // Get GitHub repos // @@ -5,9 +8,6 @@ if (!process.env.GITHUB_TOKEN) { throw new Error('Missing GitHub environment variable') } -import data from '../../_content/repos.json' -import Repo from '../interfaces/repo' - const gitHubConfig = { headers: { 'User-Agent': 'kremalicious/portfolio', diff --git a/src/lib/markdown.ts b/src/lib/markdown.ts index e459a88..f719837 100644 --- a/src/lib/markdown.ts +++ b/src/lib/markdown.ts @@ -1,6 +1,6 @@ import { remark } from 'remark' -import html from 'remark-html' import gfm from 'remark-gfm' +import html from 'remark-html' export async function markdownToHtml(markdown: string) { const result = await remark().use(gfm).use(html).process(markdown) diff --git a/src/pages/[slug].tsx b/src/pages/[slug].tsx index fed3e6d..e18d1df 100644 --- a/src/pages/[slug].tsx +++ b/src/pages/[slug].tsx @@ -1,14 +1,14 @@ import { GetStaticPaths, GetStaticProps } from 'next/types' +import resume from '../../_content/resume.json' +import Project from '../components/Project' +import ProjectNav from '../components/ProjectNav' +import type ProjectType from '../interfaces/project' +import Page from '../layouts/Page' import { - getProjectBySlug, getAllProjects, + getProjectBySlug, getProjectSlugs } from '../lib/content' -import type ProjectType from '../interfaces/project' -import Project from '../components/Project' -import resume from '../../_content/resume.json' -import ProjectNav from '../components/ProjectNav' -import Page from '../layouts/Page' type Props = { project: ProjectType diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 6d47e7e..1fe809c 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,7 +1,7 @@ import type { AppProps } from 'next/app' -import '../styles/global.css' -import Site from '../layouts/Site' import { ThemeProvider } from 'next-themes' +import Site from '../layouts/Site' +import '../styles/global.css' export default function MyApp({ Component, pageProps, router }: AppProps) { return ( diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index e0a61b2..c088971 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -1,4 +1,4 @@ -import { Html, Head, Main, NextScript } from 'next/document' +import { Head, Html, Main, NextScript } from 'next/document' import Typekit from '../components/Typekit' export default function Document() { diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 7afc9be..a2b9ea3 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,13 +1,13 @@ -import { getAllProjects } from '../lib/content' -import Project from '../interfaces/project' +import { GetStaticProps } from 'next/types' import meta from '../../_content/meta.json' import resume from '../../_content/resume.json' import Projects from '../components/Projects' -import { GetStaticProps } from 'next/types' -import { getGithubRepos } from '../lib/github' -import Repo from '../interfaces/repo' import Repositories from '../components/Repositories' +import Project from '../interfaces/project' +import Repo from '../interfaces/repo' import Page from '../layouts/Page' +import { getAllProjects } from '../lib/content' +import { getGithubRepos } from '../lib/github' type Props = { projects: Project[]