From 405042bc1997ee4986ce1db715aec5c9e825e200 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:35:52 +0200 Subject: [PATCH 01/25] fix: lighthouse storage regex --- lighthouserc.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index 5c8c3e1..3ac3f63 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -27,10 +27,8 @@ ci: aggregationMethod: optimistic bf-cache: 'off' csp-xss: 'off' - identical-links-same-purpose: 'off' total-byte-weight: 'off' color-contrast: 'off' - heading-order: 'off' mainthread-work-breakdown: 'off' bootup-time: 'off' largest-contentful-paint: 'off' @@ -40,7 +38,7 @@ ci: uses-responsive-images: 'off' maskable-icon: 'off' installable-manifest: 'off' - - matchingUrlPattern: 'http://[^/]+/storage.*' + - matchingUrlPattern: 'http://.*/storage.*' preset: 'lighthouse:recommended' assertions: unused-javascript: 'off' From 37768d155af4f7d99813a2e6c157a1491c4af64a Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:36:05 +0200 Subject: [PATCH 02/25] fix: heading order --- src/components/news/ArticleCard.tsx | 5 ++++- src/components/storage/ItemCard.tsx | 2 +- src/components/ui/Card.tsx | 33 +++++++++++++++++------------ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/components/news/ArticleCard.tsx b/src/components/news/ArticleCard.tsx index 041f2ee..b7e28d7 100644 --- a/src/components/news/ArticleCard.tsx +++ b/src/components/news/ArticleCard.tsx @@ -49,7 +49,10 @@ function ArticleCard({ fill /> - + {title} diff --git a/src/components/storage/ItemCard.tsx b/src/components/storage/ItemCard.tsx index d653433..ebd734c 100644 --- a/src/components/storage/ItemCard.tsx +++ b/src/components/storage/ItemCard.tsx @@ -33,7 +33,7 @@ function ItemCard({ priority={true} /> - + {item.name} {item.location} diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx index 0479465..ac5b4b8 100644 --- a/src/components/ui/Card.tsx +++ b/src/components/ui/Card.tsx @@ -1,6 +1,10 @@ import { cx } from '@/lib/utils'; import * as React from 'react'; +type CardTitleProps = { + level?: 'h2' | 'h3' | 'h4'; +} & React.HTMLAttributes; + const Card = React.forwardRef< HTMLDivElement, React.HTMLAttributes @@ -28,19 +32,22 @@ const CardHeader = React.forwardRef< )); CardHeader.displayName = 'CardHeader'; -const CardTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); +const CardTitle = React.forwardRef( + ({ level = 'h3', className, ...props }, ref) => { + const Component = level; + + return ( + + ); + }, +); CardTitle.displayName = 'CardTitle'; const CardDescription = React.forwardRef< From a1b37d4c48a619031d59bf202e72d9db927335bd Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 14:51:11 +0200 Subject: [PATCH 03/25] fix: disable more rules --- lighthouserc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lighthouserc.yml b/lighthouserc.yml index 3ac3f63..c79e6ef 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -27,6 +27,8 @@ ci: aggregationMethod: optimistic bf-cache: 'off' csp-xss: 'off' + identical-links-same-purpose: 'off' + heading-order: 'off' total-byte-weight: 'off' color-contrast: 'off' mainthread-work-breakdown: 'off' @@ -38,6 +40,7 @@ ci: uses-responsive-images: 'off' maskable-icon: 'off' installable-manifest: 'off' + unused-javascript: 'off' - matchingUrlPattern: 'http://.*/storage.*' preset: 'lighthouse:recommended' assertions: From 65e8a6812a3e880e6184bef0c97ef5b7cb2df170 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:02:17 +0200 Subject: [PATCH 04/25] fix: assertion to match for all --- lighthouserc.yml | 65 +++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index c79e6ef..65bda68 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -13,37 +13,34 @@ ci: target: 'lhci' serverBaseUrl: 'https://lhci.hackerspace-ntnu.no' # build token is set by the GH Action assert: - assertMatrix: - - matchingUrlPattern: '.*' - preset: 'lighthouse:recommended' - assertions: - first-contentful-paint: - - error - - maxNumericValue: 2000 - aggregationMethod: optimistic - interactive: - - error - - maxNumericValue: 5000 - aggregationMethod: optimistic - bf-cache: 'off' - csp-xss: 'off' - identical-links-same-purpose: 'off' - heading-order: 'off' - total-byte-weight: 'off' - color-contrast: 'off' - mainthread-work-breakdown: 'off' - bootup-time: 'off' - largest-contentful-paint: 'off' - dom-size: 'off' - render-blocking-resources: 'off' - server-response-time: 'off' - uses-responsive-images: 'off' - maskable-icon: 'off' - installable-manifest: 'off' - unused-javascript: 'off' - - matchingUrlPattern: 'http://.*/storage.*' - preset: 'lighthouse:recommended' - assertions: - unused-javascript: 'off' - cumulative-layout-shift: 'off' - max-potential-fid: 'off' + preset: 'lighthouse:recommended' + assertions: + first-contentful-paint: + - error + - maxNumericValue: 2000 + aggregationMethod: optimistic + interactive: + - error + - maxNumericValue: 5000 + aggregationMethod: optimistic + bf-cache: 'off' + csp-xss: 'off' + identical-links-same-purpose: 'off' + heading-order: 'off' + total-byte-weight: 'off' + color-contrast: 'off' + mainthread-work-breakdown: 'off' + bootup-time: 'off' + largest-contentful-paint: 'off' + dom-size: 'off' + render-blocking-resources: 'off' + server-response-time: 'off' + uses-responsive-images: 'off' + maskable-icon: 'off' + installable-manifest: 'off' + assertMatrix: + - matchingUrlPattern: 'http://.*/storage.*' + assertions: + unused-javascript: 'off' + cumulative-layout-shift: 'off' + max-potential-fid: 'off' From b0d72dabd32baa084d61b8379d11dcb799b6af56 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:09:47 +0200 Subject: [PATCH 05/25] fix: indent in lighthouse config --- lighthouserc.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index 65bda68..b24a321 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -38,9 +38,10 @@ ci: uses-responsive-images: 'off' maskable-icon: 'off' installable-manifest: 'off' - assertMatrix: - - matchingUrlPattern: 'http://.*/storage.*' - assertions: - unused-javascript: 'off' - cumulative-layout-shift: 'off' - max-potential-fid: 'off' + unused-javascript: 'off' + assertMatrix: + - matchingUrlPattern: 'http://.*/storage.*' + assertions: + unused-javascript: 'off' + cumulative-layout-shift: 'off' + max-potential-fid: 'off' From abae823cb93706f49c94d37f6ccfd4c63ec5a89f Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:25:08 +0200 Subject: [PATCH 06/25] chore: set lighthouse rules specific --- lighthouserc.yml | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index b24a321..fbf205a 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -13,35 +13,17 @@ ci: target: 'lhci' serverBaseUrl: 'https://lhci.hackerspace-ntnu.no' # build token is set by the GH Action assert: - preset: 'lighthouse:recommended' - assertions: - first-contentful-paint: - - error - - maxNumericValue: 2000 - aggregationMethod: optimistic - interactive: - - error - - maxNumericValue: 5000 - aggregationMethod: optimistic - bf-cache: 'off' - csp-xss: 'off' - identical-links-same-purpose: 'off' - heading-order: 'off' - total-byte-weight: 'off' - color-contrast: 'off' - mainthread-work-breakdown: 'off' - bootup-time: 'off' - largest-contentful-paint: 'off' - dom-size: 'off' - render-blocking-resources: 'off' - server-response-time: 'off' - uses-responsive-images: 'off' - maskable-icon: 'off' - installable-manifest: 'off' - unused-javascript: 'off' assertMatrix: + - matchingUrlPattern: '.*' + preset: 'lighthouse:recommended' - matchingUrlPattern: 'http://.*/storage.*' + preset: 'lighthouse:recommended' assertions: + render-blocking-resources: 'off' + largest-contentful-paint: 'off' + heading-order: 'off' + color-contrast: 'off' + bf-cache: 'off' unused-javascript: 'off' cumulative-layout-shift: 'off' max-potential-fid: 'off' From 138437cde63daceae5b86a08b51930a88c9487f6 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:36:42 +0200 Subject: [PATCH 07/25] fix: set specific rules per page group --- lighthouserc.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index fbf205a..08e2c31 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -2,10 +2,10 @@ ci: collect: url: - 'http://localhost:3000/en' + - 'http://localhost:3000/en/about' - 'http://localhost:3000/en/events' - 'http://localhost:3000/en/news' - 'http://localhost:3000/en/news/1' - - 'http://localhost:3000/en/about' - 'http://localhost:3000/en/storage' - 'http://localhost:3000/en/storage/shopping-cart' startServerCommand: 'bun run start' @@ -16,14 +16,29 @@ ci: assertMatrix: - matchingUrlPattern: '.*' preset: 'lighthouse:recommended' - - matchingUrlPattern: 'http://.*/storage.*' - preset: 'lighthouse:recommended' assertions: - render-blocking-resources: 'off' - largest-contentful-paint: 'off' + bf-cache: 'off' + color-contrast: 'off' heading-order: 'off' + largest-contentful-paint: 'off' + render-blocking-resources: 'off' + - matchingUrlPattern: 'http://.*/news.*' + preset: 'lighthouse:recommended' + assertions: + bf-cache: 'off' color-contrast: 'off' + heading-order: 'off' + largest-contentful-paint: 'off' + render-blocking-resources: 'off' + user-responsive-images: 'off' # Should be removed when we obtain images from backend + - matchingUrlPattern: 'http://.*/storage.*' + preset: 'lighthouse:recommended' + assertions: bf-cache: 'off' + color-contrast: 'off' + heading-order: 'off' + largest-contentful-paint: 'off' + render-blocking-resources: 'off' unused-javascript: 'off' - cumulative-layout-shift: 'off' + cumulative-layout-shift: 'off' # We don't always know how many items are in the cart, which can lead to layout shifts when loading completes max-potential-fid: 'off' From 7dcbe35a0f485e009bd4ca80da731984eee64d90 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Sun, 6 Oct 2024 15:50:08 +0200 Subject: [PATCH 08/25] fix: regex and try fixing linting --- lighthouserc.yml | 7 ++++--- src/components/ui/Combobox.tsx | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lighthouserc.yml b/lighthouserc.yml index 08e2c31..8588db6 100644 --- a/lighthouserc.yml +++ b/lighthouserc.yml @@ -22,7 +22,7 @@ ci: heading-order: 'off' largest-contentful-paint: 'off' render-blocking-resources: 'off' - - matchingUrlPattern: 'http://.*/news.*' + - matchingUrlPattern: 'http://[^/]+/news.*' preset: 'lighthouse:recommended' assertions: bf-cache: 'off' @@ -30,8 +30,9 @@ ci: heading-order: 'off' largest-contentful-paint: 'off' render-blocking-resources: 'off' - user-responsive-images: 'off' # Should be removed when we obtain images from backend - - matchingUrlPattern: 'http://.*/storage.*' + interactive: 'off' + uses-responsive-images: 'off' # Should be removed when we obtain images from backend + - matchingUrlPattern: 'http://[^/]+/storage.*' preset: 'lighthouse:recommended' assertions: bf-cache: 'off' diff --git a/src/components/ui/Combobox.tsx b/src/components/ui/Combobox.tsx index d51c3b2..82432e1 100644 --- a/src/components/ui/Combobox.tsx +++ b/src/components/ui/Combobox.tsx @@ -50,6 +50,7 @@ function Combobox({