[Draft] BodyText linting part 2: no-invalid-bodytext-children#3015
[Draft] BodyText linting part 2: no-invalid-bodytext-children#3015marcysutton wants to merge 6 commits intomainfrom
Conversation
… for no-invalid-bodytext-parent to avoid nested paragraphs
…ext-children rule for flagging invalid children within the Bodytext component
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
🦋 Changeset detectedLatest commit: 4199e63 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 |
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
|
Size Change: +778 B (+0.63%) Total Size: 124 kB 📦 View Changed
ℹ️ View Unchanged
|
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (0fb92c6) and published all packages with changesets to npm. You can install the packages in ./dev/tools/deploy_wonder_blocks.js --tag="PR3015"Packages can also be installed manually by running: pnpm add @khanacademy/wonder-blocks-<package-name>@PR3015 |
A new build was pushed to Chromatic! 🚀https://5e1bf4b385e3fb0020b7073c-jnevvyiccd.chromatic.com/ Chromatic results:
|
4bc6115 to
f554d3f
Compare
Summary:
This new lint rule will flag invalid children within BodyText:
viewChild— always warns whenViewis a direct child ofBodyText, regardless oftagpropdivChild— warns when<div>is a direct child andBodyTextrenders as<p>(notagortag="p")paragraphChild— warns when<p>or a default<BodyText>(renders as<p>) is a direct childblockChild— warns on other block-level HTML elements (section,ul,h1–h6, etc.) and WB heading components whenBodyTextrenders as<p>tooManyChildren— warns when direct JSX element children exceed a configurable threshold (default: 5)BodyTexthas an inline or block-container tag prop setIssue: WB-2248
Test plan: