diff --git a/eslint.config.ts b/eslint.config.ts index 6b3dd8f17..f99a89024 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -837,6 +837,32 @@ export default [ ], }, }, + { + files: [ + '**/*.astro', + '**/*.ts', + '**/*.tsx', + ], + ignores: [ + 'src/**/client/**', + 'src/components/scripts/**/*', + 'src/pages/testing/**/*', + 'src/components/scripts/utils/__tests__/siteUrlClient.spec.ts', + ], + rules: { + 'no-restricted-imports': [ + level, + { + paths: [ + { + name: '@components/scripts/utils/siteUrlClient', + message: 'Only browser-executed client code may import @components/scripts/utils/siteUrlClient. SSR, Astro frontmatter, actions, API routes, and other server-side code must resolve site URLs from runtime-safe server helpers or request context instead.', + }, + ], + }, + ], + }, + }, { files: [ '**/*.astro', @@ -849,6 +875,10 @@ export default [ level, { paths: [ + { + name: '@components/scripts/utils/siteUrlClient', + message: 'Astro files must not import @components/scripts/utils/siteUrlClient. Browser-only site URL helpers are unsafe in Astro frontmatter because those files can execute during SSR. Resolve site URLs from Astro context or use a runtime-safe server helper instead.', + }, { name: '@lib/config/siteUrlServer', message: 'Astro files must not import @lib/config/siteUrlServer. Resolve site URLs from Astro context or use a runtime-safe helper instead.', diff --git a/src/components/Footer/index.astro b/src/components/Footer/index.astro index 5d1607417..66d8b8b88 100644 --- a/src/components/Footer/index.astro +++ b/src/components/Footer/index.astro @@ -1,6 +1,5 @@ --- import contactData from '@content/contact.json' -import { getSiteUrl } from '@components/scripts/utils/siteUrlClient' import { formatPhoneNumber } from '@components/Footer/server' import Avatar from '@components/Avatar/index.astro' import BugReporter from '@components/BugReporter/index.astro' @@ -227,7 +226,7 @@ const iconButtonClasses = [