-
Notifications
You must be signed in to change notification settings - Fork 3
chore: lint cleanup and dead code removal #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove unused imports, variables, and functions (redisRest._executeCommand, users._userDoc, files unused types) - Standardize import ordering: external packages first, then internal - Separate type-only imports from value imports - Convert Type[] to Array<Type> syntax consistently - Add eslint ignores for build output directories - Remove unnecessary eslint-disable comments - Remove redundant optional chaining where values are guaranteed - Fix variable shadowing (open→isDialogOpen, percentage→clickPercentage, index→partIndex, error→parsedError) - Fix SidebarProvider useEffect to avoid stale conditional initialization - Use function property syntax for interface methods (SpeechRecognition)
|
🚅 Deployed to the openchat-pr-553 environment in OpenChat
|
Greptile SummaryThis PR cleans up lint warnings by standardizing import ordering, converting Critical Issues Found:
Changes Made:
Recommendations:
Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Lint as Linter/Formatter
participant Code as Codebase
participant Tests as Type Check & Build
Dev->>Lint: Run oxlint + check-types
Lint->>Code: Identify issues (imports, array syntax, dead code)
Note over Code: Import Reordering
Code->>Code: Move external imports before internal
Code->>Code: Separate type-only imports
Note over Code: Syntax Standardization
Code->>Code: Convert Type[] to Array<Type>
Code->>Code: Fix variable shadowing
Code->>Code: Remove unnecessary optional chaining
Note over Code: Dead Code Removal
Code->>Code: Remove unused _executeCommand function
Code->>Code: Remove unused _userDoc validator
Code->>Code: Remove unused type imports
Note over Code: Bug Introduced ⚠️
Code->>Code: Remove webkitSpeechRecognition fallback
Code->>Code: Change sidebar initialization logic
Dev->>Tests: Run bun check-types && bun check
Tests-->>Dev: ✅ All checks pass
Note over Tests,Dev: Type checks pass, but runtime bugs<br/>not caught by static analysis
Dev->>Code: Create PR
Code->>Tests: Vite build succeeds
Note right of Code: Speech recognition broken<br/>in Safari browsers
Note right of Code: User preferences reset<br/>on every mount
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
50 files reviewed, 3 comments
| ("SpeechRecognition" in window || "webkitSpeechRecognition" in window) | ||
| ) { | ||
| const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; | ||
| const SpeechRecognition = window.SpeechRecognition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Broke webkitSpeechRecognition fallback. The conditional at line 1120 checks for both SpeechRecognition OR webkitSpeechRecognition, but this line assumes window.SpeechRecognition always exists, breaking Safari/older browsers.
| const SpeechRecognition = window.SpeechRecognition; | |
| const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; |
| wasStreamingRef.current = true; | ||
| hasAutoCollapsedRef.current = false; | ||
| } else if ( | ||
| wasStreamingRef.current && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Removed !isStreaming check creates redundant condition. Line 360-365 already handles the isStreaming === true case, so the else-if at line 366 will only execute when isStreaming === false. The explicit !isStreaming check was not redundant—it made the logic clearer.
| wasStreamingRef.current && | |
| } else if ( | |
| wasStreamingRef.current && | |
| !isStreaming && | |
| hasTextContent && | |
| !hasAutoCollapsedRef.current | |
| ) { |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| setSidebarOpen(defaultOpen); | ||
| setSidebarCollapsed(defaultCollapsed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Changed initialization to always override store state on every render. The old code only set defaults when store was undefined, preserving user's saved state. The new code resets to defaults every time the component mounts, ignoring persisted user preferences.
| setSidebarOpen(defaultOpen); | |
| setSidebarCollapsed(defaultCollapsed); | |
| if (sidebarOpen === undefined) { | |
| setSidebarOpen(defaultOpen); | |
| } | |
| if (sidebarCollapsed === undefined) { | |
| setSidebarCollapsed(defaultCollapsed); | |
| } |
…ing guard, and sidebar init
Summary
Type[]toArray<Type>syntax consistently per linter preferenceScope
Changes
Dead Code Removal
apps/server/convex/lib/redisRest.ts: Remove unused_executeCommandfunctionapps/server/convex/users.ts: Remove unused_userDocvalidatorapps/server/convex/files.ts: Remove unused type importsLint Fixes
import type { Foo })Type[]→Array<Type>open→isDialogOpen,percentage→clickPercentage,index→partIndex,error→parsedError?.optional chaining where values are guaranteed.output/,dist/,.vinxi/,*.config.jsBug Fixes (minor)
SidebarProvider: Fixed stale conditional initialization in useEffectPromptInputSpeechButton: Fixed fallback towebkitSpeechRecognition(was redundant after type guard)Testing
bun check-typespassesbun check(oxlint) passesvite buildsucceeds