From 65d601c93df277a4909973bb966f44d997ddb4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Wed, 31 May 2023 16:11:14 +0200 Subject: [PATCH 1/3] fix(remix-dev): loosen `prettier` version (#6488) --- package.json | 2 +- .../fixtures/replace-remix-magic-imports/package.json | 2 +- packages/remix-dev/package.json | 2 +- yarn.lock | 5 ----- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 2cdbef9827e..bce85e6c015 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "lodash": "^4.17.21", "npm-run-all": "^4.1.5", "patch-package": "^6.5.0", - "prettier": "2.7.1", + "prettier": "^2.7.1", "prompt-confirm": "^2.0.4", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json b/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json index bcbdf75e47a..db097f595ab 100644 --- a/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json +++ b/packages/remix-dev/__tests__/fixtures/replace-remix-magic-imports/package.json @@ -51,7 +51,7 @@ "happy-dom": "^2.49.0", "msw": "^0.39.2", "npm-run-all": "^4.1.5", - "prettier": "2.6.0", + "prettier": "^2.7.1", "prettier-plugin-tailwindcss": "^0.1.8", "prisma": "^3.11.0", "start-server-and-test": "^1.14.0", diff --git a/packages/remix-dev/package.json b/packages/remix-dev/package.json index 2ae2d9b9711..952bab9f446 100644 --- a/packages/remix-dev/package.json +++ b/packages/remix-dev/package.json @@ -57,7 +57,7 @@ "postcss-discard-duplicates": "^5.1.0", "postcss-load-config": "^4.0.1", "postcss-modules": "^6.0.0", - "prettier": "2.7.1", + "prettier": "^2.7.1", "pretty-ms": "^7.0.1", "proxy-agent": "^5.0.0", "react-refresh": "^0.14.0", diff --git a/yarn.lock b/yarn.lock index f8f79349c6e..c0d4a6ba4a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11115,11 +11115,6 @@ prelude-ls@~1.1.2: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@2.7.1: - version "2.7.1" - resolved "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== - prettier@^2.7.1: version "2.8.1" resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz" From 92a570ee7773242064d50bd0b7a5e406f4f3eb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Wed, 31 May 2023 16:11:30 +0200 Subject: [PATCH 2/3] refactor(remix-react): remove unnecessary type-checks (#6323) --- packages/remix-react/components.tsx | 26 ++++++++----------------- packages/remix-react/data.ts | 30 +++++++++-------------------- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/packages/remix-react/components.tsx b/packages/remix-react/components.tsx index 6e364e1e727..17fbe9313ca 100644 --- a/packages/remix-react/components.tsx +++ b/packages/remix-react/components.tsx @@ -7,7 +7,6 @@ import * as React from "react"; import type { AgnosticDataRouteMatch, UNSAFE_DeferredData as DeferredData, - ErrorResponse, Navigation, TrackedPromise, } from "@remix-run/router"; @@ -174,23 +173,14 @@ export function RemixRouteError({ id }: { id: string }) { } if (isRouteErrorResponse(error)) { - let tError = error as any; - if ( - tError?.error instanceof Error && - tError.status !== 404 && - ErrorBoundary - ) { + let tError = error; + if (!!tError?.error && tError.status !== 404 && ErrorBoundary) { // Internal framework-thrown ErrorResponses return ; } if (CatchBoundary) { // User-thrown ErrorResponses - return ( - - ); + return ; } } @@ -222,11 +212,11 @@ export interface RemixNavLinkProps extends NavLinkProps { } interface PrefetchHandlers { - onFocus?: FocusEventHandler; - onBlur?: FocusEventHandler; - onMouseEnter?: MouseEventHandler; - onMouseLeave?: MouseEventHandler; - onTouchStart?: TouchEventHandler; + onFocus?: FocusEventHandler; + onBlur?: FocusEventHandler; + onMouseEnter?: MouseEventHandler; + onMouseLeave?: MouseEventHandler; + onTouchStart?: TouchEventHandler; } function usePrefetchBehavior( diff --git a/packages/remix-react/data.ts b/packages/remix-react/data.ts index 4991ec8720d..a065b65c407 100644 --- a/packages/remix-react/data.ts +++ b/packages/remix-react/data.ts @@ -10,32 +10,20 @@ import { */ export type AppData = any; -export function isCatchResponse(response: any): boolean { - return ( - response instanceof Response && - response.headers.get("X-Remix-Catch") != null - ); +export function isCatchResponse(response: Response): boolean { + return response.headers.get("X-Remix-Catch") != null; } -export function isErrorResponse(response: any): boolean { - return ( - response instanceof Response && - response.headers.get("X-Remix-Error") != null - ); +export function isErrorResponse(response: Response): boolean { + return response.headers.get("X-Remix-Error") != null; } -export function isRedirectResponse(response: any): boolean { - return ( - response instanceof Response && - response.headers.get("X-Remix-Redirect") != null - ); +export function isRedirectResponse(response: Response): boolean { + return response.headers.get("X-Remix-Redirect") != null; } -export function isDeferredResponse(response: any): boolean { - return ( - response instanceof Response && - !!response.headers.get("Content-Type")?.match(/text\/remix-deferred/) - ); +export function isDeferredResponse(response: Response): boolean { + return !!response.headers.get("Content-Type")?.match(/text\/remix-deferred/); } export async function fetchData( @@ -106,7 +94,7 @@ export async function parseDeferredReadableStream( deferredData = deferredData || {}; - deferredData[eventKey] = new Promise((resolve, reject) => { + deferredData[eventKey] = new Promise((resolve, reject) => { deferredResolvers[eventKey] = { resolve: (value: unknown) => { resolve(value); From 08aedc4e37b9f8ec86472e6de571fd34233ad628 Mon Sep 17 00:00:00 2001 From: Remix Run Bot Date: Wed, 31 May 2023 14:14:15 +0000 Subject: [PATCH 3/3] chore: format --- docs/guides/styling.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/guides/styling.md b/docs/guides/styling.md index 8a021efad76..3f95507db65 100644 --- a/docs/guides/styling.md +++ b/docs/guides/styling.md @@ -432,11 +432,11 @@ Now we can tell it which files to generate classes from: import type { Config } from "tailwindcss"; export default { - content: ["./app/**/*.{js,jsx,ts,tsx}"], - theme: { - extend: {}, - }, - plugins: [], + content: ["./app/**/*.{js,jsx,ts,tsx}"], + theme: { + extend: {}, + }, + plugins: [], } satisfies Config; ```