Conversation
The backticks around the path were escaped twice, which closes the template literal early and makes the snippet a syntax error when copied.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain.
Pull request overview
Fixes invalid backtick escaping in the Node file-watcher documentation example.
Changes:
- Removes the extra backslashes around
relPath.
File summaries
| File | Description |
|---|---|
nodejs/docs/examples.md |
Corrects the file-watcher template literal. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
The file-watcher example in
nodejs/docs/examples.mdescapes the backticks around the path twice, so the snippet is a syntax error if you copy it.\\is an escaped backslash, so the backtick that follows it terminates the template literal, and${relPath}then sits outside any string.Proof
With a single backslash it parses and produces what the example intends:
Scope
One character removed from each of the two escapes, on one line. This is the only occurrence in the repository:
Why it was not caught
scripts/docs-validationonly scans the repository-rootdocs/directory —const DOCS_DIR = path.resolve(import.meta.dirname, "../../docs")— so the 54 code blocks undernodejs/docs/are never extracted or type-checked.While I was there I checked the rest of that directory by extracting the 12 blocks that carry imports and type-checking them against
nodejs/src. After this fix, the only remaining failures are three bare object-literal fragments that end mid-structure and are not meant to compile standalone — the same classextract.tsalready skips deliberately for TypeScript.nodejs/examples/basic-example.tstype-checks cleanly too.I have not tried to extend the validation tooling to cover
nodejs/docs/, since whether those pages should be in scope looked like your call.