Fixes lint#308
Conversation
✅ Deploy Preview for yarn-v6 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Terminal copy omits prompts
- Terminal copy now preserves output lines and reconstructs CSS-rendered prompts and comment markers.
- ✅ Fixed: Code copy throws without pre
- Code copy now falls back to the block element text when no nested pre or code element exists.
Or push these changes by commenting:
@cursor push 86c19f77c5
Preview (86c19f77c5)
diff --git a/website/public/docs/docs.js b/website/public/docs/docs.js
--- a/website/public/docs/docs.js
+++ b/website/public/docs/docs.js
@@ -108,12 +108,21 @@
btn.setAttribute(`aria-label`, `Copy code`);
btn.innerHTML = `<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.4"><rect x="3" y="3" width="7" height="7" rx="1"/><path d="M2 8V2h6" opacity="0.6"/></svg>`;
btn.addEventListener(`click`, () => {
- const toCopy = el.classList.contains(`terminal`)
- ? Array.from(el.querySelectorAll(`.term-line`))
- .filter(l => !l.classList.contains(`out`) && !l.classList.contains(`comment`))
- .map(l => l.textContent)
- .join(`\n`)
- : (el.querySelector(`pre code`) || el.querySelector(`pre`)).textContent;
+ let toCopy;
+ if (el.classList.contains(`terminal`)) {
+ toCopy = Array.from(el.querySelectorAll(`.term-line`))
+ .map(l => {
+ let prefix = `$ `;
+ if (l.classList.contains(`out`) || l.classList.contains(`no-prompt`)) prefix = ``;
+ if (l.classList.contains(`comment`)) prefix = `# `;
+
+ return `${prefix}${l.textContent}`;
+ })
+ .join(`\n`) || el.textContent;
+ } else {
+ const code = el.querySelector(`pre code`) || el.querySelector(`pre`);
+ toCopy = (code || el).textContent;
+ }
navigator.clipboard?.writeText(toCopy).then(() => {
btn.classList.add(`copied`);
btn.innerHTML = `<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M2 6l3 3 5-6"/></svg>`;You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit aa3ad8d. Configure here.
| const text = Array.from(el.querySelectorAll(`.term-line, pre code, pre`)) | ||
| .map(line => { | ||
| if (line.classList && line.classList.contains(`term-line`)) { | ||
| if (line.classList.contains(`no-prompt`) || line.classList.contains(`out`)) return line.textContent; |
There was a problem hiding this comment.
Terminal copy omits prompts
Medium Severity
The docs copy handler for .terminal blocks now drops .term-line.out and .term-line.comment lines and copies only raw textContent from command lines. Pasted snippets no longer include shell output, # comments, or $ prompts (shown via CSS, not in the DOM), so copied terminal examples differ from what readers see on the page.
Reviewed by Cursor Bugbot for commit aa3ad8d. Configure here.
| .map(line => { | ||
| if (line.classList && line.classList.contains(`term-line`)) { | ||
| if (line.classList.contains(`no-prompt`) || line.classList.contains(`out`)) return line.textContent; | ||
| if (line.classList.contains(`comment`)) return `# ${line.textContent}`; |
There was a problem hiding this comment.
Code copy throws without pre
Medium Severity
For non-terminal copy targets, the handler reads (el.querySelector('pre code') || el.querySelector('pre')).textContent with no fallback. If neither element exists inside a .code-block, the click handler throws when accessing textContent on null, so copy fails instead of falling back to the block’s text.
Reviewed by Cursor Bugbot for commit aa3ad8d. Configure here.
⏱️ Benchmark Resultsgatsby install-full-cold
📊 Raw benchmark data (gatsby install-full-cold)Base times: 4.497s, 4.402s, 4.504s, 4.451s, 4.357s, 4.492s, 4.500s, 4.503s, 4.532s, 4.458s, 4.414s, 4.456s, 4.455s, 4.414s, 4.452s, 4.407s, 4.490s, 4.484s, 4.425s, 4.488s, 4.477s, 4.507s, 4.589s, 4.401s, 4.526s, 4.437s, 4.460s, 4.399s, 4.481s, 4.510s Head times: 4.461s, 4.439s, 4.384s, 4.408s, 4.412s, 4.518s, 4.485s, 4.310s, 4.381s, 4.510s, 4.481s, 4.460s, 4.454s, 4.455s, 4.330s, 4.477s, 4.507s, 4.440s, 4.448s, 4.525s, 4.531s, 4.455s, 4.506s, 4.523s, 4.358s, 4.469s, 4.574s, 4.420s, 4.387s, 4.505s gatsby install-cache-only
📊 Raw benchmark data (gatsby install-cache-only)Base times: 1.274s, 1.299s, 1.285s, 1.280s, 1.292s, 1.291s, 1.308s, 1.301s, 1.309s, 1.300s, 1.284s, 1.289s, 1.294s, 1.279s, 1.272s, 1.290s, 1.289s, 1.299s, 1.304s, 1.278s, 1.279s, 1.286s, 1.286s, 1.278s, 1.290s, 1.267s, 1.307s, 1.304s, 1.293s, 1.299s Head times: 1.301s, 1.298s, 1.295s, 1.288s, 1.279s, 1.313s, 1.278s, 1.299s, 1.285s, 1.279s, 1.294s, 1.283s, 1.278s, 1.316s, 1.291s, 1.302s, 1.304s, 1.294s, 1.299s, 1.277s, 1.289s, 1.293s, 1.308s, 1.298s, 1.293s, 1.332s, 1.291s, 1.291s, 1.300s, 1.299s gatsby install-cache-and-lock (warm, with lockfile)
📊 Raw benchmark data (gatsby install-cache-and-lock (warm, with lockfile))Base times: 0.354s, 0.357s, 0.359s, 0.349s, 0.351s, 0.351s, 0.350s, 0.351s, 0.350s, 0.359s, 0.349s, 0.350s, 0.354s, 0.357s, 0.349s, 0.355s, 0.360s, 0.365s, 0.376s, 0.351s, 0.352s, 0.352s, 0.353s, 0.352s, 0.353s, 0.350s, 0.350s, 0.351s, 0.349s, 0.356s Head times: 0.355s, 0.353s, 0.352s, 0.347s, 0.350s, 0.361s, 0.360s, 0.356s, 0.354s, 0.350s, 0.349s, 0.348s, 0.343s, 0.356s, 0.357s, 0.349s, 0.349s, 0.353s, 0.347s, 0.353s, 0.352s, 0.348s, 0.346s, 0.346s, 0.346s, 0.351s, 0.350s, 0.350s, 0.350s, 0.353s |



Note
Low Risk
Lint and formatting with limited logic changes; docs terminal copy and quiz share toasts are the only small UX deltas to sanity-check.
Overview
Brings the Yarn website back in line with the repo ESLint setup by extending root
eslint.config.mjswith website-specific globals, default-export exceptions, and targeted rule disables (e.g.no-control-regexfor terminal recording).Across
website/, the diff is mostly mechanical lint/style fixes: backtick strings, brace style,Array<>/ReadonlyArray<>types, import ordering, and explicituseEffectcleanups. Markdown plugins (remark-docs,rehype-footnote-tooltips,rehype-docs) get small control-flow tweaks (e.g.visitcallbacks no longer return stale indices).A few behavioral tweaks worth a quick look: docs copy now builds terminal clipboard text by skipping
out/commentlines instead of re-prefixing prompts; quiz drops the sharedshowToasthelper (share feedback is label-only); packageStatGridstops computing an unused file count.Tooling:
website/tsconfig.jsonenables composite declaration emit; addswebsite/src/env.d.tsfor Astro client types;cli.tstypes Clipanion components viaExtractinstead of hand-rolled shapes.Reviewed by Cursor Bugbot for commit aa3ad8d. Bugbot is set up for automated code reviews on this repo. Configure here.