fix(lint): allow underscores in custom_block .md filenames#34
Merged
Conversation
The custom_block filename check required the name to equal its collapsed PascalCase form, so valid component tags like Helm_v4_error.md were flagged as "Bad filename" and told to rename to HelmV4Error.md. But underscores are valid JS identifier characters — <Helm_v4_error /> is a legal component tag, and the resolver already registers the raw slug as a known name. Only flag filenames that can't be a component tag: not a valid identifier starting with an uppercase letter (i.e. hyphens or a lowercase initial). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedAn error occurred during the review process. Please try again later. 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 |
erunion
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
lintflags custom_block.mdsnippet files whose names contain underscores, e.g.:This is a false positive. The filename becomes a component tag
<Name />, and the only real constraint is that the name be a valid JS identifier starting with an uppercase letter. Underscores are valid identifier characters —<Helm_v4_error />is a legal tag. The resolver already agrees:getKnownComponentNamesregisters the raw slug (names.add(slug)) as a known component name, so<Helm_v4_error />already resolves. Only the filename check was overzealous, conflating "unusable as a tag" with "not my preferred style."Fix
Flag a filename only when it can't be a component tag — i.e. it's not
^[A-Z][A-Za-z0-9_$]*$(hyphens, or a lowercase initial). Underscores and digits are allowed. When it is invalid, still suggest the collapsed PascalCase form.Verification
Helm_v4_error.md"Bad filename" warning is gone, with no new warnings introduced.Reported via a customer lint run (CX-3425-adjacent). Independent of #33 (Windows path fix).
🤖 Generated with Claude Code