Skip to content

fix linting errors, fix electron vite popping up index.html, docs typescript errors, etc.#2265

Merged
sawka merged 3 commits intomainfrom
sawka/misc-aug2025
Aug 19, 2025
Merged

fix linting errors, fix electron vite popping up index.html, docs typescript errors, etc.#2265
sawka merged 3 commits intomainfrom
sawka/misc-aug2025

Conversation

@sawka
Copy link
Member

@sawka sawka commented Aug 19, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

  • .vscode/settings.json: Adds Go settings: go.lintTool = "staticcheck" and gopls.analyses.QF1003 = false.
  • docs/docs/config.mdx: Removes explicit .tsx extensions from two imports.
  • docs/src/components/platformcontext.tsx: Narrows PlatformProvider export type to React.FC<{ children: ReactNode }>.
  • electron.vite.config.ts: Adds server: { open: false } to main and preload configs.
  • frontend/app/view/preview/directorypreview.tsx: Replaces per-row refs with data-rowindex attributes and DOM query-based scrolling logic in useLayoutEffect.
  • emain/emain-tabview.ts: Fixes renderer URL by removing an extraneous closing brace.
  • emain/emain-util.ts: Makes hot-reload bypass conditional on dev mode and expands dev URL patterns to include ports 5173/5174 on localhost/127.0.0.1.
  • staticcheck.conf: Adds checks line enabling all checks while excluding ST1005, QF1003, ST1000, ST1003.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d76c943 and 432fb85.

📒 Files selected for processing (4)
  • .vscode/settings.json (1 hunks)
  • emain/emain-tabview.ts (1 hunks)
  • emain/emain-util.ts (1 hunks)
  • staticcheck.conf (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawka/misc-aug2025

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/src/components/platformcontext.tsx (1)

49-55: React.FC already includes children; this generic doesn’t make children required

If the goal is stronger typing, declaring the function with an explicit props type avoids the React.FC children optionality. Otherwise, you can keep it as-is.

Apply this minimal change to make children required and remove the redundant generic:

-export const PlatformProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
+export const PlatformProvider = ({ children }: { children: ReactNode }) => {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 462a1b6 and 152c78a.

📒 Files selected for processing (4)
  • .vscode/settings.json (1 hunks)
  • docs/docs/config.mdx (1 hunks)
  • docs/src/components/platformcontext.tsx (1 hunks)
  • electron.vite.config.ts (2 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/docs/config.mdx

[grammar] ~7-~7: There might be a mistake here.
Context: ...{ Kbd } from "@site/src/components/kbd"; import { PlatformProvider, PlatformSelec...

(QB_NEW_EN)

🔇 Additional comments (4)
electron.vite.config.ts (2)

30-32: Explicitly disabling auto-open for main dev server looks good

This aligns behavior across targets and helps avoid the stray browser window when developing.


53-55: Consistent dev server behavior for preload as well

Mirrors the renderer config and prevents unwanted browser tabs in dev. Good call.

docs/docs/config.mdx (1)

7-8: Import path cleanup LGTM

Dropping explicit .tsx extensions improves compatibility with MDX/TS resolution and avoids editor/type tooling friction. No issues spotted.

.vscode/settings.json (1)

58-59: Staticcheck setup looks reasonable

Using staticcheck with targeted suppressions aligns with the stated “fix linting errors” objective.

Comment on lines +60 to +63
"gopls": {
"analyses": {
"QF1003": false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm whether gopls recognizes the QF1003 analysis key

I’m not certain gopls.analyses.QF1003 is a supported key (staticcheck uses QF1003, but gopls analyses are typically names like unusedparams, nilness, etc.). If unsupported, gopls will ignore it silently.

Please run this quick web check to confirm support and the recommended way to suppress QF1003 in VS Code:


🌐 Web query:

Does gopls support an analyses key named "QF1003" in settings.json? What’s the recommended way to disable Staticcheck rule QF1003 in VS Code (golang.go + staticcheck)?

💡 Result:

Short answer: Yes — gopls exposes a QF1003 analyzer name and you can disable it. The recommended way in VS Code (with the official Go extension / gopls) is to turn that analyzer off in your gopls settings (settings.json). (tip.golang.org, github.com)

How to do it (recommended)

  • In VS Code open Settings → Open Settings (JSON) and add a gopls UI diagnostic analyses entry to disable QF1003. For example (user or workspace settings.json):

    {
    "gopls": {
    "ui": {
    "diagnostic": {
    "analyses": {
    "QF1003": false
    },
    "staticcheck": true
    }
    }
    }
    }

This tells gopls to stop reporting the QF1003 quickfix. After changing the setting reload VS Code / restart the language server. (github.com, go.dev)

Other options (if they apply)

  • If you run staticcheck separately (CLI, CI, or via golangci-lint), disable QF1003 in staticcheck’s config by adding a minus entry to the checks list in staticcheck.conf (TOML). Example staticcheck.conf:

    checks = ["all", "-QF1003"]

Staticcheck also supports project-wide config and will ignore checks configured in staticcheck.conf. (staticcheck.dev)

  • Per-line or per-file: you can silence a specific occurrence with staticcheck linter directives in the source:
    • Line: //lint:ignore QF1003 reason
    • File: //lint:file-ignore QF1003 reason
      These are useful for individual exceptions. (staticcheck.dev)

Notes / caveats

  • gopls ships its own set of analyzers (including the QF quickfixes). The analyses map (and the vscode-go UI.diagnostic.analyses mapping) is the preferred way to tune what gopls reports in the editor. If you also enable staticcheck as a separate tool or via golangci-lint, disable the check there too (or use the staticcheck.conf) to keep behavior consistent. (tip.golang.org, staticcheck.dev)

If you want, tell me whether you want the setting applied globally or only for the workspace and I can produce the exact JSON snippet to paste into your settings.json (or the TOML for staticcheck.conf).

Citations:


Update gopls settings to disable QF1003 in the correct section

The QF1003 analyzer is valid, but gopls expects it under gopls.ui.diagnostic.analyses, not directly under gopls.analyses. As written, your setting will be ignored.

Please adjust your VS Code settings.json to something like:

 .vscode/settings.json
@@
-   "gopls": {
-       "analyses": {
-           "QF1003": false
-       }
-   }
+   "gopls": {
+     "ui": {
+       "diagnostic": {
+         "analyses": {
+           "QF1003": false
+         },
+         "staticcheck": true
+       }
+     }
+   }

• After updating, reload VS Code or restart gopls to apply.
• If you also run staticcheck standalone, remember to disable QF1003 there (e.g. in staticcheck.conf: checks = ["all", "-QF1003"]). 1

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"gopls": {
"analyses": {
"QF1003": false
}
"gopls": {
"ui": {
"diagnostic": {
"analyses": {
"QF1003": false
},
"staticcheck": true
}
}
}
🤖 Prompt for AI Agents
.vscode/settings.json around lines 60-63: the QF1003 analyzer is currently
placed under "gopls.analyses" which gopls ignores; move the setting into
"gopls.ui.diagnostic.analyses" as "QF1003": false so gopls will apply it, save
the file and reload VS Code or restart gopls to take effect, and if you run
staticcheck separately also disable QF1003 there (e.g. in staticcheck.conf use
checks = ["all", "-QF1003"]).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
frontend/app/view/preview/directorypreview.tsx (2)

669-692: Duplicate React keys across top and center row lists

Both maps use key={idx}; since each map starts at 0, keys collide when at least one row is pinned at the top. Use a stable unique key (row.id is ideal) to avoid reconciliation bugs and warnings.

-                {table.getTopRows().map((row, idx) => (
+                {table.getTopRows().map((row, idx) => (
                     <TableRow
                         model={model}
                         row={row}
                         focusIndex={focusIndex}
                         setFocusIndex={setFocusIndex}
                         setSearch={setSearch}
                         idx={idx}
                         handleFileContextMenu={handleFileContextMenu}
-                        key={idx}
+                        key={row.id}
                     />
                 ))}
-                {table.getCenterRows().map((row, idx) => (
+                {table.getCenterRows().map((row, idx) => (
                     <TableRow
                         model={model}
                         row={row}
                         focusIndex={focusIndex}
                         setFocusIndex={setFocusIndex}
                         setSearch={setSearch}
-                        idx={idx + table.getTopRows().length}
+                        idx={idx + table.getTopRows().length}
                         handleFileContextMenu={handleFileContextMenu}
-                        key={idx}
+                        key={row.id}
                     />
                 ))}

507-508: Make osRef prop optional/nullable in TableBodyProps
osRef.current can be undefined on first render and is guarded at runtime—update the prop type to reflect that and avoid TS errors under strict null checks.

• File: frontend/app/view/preview/directorypreview.tsx
In the TableBodyProps interface (around lines 504–508), change:

- osRef: OverlayScrollbarsComponentRef;
+ osRef?: OverlayScrollbarsComponentRef | null;
🧹 Nitpick comments (3)
frontend/app/view/preview/directorypreview.tsx (3)

526-556: Scroll-to-focused-row logic is solid; tighten types and minor nits

Nice simplification with DOM lookup and precise viewport math. A few small improvements to avoid TS issues and future bugs:

  • The null check for focusIndex is redundant (type is number). Either remove it or widen the type.
  • Prefer the generic overload of querySelector to avoid a cast.
  • Add osRef to the effect deps to avoid stale refs if the overlay instance changes.
  • Optional: useLayoutEffect here to eliminate potential flicker when jumping focus.

Suggested patch:

-        if (focusIndex === null || !bodyRef.current || !osRef) {
+        if (!bodyRef.current || !osRef) {
             return;
         }
-
-        const rowElement = bodyRef.current.querySelector(`[data-rowindex="${focusIndex}"]`) as HTMLDivElement;
+        const rowElement = bodyRef.current.querySelector<HTMLDivElement>(
+            `[data-rowindex="${focusIndex}"]`
+        );
         if (!rowElement) {
             return;
         }
@@
-    }, [focusIndex]);
+    }, [focusIndex, osRef]);

386-402: Avoid stale pins and use strict equality when pinning the “..” row

Clear any previous pin state before pinning the parent row to prevent stale/duplicate pinned ids across directory changes. Also, use strict equality.

-        let foundParentDir = false;
+        let foundParentDir = false;
 
         for (const row of rows) {
-            if (row.getValue("name") == "..") {
-                row.pin("top");
+            if (row.getValue("name") === "..") {
+                // Clear any stale pins before pinning the parent row
+                table.resetRowPinning();
+                row.pin("top");
                 foundParentDir = true;
                 break;
             }
         }
 
         // If we didn't find the ".." row, reset the pinning to avoid stale references
         if (!foundParentDir) {
             table.resetRowPinning();
         }

762-764: Use strict equality in the MemoizedTableBody comparator

Minor lint/readability nit: prefer === for the memo comparator.

-    (prev, next) => prev.table.options.data == next.table.options.data
+    (prev, next) => prev.table.options.data === next.table.options.data
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 152c78a and d76c943.

📒 Files selected for processing (1)
  • frontend/app/view/preview/directorypreview.tsx (3 hunks)
🔇 Additional comments (1)
frontend/app/view/preview/directorypreview.tsx (1)

737-739: Using data-rowindex to target rows: LGTM

This aligns the scroll logic with a simple, robust DOM query and removes ref churn. The index mapping also matches DirectoryTable’s allRows composition.

@sawka sawka merged commit 7a19b94 into main Aug 19, 2025
7 of 9 checks passed
@sawka sawka deleted the sawka/misc-aug2025 branch August 19, 2025 22:50
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.

1 participant