From 0262f9a32be679092f7453dfcd964f197a32007d Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Tue, 5 Aug 2025 16:31:35 -0700 Subject: [PATCH 1/4] define Transition props --- packages/@react-spectrum/overlays/package.json | 1 + .../overlays/src/OpenTransition.tsx | 17 +++++++++++------ yarn.lock | 10 ++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/@react-spectrum/overlays/package.json b/packages/@react-spectrum/overlays/package.json index 7a0f04fb059..f05db0951b5 100644 --- a/packages/@react-spectrum/overlays/package.json +++ b/packages/@react-spectrum/overlays/package.json @@ -48,6 +48,7 @@ "@react-types/overlays": "^3.9.0", "@react-types/shared": "^3.31.0", "@swc/helpers": "^0.5.0", + "@types/react-transition-group": "^4.4.12", "react-transition-group": "^4.4.5" }, "devDependencies": { diff --git a/packages/@react-spectrum/overlays/src/OpenTransition.tsx b/packages/@react-spectrum/overlays/src/OpenTransition.tsx index ec3b66b33c5..44b644ccf53 100644 --- a/packages/@react-spectrum/overlays/src/OpenTransition.tsx +++ b/packages/@react-spectrum/overlays/src/OpenTransition.tsx @@ -10,14 +10,19 @@ * governing permissions and limitations under the License. */ -import React, {JSX, JSXElementConstructor, ReactElement} from 'react'; -import {Transition, TransitionProps} from 'react-transition-group'; +import React, {ComponentProps, JSX, JSXElementConstructor, ReactElement} from 'react'; +import {Transition} from 'react-transition-group'; const OPEN_STATES = { entering: false, entered: true }; +type TransitionProps = ComponentProps> +interface OpenTransitionProps extends Omit { + children: any +} + /** * Timeout issues adding css animations to enter may be related to * https://github.com/reactjs/react-transition-group/issues/189 or @@ -32,16 +37,16 @@ const OPEN_STATES = { */ export function OpenTransition( - props: TransitionProps -): JSX.Element | ReactElement>[] { + props: OpenTransitionProps +): JSX.Element | ReactElement>[] { // Do not apply any transition if in chromatic. if (process.env.CHROMATIC) { - return React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: props.in})); + return React.Children.map(props.children, child => child && React.isValidElement(child) && React.cloneElement(child as any, {isOpen: props.in})); } return ( - {(state) => React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: !!OPEN_STATES[state]}))} + {(state) => React.Children.map(props.children, child => child && React.isValidElement(child) && React.cloneElement(child as any, {isOpen: !!OPEN_STATES[state]}))} ); } diff --git a/yarn.lock b/yarn.lock index 009a250feb7..7ad19008e9c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7260,6 +7260,7 @@ __metadata: "@react-types/overlays": "npm:^3.9.0" "@react-types/shared": "npm:^3.31.0" "@swc/helpers": "npm:^0.5.0" + "@types/react-transition-group": "npm:^4.4.12" react-transition-group: "npm:^4.4.5" peerDependencies: "@react-spectrum/provider": ^3.0.0 @@ -10597,6 +10598,15 @@ __metadata: languageName: node linkType: hard +"@types/react-transition-group@npm:^4.4.12": + version: 4.4.12 + resolution: "@types/react-transition-group@npm:4.4.12" + peerDependencies: + "@types/react": "*" + checksum: 10c0/0441b8b47c69312c89ec0760ba477ba1a0808a10ceef8dc1c64b1013ed78517332c30f18681b0ec0b53542731f1ed015169fed1d127cc91222638ed955478ec7 + languageName: node + linkType: hard + "@types/react@npm:19.1.8": version: 19.1.8 resolution: "@types/react@npm:19.1.8" From f321d802fd924dacea3dba844c42ae2edb2bcf37 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Thu, 7 Aug 2025 09:41:27 -0700 Subject: [PATCH 2/4] Revert "define Transition props" This reverts commit 0262f9a32be679092f7453dfcd964f197a32007d. --- packages/@react-spectrum/overlays/package.json | 1 - .../overlays/src/OpenTransition.tsx | 17 ++++++----------- yarn.lock | 10 ---------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/packages/@react-spectrum/overlays/package.json b/packages/@react-spectrum/overlays/package.json index f05db0951b5..7a0f04fb059 100644 --- a/packages/@react-spectrum/overlays/package.json +++ b/packages/@react-spectrum/overlays/package.json @@ -48,7 +48,6 @@ "@react-types/overlays": "^3.9.0", "@react-types/shared": "^3.31.0", "@swc/helpers": "^0.5.0", - "@types/react-transition-group": "^4.4.12", "react-transition-group": "^4.4.5" }, "devDependencies": { diff --git a/packages/@react-spectrum/overlays/src/OpenTransition.tsx b/packages/@react-spectrum/overlays/src/OpenTransition.tsx index 44b644ccf53..ec3b66b33c5 100644 --- a/packages/@react-spectrum/overlays/src/OpenTransition.tsx +++ b/packages/@react-spectrum/overlays/src/OpenTransition.tsx @@ -10,19 +10,14 @@ * governing permissions and limitations under the License. */ -import React, {ComponentProps, JSX, JSXElementConstructor, ReactElement} from 'react'; -import {Transition} from 'react-transition-group'; +import React, {JSX, JSXElementConstructor, ReactElement} from 'react'; +import {Transition, TransitionProps} from 'react-transition-group'; const OPEN_STATES = { entering: false, entered: true }; -type TransitionProps = ComponentProps> -interface OpenTransitionProps extends Omit { - children: any -} - /** * Timeout issues adding css animations to enter may be related to * https://github.com/reactjs/react-transition-group/issues/189 or @@ -37,16 +32,16 @@ interface OpenTransitionProps extends Omit { */ export function OpenTransition( - props: OpenTransitionProps -): JSX.Element | ReactElement>[] { + props: TransitionProps +): JSX.Element | ReactElement>[] { // Do not apply any transition if in chromatic. if (process.env.CHROMATIC) { - return React.Children.map(props.children, child => child && React.isValidElement(child) && React.cloneElement(child as any, {isOpen: props.in})); + return React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: props.in})); } return ( - {(state) => React.Children.map(props.children, child => child && React.isValidElement(child) && React.cloneElement(child as any, {isOpen: !!OPEN_STATES[state]}))} + {(state) => React.Children.map(props.children, child => child && React.cloneElement(child, {isOpen: !!OPEN_STATES[state]}))} ); } diff --git a/yarn.lock b/yarn.lock index 7ad19008e9c..009a250feb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7260,7 +7260,6 @@ __metadata: "@react-types/overlays": "npm:^3.9.0" "@react-types/shared": "npm:^3.31.0" "@swc/helpers": "npm:^0.5.0" - "@types/react-transition-group": "npm:^4.4.12" react-transition-group: "npm:^4.4.5" peerDependencies: "@react-spectrum/provider": ^3.0.0 @@ -10598,15 +10597,6 @@ __metadata: languageName: node linkType: hard -"@types/react-transition-group@npm:^4.4.12": - version: 4.4.12 - resolution: "@types/react-transition-group@npm:4.4.12" - peerDependencies: - "@types/react": "*" - checksum: 10c0/0441b8b47c69312c89ec0760ba477ba1a0808a10ceef8dc1c64b1013ed78517332c30f18681b0ec0b53542731f1ed015169fed1d127cc91222638ed955478ec7 - languageName: node - linkType: hard - "@types/react@npm:19.1.8": version: 19.1.8 resolution: "@types/react@npm:19.1.8" From bcf85f7066b43430d5614a2b221c65ac1311ec22 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Thu, 7 Aug 2025 09:43:41 -0700 Subject: [PATCH 3/4] revert OpenTransition props type to any deciding to do this for now since this is internal only and the types are problematic to implement --- packages/@react-spectrum/overlays/src/OpenTransition.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/@react-spectrum/overlays/src/OpenTransition.tsx b/packages/@react-spectrum/overlays/src/OpenTransition.tsx index ec3b66b33c5..751eb9d8cc5 100644 --- a/packages/@react-spectrum/overlays/src/OpenTransition.tsx +++ b/packages/@react-spectrum/overlays/src/OpenTransition.tsx @@ -11,7 +11,7 @@ */ import React, {JSX, JSXElementConstructor, ReactElement} from 'react'; -import {Transition, TransitionProps} from 'react-transition-group'; +import {Transition} from 'react-transition-group'; const OPEN_STATES = { entering: false, @@ -32,7 +32,8 @@ const OPEN_STATES = { */ export function OpenTransition( - props: TransitionProps + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + props: any ): JSX.Element | ReactElement>[] { // Do not apply any transition if in chromatic. if (process.env.CHROMATIC) { From e12aec4e619e859c6fddffb9347b0f3a163f9ca7 Mon Sep 17 00:00:00 2001 From: Daniel Lu Date: Thu, 7 Aug 2025 17:28:31 -0700 Subject: [PATCH 4/4] get rid of explicit module check --- eslint.config.mjs | 25 +------------------ .../overlays/src/OpenTransition.tsx | 1 - 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 8caaa872e68..92f49f59acc 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -445,29 +445,6 @@ export default [{ "jsdoc/require-jsdoc": OFF, "jsdoc/require-description": OFF, }, -}, { - files: [ - "packages/**/*.ts", - "packages/**/*.tsx" - ], - - rules: { - "@typescript-eslint/explicit-module-boundary-types": ERROR, - }, -}, { - files: [ - "**/dev/**", - "**/test/**", - "**/stories/**", - "**/docs/**", - "**/chromatic/**", - "**/chromatic-fc/**", - "**/__tests__/**" - ], - - rules: { - "@typescript-eslint/explicit-module-boundary-types": OFF, - }, }, { files: [ "packages/@react-aria/focus/src/**/*.ts", @@ -504,4 +481,4 @@ export default [{ rules: { "react/react-in-jsx-scope": OFF, }, -}]; \ No newline at end of file +}]; diff --git a/packages/@react-spectrum/overlays/src/OpenTransition.tsx b/packages/@react-spectrum/overlays/src/OpenTransition.tsx index 751eb9d8cc5..cab6bdcb128 100644 --- a/packages/@react-spectrum/overlays/src/OpenTransition.tsx +++ b/packages/@react-spectrum/overlays/src/OpenTransition.tsx @@ -32,7 +32,6 @@ const OPEN_STATES = { */ export function OpenTransition( - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types props: any ): JSX.Element | ReactElement>[] { // Do not apply any transition if in chromatic.