Skip to content

Conversation

@juanpprieto
Copy link
Contributor

@juanpprieto juanpprieto commented Sep 5, 2025

WHY are these changes introduced?

Standardize TypeScript to 5.9.2 across the monorepo and update ESLint for React Router 7.8.2 compatibility. The base branch used older TypeScript versions that prevented leveraging latest features and maintaining consistency.

WHAT is this pull request doing?

Dependency Updates

Package Old Version New Version
typescript Mixed 5.9.2
@typescript-eslint/eslint-plugin 7.x 8.42.0
@typescript-eslint/parser 7.x 8.42.0
eslint 8.x 9.19.0
@eslint/js - 9.19.0
react-router - 7.8.2 (pinned)
@react-router/dev - 7.8.2 (hoisted)

Changes

  • Removed: eslint-plugin-hydrogen (incompatible with TS 5.9)
  • Fixed: All react-hooks/exhaustive-deps warnings
  • Updated: ESLint configs to flat config format (11 examples)
  • Added: dist/ and .react-router/ to eslint ignores
  • Fixed: Money component USDC currency compatibility
  • Fixed: UIMatch test helper for RR 7.8.2

Note

Money component USDC currency compatibility was cherry picked from the 2025.7.0 branch as the issue was highlighted by typescript 5.9.2 strictness and not just by the APIs type miss-matches.

Files Modified

  • Root package.json: Hoisted React Router dev dependencies
  • All example eslint.config.js: Created standardized configs
  • templates/skeleton/eslint.config.js: Added dist ignores
  • Various components: Fixed lint errors and accessibility issues

HOW to test your changes?

npm run ci:checks  # Run all checks
npm run lint       # Verify linting passes
npm run typecheck  # Verify TypeScript compilation
npm run test       # Run test suite
npm run build:pkg  # Build all packages

Post-merge steps

None required. All packages using standardized versions.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've verified that tests pass locally: npm test
  • I've verified that builds pass locally: npm run build
  • I've verified that linting passes locally: npm run lint

juanpprieto and others added 15 commits September 3, 2025 21:39
- Pin react-router and react-router-dom to exact 7.8.2
- Pin @react-router/* packages to exact 7.8.2
- Remove version ranges (~, ^) to ensure consistency
- Update all packages, templates, and examples
- Update package-lock.json to lock exact versions
- Add @react-router/dev and @react-router/fs-routes to root devDependencies
- Ensures packages are available in root node_modules for test symlinks
- Fixes CLI setup test that creates temporary directories
…2 compatibility

- Add .react-router to .gitignore (generated by React Router 7.8.2)
- Remove deprecated --ext flag from example lint scripts for ESLint 9 compatibility
- React Router 7.8.2 requires loaderData to be non-optional in UIMatch type
- Add loaderData property to fillMatch helper in seo.test.ts
- Upgrade TypeScript to 5.9.2 across all packages
- Fix enum compatibility between Storefront and Customer Account APIs
- Fix Navigation type mocks in hydrogen package tests
- Fix BodyInit type compatibility in cache implementation
… USDC currency (#3090)

* Fix Money component compatibility with Customer Account API USDC currency

The 2025-07 API update introduced USDC currency code to Customer Account API but not Storefront API, causing TypeScript errors and runtime failures.

Changes:
- Update Money component to accept MoneyV2 from both Storefront and Customer Account APIs via union types
- Enhance useMoney hook to detect unsupported currency codes (like USDC) and gracefully fall back to decimal formatting
- Add currency code suffix for unsupported currencies (e.g., "100.00 USDC") to maintain clarity
- Default to 2 decimal places for USDC to reinforce its 1:1 USD peg based on industry standards

Technical details:
- Handle Intl.NumberFormat RangeError for cryptocurrency codes not in ISO 4217
- Add comprehensive test coverage for both API types and USDC formatting
- Update TypeScript types to support both CurrencyCode enums

Fixes #3089

* Add changeset for Money component USDC compatibility fix

* Add build script to copy customer-account-api-types to dist

Since our Money component now imports from customer-account-api-types, we need to ensure this file is copied to the dist folder during the build process. Previously, only storefront-api-types was being copied.

- Replace copy-storefront-types with copy-api-types script that copies both API type files
- Update build and dev:demo scripts to use the new copy-api-types script
- This fixes the CI build failure where customer-account-api-types.d.ts was not found in dist

* Trigger CI rebuild
Add missing dependencies to useMemo hook to satisfy react-hooks/exhaustive-deps rule
Move params initialization inside useMemo to avoid recreating on every render
…te dependencies

This commit addresses critical TypeScript 5.9 compatibility issues that were blocking
the React Router 7.8.x migration. The changes ensure all CI checks pass with zero errors.

## Key Changes:

### ESLint TypeScript Compatibility
- Removed unused `eslint-plugin-hydrogen` package that was causing TypeScript version conflicts
- Updated `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` to v8.42.0
- Pinned all ESLint-related package versions for consistency and reproducibility

### Fixed Lint Errors Across Examples
- GTM example: Added missing `ready` and `subscribe` dependencies to useEffect hooks
- Partytown example: Added missing `location.pathname` dependency, fixed iframe accessibility
- Subscriptions example: Replaced deprecated @ts-ignore with @ts-expect-error directives
- Added missing iframe title attributes for accessibility compliance

### Build Configuration
- Added `dist/` to eslint ignores in skeleton template to prevent linting of built files
- Standardized ESLint configuration across all examples using flat config format
- Created eslint.config.js files for all examples to ensure consistent linting

### Dependencies
- Added `@total-typescript/ts-reset@0.6.1` at monorepo level (pinned version)
- Fixed duplicate import issue in hydrogen/src/seo/seo.ts

## Technical Details:

The root cause was eslint-plugin-hydrogen depending on an older version of
@typescript-eslint packages that don't support TypeScript 5.9. Since the plugin
wasn't actively used in the codebase, removing it was the cleanest solution.

All ESLint packages are now pinned to specific versions to prevent future
compatibility issues during dependency updates.

## Testing:
- ✅ All lint checks pass
- ✅ All typecheck passes
- ✅ No ESLint warnings about TypeScript version compatibility
- ✅ All examples build successfully
These files were added during development but should not be part of the final PR:
- Removed .github/pr-plans/ directory (planning documentation)
- Removed .changeset/ files added during development

These are internal development artifacts not needed for the React Router 7.8.x migration.
@juanpprieto juanpprieto changed the base branch from main to feat/pin-react-router-7.8.2 September 5, 2025 14:31
@shopify
Copy link
Contributor

shopify bot commented Sep 5, 2025

Oxygen deployed a preview of your feat/typescript-lint-rr-7.8 branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment September 12, 2025 6:45 AM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment September 12, 2025 6:45 AM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment September 12, 2025 6:45 AM
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment September 12, 2025 6:45 AM

Learn more about Hydrogen's GitHub integration.

@juanpprieto juanpprieto marked this pull request as ready for review September 5, 2025 15:30
@juanpprieto juanpprieto changed the title Feat/typescript lint rr 7.8 P0.5 - Typescript 5.9 and Lint for RR 7.8 Sep 5, 2025
Copy link
Contributor

@kdaviduik kdaviduik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small things but overall looking good!

- Remove CI_ISSUES_REPORT.md and PR1_STATUS.md files
- Restore deleted changeset file dry-swans-relate.md
- Improve comment for SellingPlanGroup type assertion
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset.
If the changes are user-facing and should cause a version bump, run npm run changeset add to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.

Base automatically changed from feat/pin-react-router-7.8.2 to main September 12, 2025 06:21
@juanpprieto juanpprieto requested a review from a team as a code owner September 12, 2025 06:21
- Accept main's React/React-DOM dependency additions in root package.json
- Include @remix-run/dev in CLI package dependencies
- Use main's 2025-07 GraphQL API schemas
- Keep USDC currency test in Money.test.tsx
- Update skeleton template to use Shopify CLI ~3.83.3
- Regenerate package-lock.json with resolved dependencies
@juanpprieto juanpprieto merged commit 5e769cf into main Sep 12, 2025
15 of 16 checks passed
@juanpprieto juanpprieto deleted the feat/typescript-lint-rr-7.8 branch September 12, 2025 06:50
juanpprieto added a commit that referenced this pull request Sep 17, 2025
* feat: pin React Router to exact version 7.8.2 across monorepo

- Pin react-router and react-router-dom to exact 7.8.2
- Pin @react-router/* packages to exact 7.8.2
- Remove version ranges (~, ^) to ensure consistency
- Update all packages, templates, and examples
- Update package-lock.json to lock exact versions

* fix: hoist @react-router/dev and fs-routes to fix CLI tests

- Add @react-router/dev and @react-router/fs-routes to root devDependencies
- Ensures packages are available in root node_modules for test symlinks
- Fixes CLI setup test that creates temporary directories

* fix: update .gitignore and example lint scripts for React Router 7.8.2 compatibility

- Add .react-router to .gitignore (generated by React Router 7.8.2)
- Remove deprecated --ext flag from example lint scripts for ESLint 9 compatibility

* fix: update UIMatch test helper for React Router 7.8.2 compatibility

- React Router 7.8.2 requires loaderData to be non-optional in UIMatch type
- Add loaderData property to fillMatch helper in seo.test.ts

* Lint and format

* Lint and format

* Add changeset

* fix: TypeScript 5.9 compatibility updates

- Upgrade TypeScript to 5.9.2 across all packages
- Fix enum compatibility between Storefront and Customer Account APIs
- Fix Navigation type mocks in hydrogen package tests
- Fix BodyInit type compatibility in cache implementation

* [2025-07] Fix Money component compatibility with Customer Account API USDC currency (#3090)

* Fix Money component compatibility with Customer Account API USDC currency

The 2025-07 API update introduced USDC currency code to Customer Account API but not Storefront API, causing TypeScript errors and runtime failures.

Changes:
- Update Money component to accept MoneyV2 from both Storefront and Customer Account APIs via union types
- Enhance useMoney hook to detect unsupported currency codes (like USDC) and gracefully fall back to decimal formatting
- Add currency code suffix for unsupported currencies (e.g., "100.00 USDC") to maintain clarity
- Default to 2 decimal places for USDC to reinforce its 1:1 USD peg based on industry standards

Technical details:
- Handle Intl.NumberFormat RangeError for cryptocurrency codes not in ISO 4217
- Add comprehensive test coverage for both API types and USDC formatting
- Update TypeScript types to support both CurrencyCode enums

Fixes #3089

* Add changeset for Money component USDC compatibility fix

* Add build script to copy customer-account-api-types to dist

Since our Money component now imports from customer-account-api-types, we need to ensure this file is copied to the dist folder during the build process. Previously, only storefront-api-types was being copied.

- Replace copy-storefront-types with copy-api-types script that copies both API type files
- Update build and dev:demo scripts to use the new copy-api-types script
- This fixes the CI build failure where customer-account-api-types.d.ts was not found in dist

* Trigger CI rebuild

* Suggested money changes for PR #3090 (#3097)

* fix: resolve eslint dependency issue in subscriptions example

Add missing dependencies to useMemo hook to satisfy react-hooks/exhaustive-deps rule

* fix: properly fix useMemo dependencies in subscriptions example

Move params initialization inside useMemo to avoid recreating on every render

* fix: resolve TypeScript 5.9 compatibility issues with ESLint and update dependencies

This commit addresses critical TypeScript 5.9 compatibility issues that were blocking
the React Router 7.8.x migration. The changes ensure all CI checks pass with zero errors.

## Key Changes:

### ESLint TypeScript Compatibility
- Removed unused `eslint-plugin-hydrogen` package that was causing TypeScript version conflicts
- Updated `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` to v8.42.0
- Pinned all ESLint-related package versions for consistency and reproducibility

### Fixed Lint Errors Across Examples
- GTM example: Added missing `ready` and `subscribe` dependencies to useEffect hooks
- Partytown example: Added missing `location.pathname` dependency, fixed iframe accessibility
- Subscriptions example: Replaced deprecated @ts-ignore with @ts-expect-error directives
- Added missing iframe title attributes for accessibility compliance

### Build Configuration
- Added `dist/` to eslint ignores in skeleton template to prevent linting of built files
- Standardized ESLint configuration across all examples using flat config format
- Created eslint.config.js files for all examples to ensure consistent linting

### Dependencies
- Added `@total-typescript/ts-reset@0.6.1` at monorepo level (pinned version)
- Fixed duplicate import issue in hydrogen/src/seo/seo.ts

## Technical Details:

The root cause was eslint-plugin-hydrogen depending on an older version of
@typescript-eslint packages that don't support TypeScript 5.9. Since the plugin
wasn't actively used in the codebase, removing it was the cleanest solution.

All ESLint packages are now pinned to specific versions to prevent future
compatibility issues during dependency updates.

## Testing:
- ✅ All lint checks pass
- ✅ All typecheck passes
- ✅ No ESLint warnings about TypeScript version compatibility
- ✅ All examples build successfully

* ci: trigger CI workflows

* chore: remove pr-plans and changeset files from migration branch

These files were added during development but should not be part of the final PR:
- Removed .github/pr-plans/ directory (planning documentation)
- Removed .changeset/ files added during development

These are internal development artifacts not needed for the React Router 7.8.x migration.

* fix: address PR review feedback

- Remove CI_ISSUES_REPORT.md and PR1_STATUS.md files
- Restore deleted changeset file dry-swans-relate.md
- Improve comment for SellingPlanGroup type assertion

---------

Co-authored-by: Kara Daviduik <105449131+kdaviduik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants