Skip to content

chore: dependency refresh + dedupe (INTER-2316)#202

Open
JuroUhlar wants to merge 8 commits into
inter-2315/eslint-upgradefrom
inter-2316/dependency-refresh-dedupe
Open

chore: dependency refresh + dedupe (INTER-2316)#202
JuroUhlar wants to merge 8 commits into
inter-2315/eslint-upgradefrom
inter-2316/dependency-refresh-dedupe

Conversation

@JuroUhlar

@JuroUhlar JuroUhlar commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator
  • pnpm update / pnpm update --latest across all workspaces: Vite 7→8, react-router 6→7, @testing-library/react 12→16, @types/node 20→26, etc.
  • pnpm dedupe to fix duplicated peer dependencies (re-ran after the --latest sweep since it reintroduced a few).
  • TypeScript bumped to 6.0.3, and moduleResolution migrated from the deprecated node to bundler (required for Vite 8's package exports to resolve).
  • Fixed the breakage the majors introduced: vite-plugin-dts's rollupTypesbundleTypes plus adding @microsoft/api-extractor as an explicit dev dependency, a floating-promise fix in the CRA example (react-router v7's navigate() is now async).
  • Replaced deprecated packages: husky installhusky script.
  • Dropped the vestigial target: es5 from tsconfig.json (this project is noEmit, so it did nothing except trip TS6's deprecation check) and the deprecated husky v8 shebang/husky.sh boilerplate from all three hooks.
  • Adopted a pnpm catalog: for react/react-dom/@types/react(-dom)/@types/node/typescript, shared by the root package and every example, instead of pinning each version separately (or, for create-react-app/webpack-based, an unconstrained peerDependencies: "*") — one definition, one deterministic resolved version everywhere.
  • Added a changeset for the one change touching the published package's dependency surface (@fingerprint/agent ^4.0.0→^4.1.2).

Discussion point: React 19 / Next 16 deliberately NOT included here

pnpm update --latest initially pulled React 19 and Next 16 into this branch, but that's INTER-2317's job (peer range, test matrix, README), not this dependency-refresh subtask's — so those are reverted back to React 18 / Next 14.2.35. Verified this doesn't cascade: Next 16 itself accepts React 18.2+, and react-router-dom@7/@testing-library/react@16 both accept React 18 too.

Discussion point: TypeScript pinned to 6.0.x, not latest (7.0.2)

typescript-eslint@8.64.0 (latest, including canary) caps its typescript peer range at <6.1.0, so bumping to TS 7 would break the lint type-check layer. The catalog pins ~6.0.3 (not ^6.0.3) specifically to keep a future patch/minor bump from silently crossing that 6.1.0 line.

Test plan

  • pnpm build
  • pnpm lint
  • pnpm test run
  • pnpm test:coverage
  • pnpm dedupe --check clean

Sweep all workspace dependencies to latest (React 19, Vite 8,
react-router 7, Next.js 16, TypeScript 6.0.3, etc.), dedupe peer
dependencies, and fix the breakage the majors introduced.
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
82.84% (-0.13% 🔻)
111/134
🟡 Branches
67.57% (-0.85% 🔻)
50/74
🟢 Functions 80.95% 34/42
🟢 Lines 82.31% 107/130
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 env.types.ts
83.33% (-2.38% 🔻)
0% (-40% 🔻)
50% 83.33%

Test suite run success

22 tests passing in 15 suites.

Report generated by 🧪jest coverage report action from 69fd61b

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟢 All files 82.83 67.56 80.95 82.3
🟢  src 88.52 74.07 83.33 88.33
🟢   detect-env.ts 90 83.33 100 90 15,87
🟢   env.ts 100 100 100 100
🟢   env.types.ts 83.33 0 50 83.33 14
🟡   ...nt-context.ts 75 100 0 75 8
🟡   get-env.ts 60 0 100 60 8-9
🟢   ssr.ts 100 100 100 100
🟢   ...sitor-data.ts 95.65 100 80 95.65 102
🟢  src/components 91.66 58.33 91.66 91.17
🟢   ...-provider.tsx 90.32 54.54 90.9 89.65 47,52,85
🟢   ...vironment.tsx 100 100 100 100
🟡  src/utils 64.86 69.56 66.66 63.88
🟡   ...is-defined.ts 50 75 100 50 3
🟡   to-error.ts 66.66 50 100 66.66 6
🟢   ...mise-store.ts 91.3 92.3 100 90.9 20,26
🔴   wait-until.ts 0 0 0 0 8-19

@JuroUhlar JuroUhlar changed the base branch from main to inter-2315/eslint-upgrade July 16, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refreshes and deduplicates dependencies across the workspace (major bumps like React 19, Vite 8, react-router 7, Next 16, TS 6), and applies the necessary code/config updates to keep the library, linting, builds, tests, and examples working.

Changes:

  • Updated core tooling and ecosystem dependencies (React/Vite/Next/react-router/TypeScript) and added an @fingerprint/agent changeset for the published surface change.
  • Migrated ESLint to flat config with type-aware linting via a dedicated tsconfig.eslint.json.
  • Adjusted SDK internals and examples/tests for new typings and behavior (React 19 refs, async navigate(), stricter null/undefined handling, request dedupe keying).

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vite.config.ts Updates Vite DTS plugin option (bundleTypes) and minor banner/license string tweak.
tsconfig.json Moves moduleResolution to bundler, adds ignoreDeprecations, and includes __tests__.
tsconfig.eslint.json Adds dedicated TS project for type-aware ESLint across src/tests/config/examples.
src/utils/use-promise-store.ts Improves request dedupe cache key stability and replaces useConst with useState initializer.
src/utils/use-const.ts Removes now-unused useConst helper.
src/utils/assert-is-truthy.ts Removes old truthiness assert helper.
src/utils/assert-is-defined.ts Adds explicit defined-ness assert (null/undefined only).
src/use-visitor-data.ts Swaps to assertIsDefined and tweaks mount error logging + lint suppression comment.
src/get-env.ts Tightens JSON.parse typing to unknown before type guard.
src/detect-env.ts Tightens env check strategies to return boolean and makes DOM checks explicit.
src/components/with-environment.tsx Changes API to render-prop child function and removes cloneElement usage.
src/components/fingerprint-provider.tsx Adapts provider to new WithEnvironment API; React 19 ref typing and minor logic cleanup.
scripts/detect-env.js Adds ESLint disable for CommonJS require usage under TS ESLint rules.
pnpm-workspace.yaml Allows building sharp in the workspace build allowlist.
package.json Refreshes deps and scripts; updates lint/prepare and bumps @fingerprint/agent dependency.
examples/webpack-based/webpack.config.js Adds ESLint disable for require usage.
examples/webpack-based/package.json Dependency refresh and adds a lint script.
examples/vite/src/vite-env.d.ts Adds explicit Vite env typing for required public API key.
examples/vite/src/main.tsx Adds runtime checks for env var + root element; import path normalization.
examples/vite/package.json Updates dependencies/tooling and aligns lint script with max-warnings=0.
examples/vite/eslint.config.js Removes per-example flat ESLint config (root config now used).
examples/preact/src/index.tsx Adds runtime check for required env var instead of as string cast.
examples/preact/src/components/app.tsx Fixes floating promise by explicitly discarding getData() promise.
examples/preact/preact.config.js Removes now-unneeded eslint suppression comment.
examples/preact/package.json Refreshes deps, removes peerDeps block, adds TS dev dep, aligns lint script.
examples/preact/.eslintrc.js Removes legacy ESLint config (root flat config now used).
examples/next/pages/_app.tsx Adds env var getter with runtime validation.
examples/next/package.json Updates Next version and switches lint script to root ESLint invocation.
examples/next-appDir/package.json Updates Next version and switches lint script to root ESLint invocation.
examples/next-appDir/app/page.tsx Removes unnecessary async from page component.
examples/next-appDir/app/layout.tsx Adds env var getter with runtime validation.
examples/next-appDir/app/HomePage.tsx Fixes floating promise by explicitly discarding getData({}) promise.
examples/create-react-app/src/shared/pages/SignInPage.tsx Adjusts promise handling + reformats handlers for stricter linting.
examples/create-react-app/src/shared/pages/HomePage.tsx Reformats handler to satisfy stricter linting.
examples/create-react-app/src/shared/components/VisitorDataPresenter.tsx Makes boolean/data checks explicit for stricter types.
examples/create-react-app/src/shared/components/Toggler.tsx Tightens PropsWithChildren generic and reformats handler.
examples/create-react-app/src/index.tsx Adds runtime check for root element instead of non-null assertion.
examples/create-react-app/src/App.tsx Fixes floating promise for async navigate() (react-router v7).
examples/create-react-app/package.json Bumps react-router and adds lint script.
eslint.config.mjs Introduces root flat ESLint config with type-aware project and React 19 rule adjustments.
.eslintrc.js Removes legacy ESLint config.
.changeset/dependency-refresh-dedupe.md Adds changeset for @fingerprint/agent dependency bump.
tests/with-environment.test.tsx Updates tests to new WithEnvironment render-prop API and modern testing-library patterns.
tests/with-environment.preact.test.tsx Updates Preact test to new WithEnvironment API and improves typing annotations.
tests/use-visitor-data.test.tsx Adds coverage for dedupe key differences and updates user interactions to userEvent.setup().
tests/helpers.tsx Tightens wrapper typing and makes wait() return type explicit.
tests/fpjs-provider.test.tsx Removes unnecessary async from a test now that it’s synchronous.
Comments suppressed due to low confidence (1)

package.json:37

  • The root lint script runs eslint without an explicit target path. In this repo, the example packages use eslint . --max-warnings 0; using the explicit . at the root too avoids any ESLint version/config differences where running with no paths can lint nothing or error.
    "watch": "vite build --watch",
    "build": "vite build",
    "lint": "eslint --max-warnings 0",
    "lint:fix": "pnpm lint --fix",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

tsc errors with TS5112 when a tsconfig.json is present in cwd and a
file is also given on the command line. Latent pre-existing issue
that started failing CI once TypeScript moved past 5.x's lenient
handling of this case.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated no new comments.

target: es5 was inconsistent with lib: esnext, and since this
tsconfig is noEmit-only (Vite/esbuild does the actual transpilation
targeting its own modern baseline), it did nothing except trip
TypeScript 6's target=ES5 deprecation warning. Bumping to es2020
lets ignoreDeprecations be dropped entirely.
husky v9's runner already invokes hooks via `sh -e`, ignoring any
shebang, and no longer needs the `_/husky.sh` sourcing line. Both
warn on every hook run and will hard-fail in husky v10.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.

Comment thread .husky/pre-push
Comment thread .husky/pre-commit
Comment thread .husky/commit-msg Outdated
Avoids word-splitting if the commit message file path ever contains
spaces.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 1 comment.

Comment thread .husky/pre-commit
@JuroUhlar JuroUhlar marked this pull request as ready for review July 16, 2026 14:38
React 19 and Next 16 support is INTER-2317's job (peer range, test
matrix, and README claims), not this dependency-refresh subtask's.
Neither is a transitive requirement of anything else bumped here:
Next 16's own peer range accepts React 18.2+, react-router-dom@7 and
@testing-library/react@16 both accept React 18 too, so reverting
React/Next specifically doesn't cascade into any other package.

Also drops the two @eslint-react rule overrides added for the React
19 bump - they only fire against a detected React 19 install, so
they're inert (and therefore misleading) now that dev tooling is
back on React 18.
react, react-dom, @types/react(-dom), @types/node, and typescript
were duplicated across the root package and every example, each
pinned separately. Bumping them meant editing 5+ files, and the two
examples that instead used peerDependencies: "*" to avoid that
duplication carried a real risk: an ambiguous, hoisted-from-wherever
version can diverge from what the shared type-checked ESLint project
resolves elsewhere, causing exactly the duplicate-@types/react
mismatch this session's editor diagnostics surfaced.

Catalogs give both properties at once: one definition in
pnpm-workspace.yaml, and every consumer resolves the same concrete,
deterministic version via "catalog:". create-react-app and
webpack-based moved off their peerDependencies "*" declarations onto
the same explicit catalog references as every other example.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 5 comments.

Comment thread pnpm-workspace.yaml Outdated
Comment thread pnpm-workspace.yaml
Comment thread pnpm-workspace.yaml
Comment thread examples/next/package.json
Comment thread examples/next-appDir/package.json
^6.0.3 could float to 6.1.0+, silently breaking typescript-eslint's
<6.1.0 peer constraint. Narrowed to ~6.0.3. Also documented why sharp
needs allowBuilds (Next.js's image optimization native dep).
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

@fingerprint/react@3.0.1

Patch Changes

  • Bump @fingerprint/agent dependency to ^4.1.2 (87b776f)

@JuroUhlar JuroUhlar requested a review from Copilot July 16, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated no new comments.

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.

2 participants