1.2 KiB
1.2 KiB
name, description, triggers
| name | description | triggers | |||
|---|---|---|---|---|---|
| TSConfig Aliases | Adds and documents TypeScript path aliases and how to wire them into Vite, Jest/Vitest, and ESLint. |
|
TSConfig Aliases
Purpose
- Add
pathsandbaseUrltotsconfig.jsonand document the steps to wire the aliases to tooling (Vite, Vitest/Jest, ESLint, IDEs).
Example prompts
- "create tsconfig paths for @/components, @/utils"
- "make imports use @/ alias and configure Vite"
Output
- Suggested
tsconfig.jsonpatch and examplepathsmapping.
Example tsconfig snippet
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@components/*": ["src/components/*"]
}
}
}
Wiring notes
- Add
vite-tsconfig-pathsto Vite plugins or set the same aliases invite.config.ts. - For ESLint resolver, add
eslint-import-resolver-typescripttosettings.import/resolver. - Update IDE settings if necessary (VSCode uses tsconfig by default).
Common pitfalls
- Ensure
baseUrlis set (often.) and that path globs match the file layout. - Restart the TypeScript server in the editor after changes.