Skip to content

[codex] clean up mechanical lint debt#35

Merged
tianzhou merged 2 commits into
mainfrom
chore/hygiene-pass
Jun 26, 2026
Merged

[codex] clean up mechanical lint debt#35
tianzhou merged 2 commits into
mainfrom
chore/hygiene-pass

Conversation

@tianzhou

Copy link
Copy Markdown
Contributor

Summary

  • Remove dead variables and unused parameters from server, SQL autocomplete, SQL formatting, and UI code.
  • Tighten a few obvious loose types, including the connection cache client, gutter icon typing, and GROUP BY formatting inputs.
  • Clear mechanical lint classes (no-unused-vars, prefer-const, no-empty, no-explicit-any, no-fallthrough) without taking on the React hooks/compiler or fast-refresh cleanup bucket.

Notes

This is intentionally a mechanical hygiene pass. The remaining repo-wide lint failures are concentrated in React hooks/compiler, fast-refresh, and one existing control-regex warning; those are left for the next cleanup pass.

Validation

  • git diff --check
  • pnpm exec eslint <18 touched files>
  • pnpm exec eslint . -f json summary: errors=41 warnings=35, with no leftovers in the targeted mechanical rule set
  • pnpm test tests/audit.test.ts tests/mcp.test.ts tests/sql-format tests/sql-autocomplete (10 files, 387 tests passed)
  • pnpm build (passes; existing Vite/Rolldown warnings remain for browser externalization, mixed static/dynamic SQL import, protobuf direct eval, and chunk size)

Copilot AI review requested due to automatic review settings June 26, 2026 09:00
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pgconsole Ready Ready Preview, Comment Jun 26, 2026 9:52am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Mechanical lint-debt/hygiene pass across the website UI, SQL formatting/autocomplete utilities, and server helpers. The changes primarily remove unused variables/parameters, tighten a few obvious types, and make small className/prop-handling adjustments without altering broader behavior.

Changes:

  • Replaced a few let declarations with const and removed unused variables/parameters to clear targeted eslint rule classes.
  • Tightened typing in SQL formatting (GROUP BY grouping sets) and server connection cache client usage.
  • Made small UI prop/className composition fixes (e.g., allowing className to be applied in shared UI components) and made getProviders() return a safe default on error.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
website/src/components/sections/stats-with-graph.tsx prefer-const cleanup for useId() result.
website/src/components/sections/faqs-two-column-accordion.tsx prefer-const cleanup for useId() result.
website/src/components/sections/faqs-accordion.tsx prefer-const cleanup for useId() result.
src/lib/sql/format.ts Adds GroupingSet typing and a type guard to remove any from GROUP BY formatting.
src/lib/sql/core.ts Removes an unused parameter from extractExprSource and updates callsite.
src/lib/sql/autocomplete/section-detector.ts Removes unused cursorPosition parameter from isExpectingAlias.
src/lib/sql/autocomplete/scope-analyzer.ts Removes unused sql/schema parameters from internal helpers/merge function.
src/lib/sql/autocomplete/candidate-generator.ts Removes unused context parameter from FROM-candidate generation.
src/lib/auth-client.ts Ensures provider lookup returns [] on error (no empty catch).
src/components/ui/sheet.tsx Ensures className is applied to the Sheet viewport container.
src/components/ui/command.tsx Switches to cn() composition so className can be extended.
src/components/sql-editor/pg-autocomplete.ts Removes unused parameter from retrigger wrapper helper.
src/components/sql-editor/ObjectTree.tsx Adjusts props destructuring/spread in ObjectTree.
src/components/Gutter.tsx Tightens icon typing to LucideIcon and removes now-unneeded React ComponentType import.
server/services/query-service.ts prefer-const cleanup and removes unused variable in dependency scan loop.
server/lib/schema-cache.ts Avoids unused key by iterating over schemaMap.values().
server/lib/connection-cache.ts Replaces any client type with ReturnType<typeof createClient>.
server/index.ts Removes unused global __GIT_COMMIT__ declaration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/sql-editor/ObjectTree.tsx Outdated
@tianzhou tianzhou marked this pull request as ready for review June 26, 2026 09:18
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown

Greptile Summary

Mechanical lint hygiene pass across 18 files targeting no-unused-vars, prefer-const, no-empty, no-explicit-any, and no-fallthrough — with no changes to business logic or test coverage. Two changes go slightly beyond pure lint: CommandPanel and SheetViewport now correctly forward their className prop via cn() instead of silently dropping it.

  • Dead variables & unused parameters removed across server, SQL autocomplete, SQL formatting, and UI code — including __GIT_COMMIT__, definitionLower, and several _prefixed stub parameters in the autocomplete pipeline.
  • Type safety tightened in three places: the connection-cache client (anyReturnType<typeof createClient>), gutter icons (ComponentType<any>LucideIcon), and formatGroupByItem (anyExpr | GroupingSet with a proper isGroupingSet type guard whose discriminant values do not overlap with any Expr variant).
  • className forwarding fixed in CommandPanel and SheetViewport — both components destructured className from props but never used it, meaning callers could not customise styling; this is corrected by merging with cn().

Confidence Score: 5/5

Safe to merge — every change is either a dead-code removal, a letconst tightening, or an any→typed narrowing, with two incidental className forwarding fixes in UI components.

All 18 files make exclusively additive or subtractive hygiene changes. The most complex change — the isGroupingSet type guard in format.ts — is provably correct because none of the Expr discriminant values ('column', 'literal', 'func', 'binary', 'unary', 'sublink', 'case', etc.) overlap with GroupingSet.kind ('rollup', 'cube', 'sets', 'empty'). The PR passes its full test suite (387 tests) and a clean build.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/sql/format.ts Introduces isGroupingSet type guard and tightens formatGroupByItem from any to `Expr
src/components/ui/command.tsx Fixes CommandPanel silently dropping the className prop — it was destructured but never forwarded; now merged with cn().
src/components/ui/sheet.tsx Fixes SheetViewport silently dropping className; same pattern as command.tsx.
server/lib/connection-cache.ts Replaces any client type with ReturnType<typeof createClient> from ./db; type-only import, no runtime change.
src/lib/auth-client.ts Replaces empty catch {} with explicit return [], matching the fallthrough return; behaviour is identical but lint-clean.
src/components/Gutter.tsx Swaps ComponentType<{ size?: number }> for the more precise LucideIcon type; import cleanup only.
server/services/query-service.ts Removes truly unused definitionLower variable and upgrades let tableInfo to const; no logic change.
src/lib/sql/autocomplete/scope-analyzer.ts Drops unused _sql and _schema parameters from three internal functions; all callers updated accordingly.
src/lib/sql/autocomplete/candidate-generator.ts Removes unused _context parameter from generateFromTableCandidates; call site updated to match.
src/lib/sql/autocomplete/section-detector.ts Removes unused _cursorPosition parameter from isExpectingAlias; no callers pass a second argument.
src/lib/sql/core.ts Drops unused _fullSource parameter from extractExprSource; single call site updated.
src/components/sql-editor/pg-autocomplete.ts Drops unused _section parameter from wrapCompletionsForRetrigger and its call site.
src/components/sql-editor/ObjectTree.tsx Removes connectionId: _connectionId from destructuring since the prop is never referenced in the component body.
server/lib/schema-cache.ts Replaces for (const [_key, table] of schemaMap) with schemaMap.values() iteration; semantically identical.
server/index.ts Removes unused __GIT_COMMIT__ ambient declaration; build-verified clean.
website/src/components/sections/faqs-accordion.tsx let autoIdconst autoId; no logic change.
website/src/components/sections/faqs-two-column-accordion.tsx let autoIdconst autoId; no logic change.
website/src/components/sections/stats-with-graph.tsx let pathIdconst pathId; no logic change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["formatGroupByItem(item: Expr | GroupingSet)"] --> B{"isGroupingSet(item)?"}
    B -- "false (item is Expr)" --> C["formatExpr(item)"]
    B -- "true (item is GroupingSet)" --> D{"item.kind"}
    D -- "empty" --> E["return '()'"]
    D -- "rollup" --> F["ROLLUP (content.map(formatGroupByItem))"]
    D -- "cube" --> G["CUBE (content.map(formatGroupByItem))"]
    D -- "sets" --> H["GROUPING SETS (content.map(item => wrap(formatGroupByItem(item))))"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["formatGroupByItem(item: Expr | GroupingSet)"] --> B{"isGroupingSet(item)?"}
    B -- "false (item is Expr)" --> C["formatExpr(item)"]
    B -- "true (item is GroupingSet)" --> D{"item.kind"}
    D -- "empty" --> E["return '()'"]
    D -- "rollup" --> F["ROLLUP (content.map(formatGroupByItem))"]
    D -- "cube" --> G["CUBE (content.map(formatGroupByItem))"]
    D -- "sets" --> H["GROUPING SETS (content.map(item => wrap(formatGroupByItem(item))))"]
Loading

Reviews (1): Last reviewed commit: "chore: clean up mechanical lint debt" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

@tianzhou tianzhou merged commit 45b01b3 into main Jun 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants