docs: add examples for typescript.tsConfig and typescript.nodeTsConfi…#34948
docs: add examples for typescript.tsConfig and typescript.nodeTsConfi…#34948PasserbyPh wants to merge 3 commits intonuxt:mainnuxt/nuxt:mainfrom PasserbyPh:docs/#34756-custom-files-typecheckingPasserbyPh/nuxt:docs/#34756-custom-files-typecheckingCopy head branch name to clipboard
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
docs/3.guide/1.concepts/8.typescript.md (1)
106-117: Minor doc improvement: link to bothtsConfigandnodeTsConfigAPI sections (and keep punctuation consistent).The new section explains both options, but the
::read-morecurrently points only to thetypescript.tsConfigAPI docs. Consider adding a second read-more (or expanding the existing one) to also link totypescript.nodeTsConfigfor completeness.Also, the static-analysis hints flag “loose punctuation mark” around Line 114 and Line 116—worth double-checking that list-item terminal punctuation is consistent with surrounding docs styles.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/3.guide/1.concepts/8.typescript.md` around lines 106 - 117, The docs section links only to typescript.tsConfig but should also reference typescript.nodeTsConfig and ensure list-item punctuation matches project style; update the read-more block (or add a second read-more) so it links to both the tsConfig and nodeTsConfig API pages, and adjust the terminal punctuation of the two list items that mention "Nuxt app context" and "Node context" (references to tsConfig and nodeTsConfig) to match surrounding documentation punctuation style; locate and change the `typescript.tsConfig` and `typescript.nodeTsConfig` mentions in the text and the `::read-more` helper to add the second link and fix punctuation consistency.docs/4.api/6.nuxt-config.md (1)
1543-1558: Minor clarity: explicitly state paths/globs are resolved relative to the generated.nuxt/*.jsontsconfig location.The new
tsConfigexample (include: ['../tests/**/*.ts']) will likely work, but Nuxt’s generated tsconfig files live under.nuxt/(orbuildDir). Ifincludepatterns are interpreted relative to the generated tsconfig file (as TS typically does), it’s worth a 1-line note like “paths are relative to the generated tsconfig location” to prevent confusion when users changebuildDir.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/4.api/6.nuxt-config.md` around lines 1543 - 1558, Add a one-line clarification to the `tsConfig` section noting that include paths/globs (e.g., the example `include: ['../tests/**/*.ts']`) are resolved relative to the generated Nuxt tsconfig files under `.nuxt/` (or the configured `buildDir`), so users should craft patterns accordingly if they change `buildDir`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/3.guide/1.concepts/8.typescript.md`:
- Around line 106-117: The docs section links only to typescript.tsConfig but
should also reference typescript.nodeTsConfig and ensure list-item punctuation
matches project style; update the read-more block (or add a second read-more) so
it links to both the tsConfig and nodeTsConfig API pages, and adjust the
terminal punctuation of the two list items that mention "Nuxt app context" and
"Node context" (references to tsConfig and nodeTsConfig) to match surrounding
documentation punctuation style; locate and change the `typescript.tsConfig` and
`typescript.nodeTsConfig` mentions in the text and the `::read-more` helper to
add the second link and fix punctuation consistency.
In `@docs/4.api/6.nuxt-config.md`:
- Around line 1543-1558: Add a one-line clarification to the `tsConfig` section
noting that include paths/globs (e.g., the example `include:
['../tests/**/*.ts']`) are resolved relative to the generated Nuxt tsconfig
files under `.nuxt/` (or the configured `buildDir`), so users should craft
patterns accordingly if they change `buildDir`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6e6c39c4-684b-44e9-97dd-3d968f8654ad
📒 Files selected for processing (2)
docs/3.guide/1.concepts/8.typescript.mddocs/4.api/6.nuxt-config.md
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/3.guide/1.concepts/8.typescript.md`:
- Around line 106-118: Add a short tip after the "Including Custom Files in
Type-Checking" section that links to the test-specific TypeScript docs to avoid
duplication; specifically insert a note referencing the Testing guide URL
(/docs/4.x/getting-started/testing#typescript-support-in-tests) right after the
explanation of typescript.TSConfig and typescript.nodeTsConfig (i.e., after the
Node context paragraph), with copy like "For TypeScript support specifically in
test files, see the Testing guide" so readers can follow up on test-specific
configuration without repeating content.
- Line 112: Update the docs line to reference the actual Nuxt config property
name: replace the incorrect `typescript.TSConfig` with the correct
`typescript.tsConfig` (lowercase "ts") so it matches the schema property; ensure
the sentence still points to the tsConfig entry (e.g., "Extend
`typescript.tsConfig`") and keep the example composable/import context
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b4227f97-5547-454e-988b-012147d1b0cb
📒 Files selected for processing (2)
docs/3.guide/1.concepts/8.typescript.mddocs/4.api/6.nuxt-config.md
✅ Files skipped from review due to trivial changes (1)
- docs/4.api/6.nuxt-config.md
140a4eb to
1956b32
Compare
|
@danielroe Hello, I've updated the PR:
|
1956b32 to
de248c6
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
docs/3.guide/1.concepts/8.typescript.md (2)
106-117: ⚡ Quick winMake the “how” explicit: mention
includeglobs intsConfig/nodeTsConfig.Right now the section tells users what to extend, but not the mechanism (i.e. that these options are where you add
includeentries/globs for the custom files). Adding a short one-liner after the two bullets would reduce confusion and help readers apply the guidance without needing to immediately jump to the API docs.Suggested patch
- **Node context** — For files that only use plain TypeScript/Node.js APIs and do not depend on Nuxt-specific features (e.g., build scripts, configuration utilities). Extend [`typescript.nodeTsConfig`](/docs/4.x/api/nuxt-config#nodetsconfig). + + In both cases, use the option’s `include` globs (or equivalent) to pull in files outside Nuxt’s standard directories (for example, anything under `tests/`). ::read-more{to="/docs/4.x/getting-started/testing#typescript-support-in-tests"} For test-specific examples, see TypeScript Support in Tests. ::🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/3.guide/1.concepts/8.typescript.md` around lines 106 - 117, Add a clarifying one-liner after the two bullets that explains how to include custom files by adding include globs to the TypeScript settings (i.e., add an "include" array/glob patterns to typescript.tsConfig for Nuxt app-context files and to typescript.nodeTsConfig for Node-context files) so readers know these options are where to add their custom file globs.
115-117: 💤 Low valueMinor wording/casing consistency in the
read-morecallout.“TypeScript Support in Tests” is capitalised like a title. If that’s meant to be a literal doc-title match, it’s fine; otherwise consider using sentence case (“TypeScript support in tests”) to stay consistent with the surrounding text.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/3.guide/1.concepts/8.typescript.md` around lines 115 - 117, The ::read-more callout text "TypeScript Support in Tests" uses title case; update the callout to use sentence case for consistency with surrounding text by changing that string to "TypeScript support in tests" in the ::read-more invocation so the display text matches the desired casing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/3.guide/1.concepts/8.typescript.md`:
- Around line 106-117: Add a clarifying one-liner after the two bullets that
explains how to include custom files by adding include globs to the TypeScript
settings (i.e., add an "include" array/glob patterns to typescript.tsConfig for
Nuxt app-context files and to typescript.nodeTsConfig for Node-context files) so
readers know these options are where to add their custom file globs.
- Around line 115-117: The ::read-more callout text "TypeScript Support in
Tests" uses title case; update the callout to use sentence case for consistency
with surrounding text by changing that string to "TypeScript support in tests"
in the ::read-more invocation so the display text matches the desired casing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c6a8f223-f816-4548-af21-f042f0f755e2
📒 Files selected for processing (2)
docs/3.guide/1.concepts/8.typescript.mddocs/4.api/6.nuxt-config.md
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/4.api/6.nuxt-config.md
There was a problem hiding this comment.
♻️ Duplicate comments (2)
docs/3.guide/1.concepts/8.typescript.md (2)
115-117:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTighten the
::read-moreblock wording/punctuation to avoid doc lint warnings.LanguageTool hints show “Loose punctuation mark” around the
::read-moreblock (near Line [116]). The current line ends with a period (“Tests.”) immediately before the directive is closed, which can trigger formatting/lint noise.🛠️ Proposed change
::read-more{to="/docs/4.x/getting-started/testing#typescript-support-in-tests"} -For test-specific examples, see TypeScript Support in Tests. +For TypeScript support specifically in test files, see TypeScript Support in Tests. ::🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/3.guide/1.concepts/8.typescript.md` around lines 115 - 117, Tighten the ::read-more block punctuation by removing the trailing period inside the directive text so it reads ::read-more{to="/docs/4.x/getting-started/testing#typescript-support-in-tests"}For test-specific examples, see TypeScript Support in Tests::, or alternatively place the sentence-ending period after the closing directive; update the ::read-more block (the directive targeting "/docs/4.x/getting-started/testing#typescript-support-in-tests") accordingly to avoid the “Loose punctuation mark” lint warning.
106-113:⚠️ Potential issue | 🟠 MajorFix incorrect config property name: use
typescript.tsConfig(nottypescript.TSConfig).Line 112 references
typescript.TSConfig(capital "TS"), but the correct Nuxt property istypescript.tsConfig(lowercase "ts"). Users copying the wrong property name will not have their custom files included in type-checking.Fix
- - **Nuxt app context** — For files that import from Vue, Nuxt, or use auto-imported composables (e.g., test files using `mount()` or `useNuxtApp()`). Extend [`typescript.TSConfig`](/docs/4.x/api/nuxt-config#tsconfig). + - **Nuxt app context** — For files that import from Vue, Nuxt, or use auto-imported composables (e.g., test files using `mount()` or `useNuxtApp()`). Extend [`typescript.tsConfig`](/docs/4.x/api/nuxt-config#tsconfig).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/3.guide/1.concepts/8.typescript.md` around lines 106 - 113, The documentation incorrectly references the Nuxt config property as typescript.TSConfig (capital "TS"); update the text to use the correct property name typescript.tsConfig (lowercase "ts") wherever mentioned and ensure the distinction versus typescript.nodeTsConfig remains clear so readers use typescript.tsConfig for Nuxt app-context type-checking and typescript.nodeTsConfig for Node-context files.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docs/3.guide/1.concepts/8.typescript.md`:
- Around line 115-117: Tighten the ::read-more block punctuation by removing the
trailing period inside the directive text so it reads
::read-more{to="/docs/4.x/getting-started/testing#typescript-support-in-tests"}For
test-specific examples, see TypeScript Support in Tests::, or alternatively
place the sentence-ending period after the closing directive; update the
::read-more block (the directive targeting
"/docs/4.x/getting-started/testing#typescript-support-in-tests") accordingly to
avoid the “Loose punctuation mark” lint warning.
- Around line 106-113: The documentation incorrectly references the Nuxt config
property as typescript.TSConfig (capital "TS"); update the text to use the
correct property name typescript.tsConfig (lowercase "ts") wherever mentioned
and ensure the distinction versus typescript.nodeTsConfig remains clear so
readers use typescript.tsConfig for Nuxt app-context type-checking and
typescript.nodeTsConfig for Node-context files.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 71df0ec7-0885-497d-bf10-7dc2befb24e8
📒 Files selected for processing (1)
docs/3.guide/1.concepts/8.typescript.md
|
I have added and also restructured the API reference sections to better match the existing doc style — changed |
- Add `<!-- @case-police-ignore tsConfig -->` to prevent auto-correction - Fix `typescript.TSConfig` -> `typescript.tsConfig` in guide - Restructure API reference: extract `include` as a sub-section under `### tsConfig`/`### nodeTsConfig`
4d3af7a to
0a53787
Compare
🔗 Linked issue
resolves #34756
📚 Description
Adds documentation for how to include custom files in type-checking, as requested by @danielroe in the issue.
Changes:
docs/4.api/6.nuxt-config.md— Added usage examples fortypescript.tsConfigandtypescript.nodeTsConfig, with guidance on when to use each option.docs/3.guide/1.concepts/8.typescript.md— Added a new "Including Custom Files in Type-Checking" section after## Project References, explaining that files outside standard directories (e.g.,tests/) are not type-checked by default and how to include them using the relevant config option, with links to the API reference.