chore: dependency refresh + dedupe (INTER-2316)#202
Open
JuroUhlar wants to merge 8 commits into
Open
Conversation
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.
Contributor
Coverage report
Show files with reduced coverage 🔻
Test suite run success22 tests passing in 15 suites. Report generated by 🧪jest coverage report action from 69fd61b Show full coverage report
|
Contributor
There was a problem hiding this comment.
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/agentchangeset 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
lintscript runseslintwithout an explicit target path. In this repo, the example packages useeslint . --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.
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.
Avoids word-splitting if the commit message file path ever contains spaces.
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.
^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).
Contributor
🚀 Following releases will be created using changesets from this PR:@fingerprint/react@3.0.1Patch Changes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pnpm update/pnpm update --latestacross all workspaces: Vite 7→8, react-router 6→7, @testing-library/react 12→16,@types/node20→26, etc.pnpm dedupeto fix duplicated peer dependencies (re-ran after the--latestsweep since it reintroduced a few).6.0.3, andmoduleResolutionmigrated from the deprecatednodetobundler(required for Vite 8's package exports to resolve).vite-plugin-dts'srollupTypes→bundleTypesplus adding@microsoft/api-extractoras an explicit dev dependency, a floating-promise fix in the CRA example (react-routerv7'snavigate()is now async).husky install→huskyscript.target: es5fromtsconfig.json(this project isnoEmit, so it did nothing except trip TS6's deprecation check) and the deprecated husky v8 shebang/husky.shboilerplate from all three hooks.catalog:forreact/react-dom/@types/react(-dom)/@types/node/typescript, shared by the root package and every example, instead of pinning each version separately (or, forcreate-react-app/webpack-based, an unconstrainedpeerDependencies: "*") — one definition, one deterministic resolved version everywhere.@fingerprint/agent^4.0.0→^4.1.2).Discussion point: React 19 / Next 16 deliberately NOT included here
pnpm update --latestinitially 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+, andreact-router-dom@7/@testing-library/react@16both 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 itstypescriptpeer 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 that6.1.0line.Test plan
pnpm buildpnpm lintpnpm test runpnpm test:coveragepnpm dedupe --checkclean