Repository navigation
chore(lint): gate correctness, suspicious, dead branches, and file size in packages - #8200
Merged
Merged
Conversation
Agents often write unsafe `as` casts, always-true conditions, and very large modules. The lint gate allowed all of them because the correctness and suspicious categories only warn. In packages/ source, every rule in the correctness and suspicious categories is now an error. An override cannot set a category, so the rules are listed by name, and a new test fails when an oxlint upgrade adds a rule that the list does not have. no-unnecessary-condition (dead branches) and max-lines (800 lines of code) are errors too. knip now also reports unused enum members and duplicate exports. The gate counts each duplicate group as one finding. Existing hits are in the baselines, so only new errors fail CI. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ushes The oxlint job now runs the gate's unit tests and the check that .oxlintrc.json lists every correctness and suspicious rule. Before this, no CI job ran the gate tests. Pushes to release lines such as 2.0.0 now run the workflow too, so a merge that breaks the gate shows up on the branch. Pull requests into release lines already ran it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
All 11 hits in packages/ are `for (const listener of [...listeners])`. The copy is on purpose: a listener can unsubscribe while the loop runs. The rule's fix would remove the copy and change behavior, so a gate on it would push code toward a bug. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Removes `output<void>()` type arguments that equal the default, an unnecessary ActivityRenderer type argument, and two unused type imports. Type-only. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
clearSuggestions and reloadSuggestions return void, so `void` in front of them does nothing. WeakSet<object> equals the default. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… arguments Removes imports and destructured names that nothing reads (licenseToken and isStreaming had no rest spread after them, and the hooks still run), and type arguments that equal the default. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Type-only. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ument No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Type-only. No runtime change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit removed its last import, an unused one. knip then reported the export as unused. No caller exists in the repo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AlemTuzlak
requested review from
jpr5,
mme,
rainerhahnekamp,
tylerslaton and
wolfmanfx
as code owners
November 4, 2026 13:03
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/markdown
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/runtime
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Contributor
|
Size Change: +8 B (0%) Total Size: 2.39 MB 📦 View Changed
ℹ️ View Unchanged
|
This was referenced Nov 4, 2026
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
) `CopilotChatInterrupt.test.tsx` fails on `2.0.0`: ``` Error: [vitest] No "Animated" export is defined on the "react-native" mock. ❯ TypingIndicator src/components/messages/TypingIndicator.tsx:24 ``` `TypingIndicator` creates `Animated.Value` refs at render time, and the shared mock in `packages/react-native/src/__mocks__/react-native.ts` has no `Animated` export. Any PR into `2.0.0` that affects `@copilotkit/react-native` fails `test / unit` (Node 20/22/24, React 19) because of it, including #8200 and #8201. This adds a no-op `Animated` (`Value`, `View`, `Text`, `timing`, `sequence`, `parallel`, `loop`, `delay`) to the shared mock. Tests that define their own `Animated` in `vi.mock` are unchanged. **Verified:** the test fails without the change with the error above. With it, `nx run @copilotkit/react-native:test` passes all 339 tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Next step for a maintainer: make the
oxlintandknipjobs of thestatic / qualityworkflow required checks for2.0.0. This PR does not change branch protection.The lint gate in
packages/source now fails on unsafeascasts, dead branches, files with more than 800 lines of code, and every other rule in the oxlintcorrectnessandsuspiciouscategories. Before this PR, those rules only gave warnings. Old hits are in the baselines, so only new errors fail CI.What does this PR do?
2.0.0already had most of PE-1069 from #8172: type-aware oxlint,no-explicit-any,no-swallowed-error, knip, and a baseline. This PR closes the remaining gaps:.oxlintrc.jsonlists all 186 rules by name. It sets them toerrorfor package source and back towarnfor tests. The newscripts/__tests__/lint-category-rules.test.tsfails when an oxlint upgrade adds a rule that the list does not have.typescript/no-unnecessary-conditionchanges fromwarntoerror.eslint/max-linesiserrorat 800 lines of code (blank lines and comments are not counted).duplicates(one value exported under two names) andenumMembers. The gate counts each duplicate group as one finding.oxlintjob runs the gate unit tests. No job ran them before. The workflow also runs on pushes to release lines such as2.0.0. PRs into2.0.0already ran it.voidoperators on calls that returnvoid, and one dead function (setRecallQuery).unicorn/no-useless-spreadis nowoff. All 11 of its hits arefor (const listener of [...listeners]). That copy is on purpose, because a listener can unsubscribe while the loop runs. Its fix would remove the copy and cause a bug.Baseline size per package
The baselines record counts of allowed errors for each rule and file. A count can only go down (
pnpm lint:prune).runtimereact-corecoreangulara2ui-rendererweb-inspectorchannels-corechannels-slackmarkdownsdk-jssharedchannels-teamschannels-discordvuechannels-intelligencereact-nativechannels-whatsapplearningweb-componentsmcp-apps-rendererchannels-uisqlite-runnerintelligence-langgraphintelligence-mastraagentcore-runnervoiceThe new oxlint entries by rule. The largest are:
no-unnecessary-condition(dead branches): 1,128no-unsafe-type-assertion: 952no-unnecessary-boolean-literal-compare: 181no-base-to-string: 91max-lines: 30 filesThe knip additions are 24
duplicatesand 1enumMembers. Most duplicates are React components exported both by name and asdefault. Old baseline entries did not change.Related PRs and Issues
Checklist
dev-docs/static-analysis.md,dev-docs/static-analysis-rules.md)!and the description has aBREAKING CHANGE:line. Not applicable: no breaking change.Testing
Commands run
pnpm lint: OK, 3,432 errors, all within the baseline. Run afterpnpm build.pnpm lint:dead-code: OK, 93 errors, all within the baseline.pnpm exec vitest run scripts/__tests__/lint-{gate,baseline,category-rules}.test.ts: 41 passed. I also removed one rule from the list by hand, and the drift test failed and named it.nx run-many -t check-typesfor the 8 packages with source changes: passed.nx affected -t lint,check-types,test --base=origin/2.0.0: 36 projects. 8 tasks failed. None of the failures come from this branch:react-native:test(CopilotChatInterrupt.test.tsx, anAnimatedmock error): the same failure occurs with theorigin/2.0.0source.react-core:test(2 chart tests): these pass alone, with both this branch and theorigin/2.0.0source. They fail only under parallel load.vue:lint: ESLint errors in files that this PR does not change, most of them in tests.runtime:test(an MCP integration test timed out after 5 s),genui-eval:test(@copilotkit/sharedwas being rebuilt at the same time),showcase-angular-host:test(Nx marked it flaky): this PR does not change these projects' source.next-pages-router:lint:next lintstops at an interactive prompt.react-native-demo:test: a Jest ESM setup error.Manual test
const x = value as unknown as string;to any file inpackages/core/src/.pnpm lint -- <that file>.no-unsafe-type-assertionand names the line.How this PR makes testing easy
scripts/__tests__/lint-category-rules.test.tskeeps the rule list in sync with oxlint.scripts/__tests__/lint-gate.test.tsnow covers the knipduplicatesandenumMembersshapes.Risk / rollback
packages/source now failsoxlint. Fix it, or add a disable comment with a reason. The fix table is indev-docs/static-analysis.md.no-unnecessary-conditionis in the oxlintnurserycategory. An oxlint upgrade can change its counts. If that happens, runpnpm lint:baselinein the upgrade PR.max-lines, the baseline holds one count per file. A file that is already over 800 lines can grow more without a failure.🤖 Generated with Claude Code