Fix/auto readme#261
Conversation
🦋 Changeset detectedLatest commit: acfc3c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR introduces a refined default heading implementation for auto-readme by parsing schema defaults directly via Zod, updates the example package with publish configuration, suppresses related linting warnings, documents the workspace packages, and releases these changes via changeset. ChangesAuto-readme Default Heading Implementation
Example Package Publication & Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the auto-readme default heading implementation, populates the workspace table in the main README, and adjusts publishing configurations for the example package. Feedback suggests refactoring the schema default initialization to avoid top-level Zod parsing and extracting duplicated heading selection logic into a helper function to improve maintainability.
|
|
||
| // use undefined to generate default headings | ||
| // eslint-disable-next-line unicorn/no-useless-undefined | ||
| export const defaultTableHeadings = tableHeadingsSchema.parse(undefined); |
There was a problem hiding this comment.
While tableHeadingsSchema.parse(undefined) correctly triggers the schema's default value, it's generally cleaner to define the default object as a separate constant and export it directly. This avoids the need for Zod parsing at the top level and the associated ESLint suppression.
const DEFAULT_TABLE_HEADINGS = {
ACTION: ["name", "required", "default", "description"],
PKG: ["name", "version", "devDependency"],
USAGE: [],
WORKSPACE: ["name", "version", "downloads", "description"],
ZOD: [],
} as const;
export const defaultTableHeadings = DEFAULT_TABLE_HEADINGS;
const tableHeadingsSchema = z
.record(actionsSchema, headingsSchema.array().optional())
.default(DEFAULT_TABLE_HEADINGS)
.meta({ description: "Table heading action configuration" });| (config.headings?.WORKSPACE?.length && | ||
| config.headings?.WORKSPACE) || | ||
| defaultTableHeadings.WORKSPACE! || | ||
| []; | ||
| defaultTableHeadings.WORKSPACE!; |
Checklist
mainhave been mergedmain