chore: upgrade ESLint to flat config with dx-team v3#201
Open
JuroUhlar wants to merge 5 commits into
Open
Conversation
Contributor
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success22 tests passing in 15 suites. Report generated by 🧪jest coverage report action from eb3a7a7 Show full coverage report
|
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the repo to ESLint 10 flat config using @fingerprintjs/eslint-config-dx-team v3 type-checked rules, updates lint scripts (root + examples), and applies targeted code/test adjustments to satisfy stricter linting without broader behavior refactors.
Changes:
- Add root
eslint.config.mjs(flat config) plustsconfig.eslint.json; simplify rootlintscript and restore per-examplelintscripts. - Update internal
WithEnvironmentto a render-prop API and adjustFingerprintProvider+ related tests accordingly. - Apply small source/example/test tweaks to satisfy new TS/ESLint constraints (env detection typing, safer runtime checks, promise handling, etc.).
Reviewed changes
Copilot reviewed 42 out of 45 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds TS error suppressions for banner plugins; keeps DTS generation; minor banner string tweak. |
| tsconfig.json | Expands TS include to cover tests. |
| tsconfig.eslint.json | Adds a dedicated TS project for type-aware ESLint across src/tests/examples/config files. |
| src/utils/use-promise-store.ts | Reworks cache key serialization and store initialization approach. |
| src/utils/use-const.ts | Removes useConst utility (no longer used). |
| src/utils/assert-is-truthy.ts | Removes truthy assertion helper. |
| src/utils/assert-is-defined.ts | Adds null/undefined-only assertion helper. |
| src/use-visitor-data.ts | Switches to assertIsDefined; adds targeted lint disable for mount fetch behavior; minor error logging typing. |
| src/get-env.ts | Tightens JSON.parse typing to unknown. |
| src/detect-env.ts | Tightens env-check strategy typing to boolean and adjusts DOM/window checks. |
| src/components/with-environment.tsx | Changes WithEnvironment from cloneElement to render-prop children API. |
| src/components/fingerprint-provider.tsx | Adapts provider to new WithEnvironment API; minor refactors/strictness tweaks. |
| scripts/detect-env.js | Disables @typescript-eslint/no-require-imports for CJS usage. |
| package.json | Upgrades ESLint + related tooling deps; simplifies lint script. |
| examples/webpack-based/webpack.config.js | Disables @typescript-eslint/no-require-imports for CJS usage. |
| examples/webpack-based/package.json | Adds an example-local lint script. |
| examples/vite/src/vite-env.d.ts | Adds Vite env typing for the example. |
| examples/vite/src/main.tsx | Adds runtime checks for required env var and root element; fixes import style. |
| examples/vite/package.json | Restores local lint script; relies on root lint toolchain. |
| examples/vite/eslint.config.js | Removes per-example flat config (now covered by root config). |
| examples/preact/src/index.tsx | Adds runtime checks for required env var. |
| examples/preact/src/components/app.tsx | Marks getData() call as intentionally un-awaited (void). |
| examples/preact/preact.config.js | Keeps dotenv-based injection in Preact config. |
| examples/preact/package.json | Adjusts lint script and dependencies for Preact example. |
| examples/preact/.eslintrc.js | Removes legacy ESLint config (now covered by root flat config). |
| examples/next/pages/_app.tsx | Adds explicit env var getter/validation. |
| examples/next/package.json | Switches lint to root ESLint; adjusts dependency placement for a private example. |
| examples/next-appDir/package.json | Switches lint to root ESLint; adjusts dependency placement for a private example. |
| examples/next-appDir/app/page.tsx | Removes unnecessary async on page component. |
| examples/next-appDir/app/layout.tsx | Adds explicit env var getter/validation. |
| examples/next-appDir/app/HomePage.tsx | Marks getData({}) as intentionally un-awaited (void). |
| examples/create-react-app/src/shared/pages/SignInPage.tsx | Updates handlers to satisfy stricter linting; simplifies logging of visitor data. |
| examples/create-react-app/src/shared/pages/HomePage.tsx | Wraps callback bodies to satisfy linting. |
| examples/create-react-app/src/shared/components/VisitorDataPresenter.tsx | Tightens boolean/undefined checks in rendering logic. |
| examples/create-react-app/src/shared/components/Toggler.tsx | Updates props typing and wraps callback body to satisfy linting. |
| examples/create-react-app/src/index.tsx | Adds runtime check for root element presence. |
| examples/create-react-app/package.json | Adds an example-local lint script. |
| eslint.config.mjs | New root flat ESLint config wiring dx-team + react + hooks + type-aware parsing. |
| .eslintrc.js | Removes legacy ESLint config (replaced by flat config). |
| tests/with-environment.test.tsx | Updates tests to match render-prop WithEnvironment API and modern testing-library patterns. |
| tests/with-environment.preact.test.tsx | Updates Preact test usage to pass render-prop children. |
| tests/use-visitor-data.test.tsx | Updates tests to use screen/userEvent patterns and satisfy stricter lint rules. |
| tests/helpers.tsx | Adjusts typing and wait promise typing to satisfy stricter rules. |
| tests/fpjs-provider.test.tsx | Removes unnecessary async in test case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
Migrate to ESLint 10 and type-checked flat config. Lint examples from the root and apply minimal source/test fixes.
Exclude preact and example vite configs from type-checked lint. Fix the vite example import path.
60426e1 to
eb3a7a7
Compare
Contributor
pnpm exec changesetto create a changeset. |
JuroUhlar
added a commit
that referenced
this pull request
Jul 16, 2026
…ter-2222 Fold PR #201 into this branch and keep the unique useVisitorData refactor.
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.
@fingerprintjs/eslint-config-dx-teamv3 type-checked ruleslintscriptsuseVisitorDatabehavior refactor)Merge plan
We will merge this PR first, then apply additional improvements from #199 on top (notably the
useVisitorDatarefactor and related test coverage).Discussion point:
WithEnvironmentrender-prop APIWithEnvironmentnow takeschildren: (env) => JSX.Elementinstead of cloning a single child. It is internal-only (not exported from the package entry), but flag if you prefer keeping the oldcloneElementshape.Discussion point:
use-visitor-datamount fetchKept existing mount
getData()behavior with a targetedreact-hooks/set-state-in-effectdisable and TODO rather than refactoring the hook in this PR.Note: banner plugin types
vite.config.tsuses@ts-expect-errorforrollup-plugin-banner2andvite-plugin-banner— unmaintained plugins with stale Rollup 4 types, but still required for correct dist output.Test plan
pnpm lintpnpm test --runpnpm build(license banner +"use client"in dist)