Skip to content

fix: separate class getters from methods in docs rendering#1949

Merged
ghostdevv merged 4 commits intonpmx-dev:mainfrom
RYGRIT:fix/issue-1943
Mar 5, 2026
Merged

fix: separate class getters from methods in docs rendering#1949
ghostdevv merged 4 commits intonpmx-dev:mainfrom
RYGRIT:fix/issue-1943

Conversation

@RYGRIT
Copy link
Contributor

@RYGRIT RYGRIT commented Mar 5, 2026

🔗 Linked issue

Fixes #1943

🧭 Context

📚 Description

This PR splits class getter methods (such as get clientId()) into a separate "Getters" section and uses the get name: type format.

Also:

  • Extracted renderMemberList helper to deduplicate Properties/Getters/Methods rendering
  • Omit : type suffix for properties without explicit type annotations
  • Added unit tests for getter/method separation

@vercel
Copy link

vercel bot commented Mar 5, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 5, 2026 7:51pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 5, 2026 7:51pm
npmx-lunaria Ignored Ignored Mar 5, 2026 7:51pm

Request Review

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f81c9955-81a7-47a0-9f31-c9eb582e640e

📥 Commits

Reviewing files that changed from the base of the PR and between de911cd and 640b6e4.

📒 Files selected for processing (1)
  • shared/types/deno-doc.ts

📝 Walkthrough

Walkthrough

This change refactors the documentation rendering system to properly categorise and display class getters separately from methods. A kind property was added to method metadata in the type definitions to distinguish getter methods from regular methods. The rendering logic was updated to introduce a DefinitionListItem type and a unified renderMemberList function for consistent HTML definition list generation. Properties, getters, and methods are now rendered using this shared function, with getters displayed under a dedicated "Getters" section with get prefix notation. Comprehensive unit tests were added to verify correct separation and rendering of getters and methods in generated documentation.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly explains the changes: separating getters into a distinct section, extracting renderMemberList helper, omitting type suffix for untyped properties, and adding tests.
Linked Issues check ✅ Passed The PR successfully addresses issue #1943 by implementing separate rendering for class getters with the 'get name: type' format and creating a dedicated Getters section.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing issue #1943: refactoring render logic, adding getter/method discrimination, and including comprehensive test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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)
test/unit/server/utils/docs/render.spec.ts (1)

24-133: Add one test for untyped properties to cover the other behaviour change in this PR.

Nice coverage for getter/method separation. Please also add a case asserting that a class property without tsType renders without a : type suffix, so that change is protected from regressions.

✅ Suggested additional test
+  it('omits ": type" for properties without explicit tsType', async () => {
+    const symbol = createClassSymbol({
+      properties: [
+        { name: 'clientId' }, // no tsType
+      ],
+    })
+
+    const html = await renderDocNodes([symbol], new Map())
+
+    expect(html).toContain('<h4>Properties</h4>')
+    expect(html).toContain('clientId')
+    expect(html).not.toContain('clientId:')
+  })

As per coding guidelines, “**/*.{test,spec}.{ts,tsx}: Write unit tests for core functionality using vitest”.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33b18d44-bf42-4d65-9447-791c8f676413

📥 Commits

Reviewing files that changed from the base of the PR and between 5530873 and de911cd.

📒 Files selected for processing (3)
  • server/utils/docs/render.ts
  • shared/types/deno-doc.ts
  • test/unit/server/utils/docs/render.spec.ts

@shi-gg
Copy link
Member

shi-gg commented Mar 5, 2026

tank u
Screenshot_20260305_154230_Chrome

@ghostdevv ghostdevv enabled auto-merge March 5, 2026 19:49
@ghostdevv ghostdevv added this pull request to the merge queue Mar 5, 2026
Merged via the queue into npmx-dev:main with commit 58da597 Mar 5, 2026
20 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.

Package docs miss-categorize class getters

3 participants