diff --git a/packages/astro/src/core/errors.ts b/packages/astro/src/core/errors.ts index 4046d4fd1..35893bb9a 100644 --- a/packages/astro/src/core/errors.ts +++ b/packages/astro/src/core/errors.ts @@ -41,9 +41,8 @@ export function fixViteErrorMessage(_err: unknown, server: ViteDevServer) { return err; } - const incompatiblePackages = { - 'react-spectrum': `@adobe/react-spectrum is not compatible with Vite's server-side rendering mode at the moment. You can still use React Spectrum from the client. Create an island React component and use the client:only directive. From there you can use React Spectrum.` + 'react-spectrum': `@adobe/react-spectrum is not compatible with Vite's server-side rendering mode at the moment. You can still use React Spectrum from the client. Create an island React component and use the client:only directive. From there you can use React Spectrum.`, }; const incompatPackageExp = new RegExp(`(${Object.keys(incompatiblePackages).join('|')})`); @@ -52,7 +51,7 @@ function generateHint(err: ErrorWithMetadata): string | undefined { return 'You likely need to add this package to `vite.ssr.noExternal` in your astro config file.'; } else { const res = incompatPackageExp.exec(err.stack); - if(res) { + if (res) { const key = res[0] as keyof typeof incompatiblePackages; return incompatiblePackages[key]; } diff --git a/packages/astro/src/vite-plugin-astro-server/index.ts b/packages/astro/src/vite-plugin-astro-server/index.ts index 8fb9b1ad6..6ee81593f 100644 --- a/packages/astro/src/vite-plugin-astro-server/index.ts +++ b/packages/astro/src/vite-plugin-astro-server/index.ts @@ -38,11 +38,11 @@ function removeViteHttpMiddleware(server: vite.Connect.Server) { } function truncateString(str: string, n: number) { - if (str.length > n) { - return str.substring(0, n) + '…'; - } else { - return str; - } + if (str.length > n) { + return str.substring(0, n) + '…'; + } else { + return str; + } } function writeHtmlResponse(res: http.ServerResponse, statusCode: number, html: string) { diff --git a/packages/astro/test/error-react-spectrum.test.js b/packages/astro/test/error-react-spectrum.test.js index b44f571e3..a16e8632a 100644 --- a/packages/astro/test/error-react-spectrum.test.js +++ b/packages/astro/test/error-react-spectrum.test.js @@ -21,7 +21,7 @@ describe('Error packages: react-spectrum', () => { it('properly detect syntax errors in template', async () => { devServer = await fixture.startDevServer(); - let html = await fixture.fetch('/').then(res => res.text()); + let html = await fixture.fetch('/').then((res) => res.text()); let $ = cheerio.load(html); const msg = $('.error-message').text(); expect(msg).to.match(/@adobe\/react-spectrum is not compatible/);