chore(KNO-14398): adopt the oxc toolchain (oxlint + oxfmt) and TypeScript 7 for packages#1047
Conversation
Replace ESLint with oxlint and Prettier with oxfmt across the published packages, and type-check them with TypeScript 7 (installed as the `typescript-7` alias). This removes the @typescript-eslint dependency on the old TypeScript JS API from the packages' lint path. - Add root .oxlintrc.json (mirrors the prior eslint-config coverage) and .oxfmtrc.json (reproduces the prettier-config settings). - Point each package's lint/format/type:check at oxlint/oxfmt/TS7; remove per-package .eslintrc.js and the eslint/prettier devDependencies. - Keep TypeScript 5.x for builds (vite-plugin-dts). - Example apps are unchanged and still run ESLint/Prettier (follow-up).
- react: stop passing children to the void <img> in the guide Modal/Card image components (invalid and ignored at runtime). - client: type KnockGuideActivationUrlPattern.pattern against the urlpattern-polyfill URLPattern it is constructed from, and add an explicit @types/node reference for the build-time process.env version string (TS7 no longer auto-includes ambient @types). - client: drop a redundant parameter-property assignment in Feed.
🦋 Changeset detectedLatest commit: 9e5fdd6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bundle ReportChanges will decrease total bundle size by 93 bytes (-0.02%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @knocklabs/react-react-esmAssets Changed:
Files in
Files in
view changes for bundle: @knocklabs/client-client-cjsAssets Changed:
Files in
view changes for bundle: @knocklabs/client-client-esmAssets Changed:
Files in
view changes for bundle: @knocklabs/react-react-cjsAssets Changed:
Files in
Files in
|
The guide Modal/Card `Img` components rewritten in this PR had no test, so the changed lines showed up as uncovered (codecov patch/project). Add direct render tests for `CardView.Img` / `ModalView.Img` that assert a void `<img>` with the right alt/class and no children (regression guard for the fix), and exclude the dev-only `App.tsx` playground (`yarn dev:local`, not exported/shipped) from coverage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1047 +/- ##
==========================================
+ Coverage 66.58% 66.90% +0.32%
==========================================
Files 214 213 -1
Lines 10514 10489 -25
Branches 1529 1532 +3
==========================================
+ Hits 7001 7018 +17
+ Misses 3487 3446 -41
+ Partials 26 25 -1
|
Description
Mirrors the toolchain migration done in
control(#10453 / #10455 / #10458, KNO-14365/14366/14367) for the@knocklabs/*published packages: ESLint → oxlint, Prettier → oxfmt, and TypeScript 7 for type-checking. The driver, proven in control, is that oxlint removes the@typescript-eslintdependency on the old TypeScript JS API — the coupling that blocks moving type-checking to TS7.What changed
.oxlintrc.jsonmirrors the previous@knocklabs/eslint-config/library.jscoverage (typescript+react+react-hooks+jsx-a11y,correctnessas errors, the^_unused-vars ignore). Each package'slintrunsoxlint --max-warnings=0; per-package.eslintrc.jsand theeslint/@typescript-eslint/eslint-plugin-*devDependencies are removed.jsx-a11y/prefer-tag-over-roleis turned off to match the prior config (parity with control)..oxfmtrc.jsonreproduces@knocklabs/prettier-config(printWidth 80, double quotes, trailing commas, the same import grouping). Each package'sformat/format:checkrunsoxfmt;prettier+@trivago/prettier-plugin-sort-importsremoved. The reformat was tiny (9 files) since the repo was already on Prettier 3.typescript-7(npm:typescript@7.0.2) alongsidetypescript@5.x, which is kept for the build (vite-plugin-dtsuses the JS compiler API that TS7 drops). Each package'stype:checkinvokes the aliased binary by path (node ../../node_modules/typescript-7/bin/tsc --noEmit), since thetscbin name collides with the 5.x we keep.Correctness issues surfaced by oxlint (separate
fixcommit + changeset)@knocklabs/react: the guideModal/Cardimage components no longer passchildrento a void<img>(invalid, ignored at runtime).@knocklabs/client:KnockGuideActivationUrlPattern.patternis typed against theurlpattern-polyfillURLPatternit's constructed from — TS7's newer DOM lib addedhasRegExpGroupsto the global. Also adds an explicit@types/nodereference for the build-timeprocess.envversion string (TS7 no longer auto-includes ambient@types), and drops a redundantFeedparameter-property assignment.Scope / follow-ups
next lint/expo lintconfigs tolerated. Tracked as a follow-up.@knocklabs/eslint-configand@knocklabs/prettier-configare retained (the examples still consume them); deprecating them follows once the examples move.Verification — all green locally:
yarn type:check(TS7, 6/6) ·yarn lint(oxlint + examples' eslint, 13/13) ·yarn format:check(12/12) ·yarn build:packages(5/5) ·yarn test(1007 tests).Todos
@knocklabs/eslint-config/@knocklabs/prettier-config).Checklist