Conversation
🦋 Changeset detectedLatest commit: c7ee164 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA new file-naming remark-lint rule was added to enforce lowercase alphanumeric filename conventions for Markdown documents. The rule validates filenames against a defined pattern, applies special handling for index.md files, and skips validation when path metadata is unavailable. Implementation includes comprehensive specification, rule code, configuration integration, and test coverage. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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. Comment |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #317 +/- ##
===========================================
+ Coverage 37.72% 48.82% +11.10%
===========================================
Files 58 59 +1
Lines 1344 1364 +20
Branches 419 430 +11
===========================================
+ Hits 507 666 +159
+ Misses 646 538 -108
+ Partials 191 160 -31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
packages/doom/test/remark-lint/file-naming.spec.ts (1)
16-26: Awkward double cast; and a couple of missing coverage paths.
fileNaming as unknown as Parameters<typeof processor.use>[0](also line 92) goes throughunknown, which is a code smell.lintRulereturns a typed unifiedPlugin; consider a directPlugin<[], Root>-typed local binding or a small typed helper to avoid theunknownhop.- Consider adding tests for branches exercised by the implementation but not covered here:
- Root-level
index.md/index.mdxskip (the spec explicitly calls this out).- File outside
config.root(therelativePath.startsWith('..')branch).- An intentionally invalid-named file under
apis/to confirm it's ignored rather than just passing.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/doom/test/remark-lint/file-naming.spec.ts` around lines 16 - 26, Replace the awkward double-cast by creating a properly typed local plugin binding instead of casting through unknown: obtain fileNaming as a Plugin<[], Root> (or via a small helper that returns Plugin<[], Root>) and use that value in processor().use rather than fileNaming as unknown as Parameters<typeof processor.use>[0]; update both occurrences where the double-cast appears. Also add unit tests that cover the missing branches mentioned: a root-level "index.md" / "index.mdx" case to assert it is skipped, a file path outside config.root to exercise the relativePath.startsWith('..') branch, and one intentionally invalid-named file under the "apis/" directory to assert it is ignored (not treated as valid). Ensure the tests use the existing lintWithPath/processor setup to run these scenarios.packages/doom/src/remark-lint/file-naming.ts (1)
37-41: Error message omits other pattern constraints.The message only mentions "must not end with underscore", but
VALID_NAME_PATTERNalso rejects consecutive underscores (e.g.foo__bar) and names starting with a digit followed by an underscore edge cases aside, this can confuse users whose filename fails for other reasons. Consider stating the full rule, e.g. "lowercase letters, numbers, and single underscores between segments; may start with an underscore but must not end with one".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/doom/src/remark-lint/file-naming.ts` around lines 37 - 41, The current error logged in vfile.message for INVALID names (inside the check using VALID_NAME_PATTERN for variables basename and isIndex) only mentions "must not end with underscore" and omits other constraints (no consecutive underscores, allowed leading underscore semantics); update the message to fully describe the pattern enforced by VALID_NAME_PATTERN—e.g. "must use lowercase letters, numbers, and single underscores between segments (no consecutive underscores); may start with an underscore but must not end with one"—so users understand all rejection reasons when the check in the file-naming rule fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@openspec/changes/archive/2026-04-20-add-file-naming-rule/design.md`:
- Line 3: The doc line saying "The doom-lint suite has 17 remark-lint rules" is
out of date after adding the file-naming rule; update the sentence in design.md
to either the correct count ("19 remark-lint rules") or remove the hard-coded
number and say "multiple" or "several" to avoid future drift; reference that the
current exports live in src/remark-lint/index.ts (which now re-exports
file-naming) when validating the correct count.
In `@openspec/changes/archive/2026-04-20-add-file-naming-rule/proposal.md`:
- Line 8: The proposal's regex includes the file extension but the
implementation in file-naming.ts validates only the stem using
VALID_NAME_PATTERN = /^_?[a-z0-9]+(?:_[a-z0-9]+)*$/ (applied to vfile.stem and
parent dir for index files), so update the proposal text to use the stem-only
pattern ^_?[a-z0-9]+(_[a-z0-9]+)*$ (or explicitly state "stem only, without
extension") and mention the matching behavior for index files to align wording
with file-naming.ts and VALID_NAME_PATTERN.
In
`@openspec/changes/archive/2026-04-20-add-file-naming-rule/specs/file-naming-rule/spec.md`:
- Around line 56-63: The spec must reflect the actual skip behaviors implemented
in packages/doom/src/remark-lint/file-naming.ts: add scenarios that describe
skipping validation for (a) files with paths outside config.root, (b) top-level
index.md and index.mdx (including optional leading `${lang}/`), and (c) any
files under `${prefix}apis/`; update the "Skip validation when path unavailable"
section to include these cases (or alternatively adjust the implementation to
remove these skips so the spec and code match).
---
Nitpick comments:
In `@packages/doom/src/remark-lint/file-naming.ts`:
- Around line 37-41: The current error logged in vfile.message for INVALID names
(inside the check using VALID_NAME_PATTERN for variables basename and isIndex)
only mentions "must not end with underscore" and omits other constraints (no
consecutive underscores, allowed leading underscore semantics); update the
message to fully describe the pattern enforced by VALID_NAME_PATTERN—e.g. "must
use lowercase letters, numbers, and single underscores between segments (no
consecutive underscores); may start with an underscore but must not end with
one"—so users understand all rejection reasons when the check in the file-naming
rule fails.
In `@packages/doom/test/remark-lint/file-naming.spec.ts`:
- Around line 16-26: Replace the awkward double-cast by creating a properly
typed local plugin binding instead of casting through unknown: obtain fileNaming
as a Plugin<[], Root> (or via a small helper that returns Plugin<[], Root>) and
use that value in processor().use rather than fileNaming as unknown as
Parameters<typeof processor.use>[0]; update both occurrences where the
double-cast appears. Also add unit tests that cover the missing branches
mentioned: a root-level "index.md" / "index.mdx" case to assert it is skipped, a
file path outside config.root to exercise the relativePath.startsWith('..')
branch, and one intentionally invalid-named file under the "apis/" directory to
assert it is ignored (not treated as valid). Ensure the tests use the existing
lintWithPath/processor setup to run these scenarios.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1aed3319-7c6d-4bc4-9e27-0397c3513226
📒 Files selected for processing (9)
openspec/changes/archive/2026-04-20-add-file-naming-rule/.openspec.yamlopenspec/changes/archive/2026-04-20-add-file-naming-rule/design.mdopenspec/changes/archive/2026-04-20-add-file-naming-rule/proposal.mdopenspec/changes/archive/2026-04-20-add-file-naming-rule/specs/file-naming-rule/spec.mdopenspec/changes/archive/2026-04-20-add-file-naming-rule/tasks.mdpackages/doom/src/remark-lint/file-naming.tspackages/doom/src/remark-lint/index.tspackages/doom/src/remarkrc.tspackages/doom/test/remark-lint/file-naming.spec.ts
Signed-off-by: JounQin <admin@1stg.me>
There was a problem hiding this comment.
Pull request overview
Adds a new doom-lint:file-naming remark-lint rule to enforce lowercase/number/underscore doc naming conventions (with special handling for index.md/index.mdx), and wires it into the existing doom remark-lint preset with accompanying tests and OpenSpec documentation.
Changes:
- Implement
fileNamingrule to validate filename stems (or parent directory forindex.*) and skip certain paths (e.g. API docs). - Register the new rule in
remarkrc.tsand re-export from the remark-lint entrypoint. - Add a dedicated test suite plus spec-driven documentation artifacts under
openspec/changes/archive/....
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/doom/src/remark-lint/file-naming.ts | New lint rule that validates doc file naming based on vfile path metadata. |
| packages/doom/test/remark-lint/file-naming.spec.ts | New tests for valid/invalid filenames and index parent-directory validation. |
| packages/doom/src/remark-lint/index.ts | Re-exports the new rule. |
| packages/doom/src/remarkrc.ts | Enables the new rule in the remark plugin chain. |
| openspec/changes/archive/2026-04-20-add-file-naming-rule/.openspec.yaml | Adds OpenSpec metadata for the change archive. |
| openspec/changes/archive/2026-04-20-add-file-naming-rule/proposal.md | Documents motivation/scope of the rule. |
| openspec/changes/archive/2026-04-20-add-file-naming-rule/design.md | Documents design decisions/risks for the rule. |
| openspec/changes/archive/2026-04-20-add-file-naming-rule/tasks.md | Tracks implementation/testing/validation tasks. |
| openspec/changes/archive/2026-04-20-add-file-naming-rule/specs/file-naming-rule/spec.md | Defines behavioral requirements and scenarios for the rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
doom-lint:file-namingremark-lint rule that enforces document filenames contain only lowercase letters, numbers, and underscores^_?[a-z0-9]+(?:_[a-z0-9]+)*$)index.md/index.mdxfiles, validates the parent directory name insteadSummary by CodeRabbit
Release Notes
New Features
doom-lint:file-namingrule to enforce filename conventions, requiring lowercase alphanumeric characters with optional underscores and underscore-separated segmentsindex.md/index.mdxfiles to validate parent directory namingTests
Chores