Repository navigation
[docs-infra] Handle JSDoc demo directives - #1945
Conversation
| const expected = await testEmphasis(plain, parseSource); | ||
| const actual = await testEmphasis(jsdoc, parseSource); | ||
| expect(actual).toBe(expected); | ||
| expect(actual).not.toContain('@focus'); |
There was a problem hiding this comment.
Are we also already testing somewhere the whole line is removed and not just the directive?
Maybe this test would be better done with inline snapshots? and just two plain string inputs instead of the replace?
Deploy previewBundle sizeTotal Size Change: ▼-58B(0.00%) - Total Gzip Change: 🔺+95B(+0.01%) Show details for 79 more bundlestranspileSource parsed: ▼-32B(-0.01%) gzip: 🔺+23B(+0.05%) PerformanceTotal duration: 13.06 ms -2.66 ms(-16.9%) | Renders: 5 (+0) | Paint: 55.46 ms -7.62 ms(-12.1%)
4 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
JSDoc focus directives (
{/** @focus */}) leak into rendered demo source: parsing sees* @focus, so it misses the directive. ESLint can produce this form and then add duplicate focus ranges.Normalize JSDoc decoration before matching/collecting directives and detecting existing focus markers. Preserve ordinary prose, quoted strings, and import offsets. Cover single-line JSX, multiline JSDoc, inline HTML snapshots proving whole-line removal, and lint idempotency.
Validation: 5775 tests, TypeScript, build, lint, formatting, and CLI smoke check passed. Disabling normalization breaks five regression tests. MUI X consumes the fix through a temporary package patch; all seven production browser checks pass. Consumer: mui/mui-x#23851.