diff --git a/app/components/BackButton.vue b/app/components/BackButton.vue
new file mode 100644
index 0000000000..8b0f0c46d8
--- /dev/null
+++ b/app/components/BackButton.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
diff --git a/app/pages/about.vue b/app/pages/about.vue
index e6dde0c851..20e7559b94 100644
--- a/app/pages/about.vue
+++ b/app/pages/about.vue
@@ -3,9 +3,6 @@ import type { Role } from '#server/api/contributors.get'
import { SPONSORS } from '~/assets/logos/sponsors'
import { OSS_PARTNERS } from '~/assets/logos/oss-partners'
-const router = useRouter()
-const canGoBack = useCanGoBack()
-
useSeoMeta({
title: () => `${$t('about.title')} - npmx`,
ogTitle: () => `${$t('about.title')} - npmx`,
@@ -57,15 +54,7 @@ const roleLabels = computed(
{{ $t('about.heading') }}
-
+
{{ $t('tagline') }}
diff --git a/app/pages/accessibility.vue b/app/pages/accessibility.vue
index 9e0e6c9dc3..027fdef41a 100644
--- a/app/pages/accessibility.vue
+++ b/app/pages/accessibility.vue
@@ -12,9 +12,6 @@ defineOgImageComponent('Default', {
title: () => $t('a11y.title'),
description: () => $t('a11y.welcome', { app: 'npmx' }),
})
-
-const router = useRouter()
-const canGoBack = useCanGoBack()
@@ -25,15 +22,7 @@ const canGoBack = useCanGoBack()
{{ $t('a11y.title') }}
-
+
diff --git a/app/pages/blog/index.vue b/app/pages/blog/index.vue
index 07e40d2d9d..984eb60c73 100644
--- a/app/pages/blog/index.vue
+++ b/app/pages/blog/index.vue
@@ -21,9 +21,12 @@ useSeoMeta({
-
- {{ $t('blog.heading') }}
-
+
+
+ {{ $t('blog.heading') }}
+
+
+
{{ $t('tagline') }}
diff --git a/app/pages/compare.vue b/app/pages/compare.vue
index e38a34657d..56be77de6e 100644
--- a/app/pages/compare.vue
+++ b/app/pages/compare.vue
@@ -8,8 +8,6 @@ definePageMeta({
})
const { locale } = useI18n()
-const router = useRouter()
-const canGoBack = useCanGoBack()
const { copied, copy } = useClipboard({ copiedDuring: 2000 })
// Sync packages with URL query param (stable ref - doesn't change on other query changes)
@@ -171,15 +169,7 @@ useSeoMeta({
{{ $t('compare.packages.title') }}
-
+
{{ $t('compare.packages.tagline') }}
diff --git a/app/pages/pds.vue b/app/pages/pds.vue
index ac14a68ceb..c47259a9f4 100644
--- a/app/pages/pds.vue
+++ b/app/pages/pds.vue
@@ -1,9 +1,6 @@
@@ -27,15 +25,7 @@ const { locale } = useI18n()
{{ $t('privacy_policy.title') }}
-
+
$t('vacations.meta_description'),
})
-const router = useRouter()
-const canGoBack = useCanGoBack()
-
const { data: stats } = useFetch('/api/repo-stats')
/**
@@ -74,15 +71,7 @@ const icons = [
{{ $t('vacations.heading') }}
-
+
const router = useRouter()
-const canGoBack = useCanGoBack()
const { settings } = useSettings()
const { locale, locales, setLocale: setNuxti18nLocale } = useI18n()
const colorMode = useColorMode()
@@ -51,15 +50,7 @@ const setLocale: typeof setNuxti18nLocale = locale => {
{{ $t('settings.title') }}
-
+
{{ $t('settings.tagline') }}
diff --git a/test/nuxt/a11y.spec.ts b/test/nuxt/a11y.spec.ts
index 9a079f91c8..0896cabd45 100644
--- a/test/nuxt/a11y.spec.ts
+++ b/test/nuxt/a11y.spec.ts
@@ -124,6 +124,7 @@ import {
AboutLogoList,
AuthorAvatar,
AuthorList,
+ BackButton,
BlogPostFederatedArticles,
BlogPostListCard,
BlogPostWrapper,
@@ -449,6 +450,14 @@ describe('component accessibility audits', () => {
})
})
+ describe('BackButton', () => {
+ it('should have no accessibility violations', async () => {
+ const component = await mountSuspended(BackButton)
+ const results = await runAxe(component)
+ expect(results.violations).toEqual([])
+ })
+ })
+
describe('TagStatic', () => {
it('should have no accessibility violations', async () => {
const component = await mountSuspended(TagStatic, {
diff --git a/test/unit/a11y-component-coverage.spec.ts b/test/unit/a11y-component-coverage.spec.ts
index f6f6ea845a..0dda568f4c 100644
--- a/test/unit/a11y-component-coverage.spec.ts
+++ b/test/unit/a11y-component-coverage.spec.ts
@@ -49,6 +49,10 @@ const SKIPPED_COMPONENTS: Record = {
'Button/Group.vue': "Wrapper component, tests wouldn't make much sense here",
}
+function normalizeComponentPath(filePath: string): string {
+ return filePath.replaceAll('\\', '/')
+}
+
/**
* Recursively get all Vue component files in a directory.
*/
@@ -62,7 +66,7 @@ function getVueFiles(dir: string, baseDir: string = dir): string[] {
files.push(...getVueFiles(fullPath, baseDir))
} else if (entry.isFile() && entry.name.endsWith('.vue')) {
// Get relative path from base components directory
- files.push(path.relative(baseDir, fullPath))
+ files.push(normalizeComponentPath(path.relative(baseDir, fullPath)))
}
}
@@ -87,7 +91,7 @@ function parseComponentsDeclaration(dtsPath: string): Map {
let match
while ((match = exportRegex.exec(content)) !== null) {
const componentName = match[1]!
- const filePath = match[2]!
+ const filePath = normalizeComponentPath(match[2]!)
const existing = componentMap.get(componentName) || []
if (!existing.includes(filePath)) {
@@ -116,7 +120,7 @@ function getTestedComponents(
let match
while ((match = directImportRegex.exec(testFileContent)) !== null) {
- tested.add(match[1]!)
+ tested.add(normalizeComponentPath(match[1]!))
}
// Match #components imports like: