mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
feat: jsdoc and comments
This commit is contained in:
parent
0ab2ea971b
commit
89aba33116
3 changed files with 74 additions and 4 deletions
|
@ -96,6 +96,8 @@ async function setupTsconfig(settings: AstroSettings, fs: typeof fsMod, logger:
|
|||
relative(fileURLToPath(settings.dotAstroDir), fileURLToPath(settings.config.outDir)),
|
||||
);
|
||||
|
||||
// TODO: handle relative include/exclude! Users will add values relative to the root,
|
||||
// but here they should be relative to dotAstroDir
|
||||
const expectedContent = JSON.stringify(
|
||||
{
|
||||
include: [...(settings.config.experimental.typescript?.include ?? []), relativeDtsPath],
|
||||
|
|
|
@ -1445,7 +1445,6 @@ export interface AstroUserConfig {
|
|||
validateSecrets?: boolean;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @kind heading
|
||||
|
@ -1975,7 +1974,38 @@ export interface AstroUserConfig {
|
|||
* @version 5.0.0
|
||||
* @description
|
||||
*
|
||||
* TODO:
|
||||
* Enables the generation of `.astro/tsconfig.json`. This allows to exclude the `distDir` by default to avoid `astro check` false positives.
|
||||
*
|
||||
* If you enable this option, you'll need to update your `tsconfig.json` with a new `extends` value:
|
||||
*
|
||||
* ```json title="tsconfig.json" del={2} ins={3}
|
||||
* {
|
||||
* extends: 'astro/tsconfigs/base',
|
||||
* extends: ['astro/tsconfigs/base', './.astro/tsconfig.json']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If you have `include` or `exclude` inside your root `tsconfig.json`, you'll need to move them to your Astro config:
|
||||
*
|
||||
* ```json title="tsconfig.json" del={2-3}
|
||||
* {
|
||||
* include: ['foo'],
|
||||
* exclude: ['bar']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ```js title="astro.config.*" ins={6-7}
|
||||
* import { defineConfig } from 'astro/config'
|
||||
*
|
||||
* export default defineConfig({
|
||||
* experimental: {
|
||||
* typescript: {
|
||||
* include: ['foo'],
|
||||
* exclude: ['bar']
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
typescript?: {
|
||||
/**
|
||||
|
@ -1986,7 +2016,25 @@ export interface AstroUserConfig {
|
|||
* @version 5.0.0
|
||||
* @description
|
||||
*
|
||||
* TODO:
|
||||
* If you have `include` your root `tsconfig.json`, you'll need to move it to your Astro config:
|
||||
*
|
||||
* ```json title="tsconfig.json" del={2}
|
||||
* {
|
||||
* include: ['foo']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ```js title="astro.config.*" ins={6}
|
||||
* import { defineConfig } from 'astro/config'
|
||||
*
|
||||
* export default defineConfig({
|
||||
* experimental: {
|
||||
* typescript: {
|
||||
* include: ['foo']
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
include?: Array<string>;
|
||||
|
||||
|
@ -1998,7 +2046,25 @@ export interface AstroUserConfig {
|
|||
* @version 5.0.0
|
||||
* @description
|
||||
*
|
||||
* TODO:
|
||||
* If you have `exclude` your root `tsconfig.json`, you'll need to move it to your Astro config:
|
||||
*
|
||||
* ```json title="tsconfig.json" del={2}
|
||||
* {
|
||||
* exclude: ['bar']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ```js title="astro.config.*" ins={6}
|
||||
* import { defineConfig } from 'astro/config'
|
||||
*
|
||||
* export default defineConfig({
|
||||
* experimental: {
|
||||
* typescript: {
|
||||
* exclude: ['bar']
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
exclude?: Array<string>;
|
||||
};
|
||||
|
|
|
@ -76,6 +76,8 @@ function prepareExample(examplePath) {
|
|||
const tsconfig = JSON.parse(toJson(originalConfig));
|
||||
|
||||
// Swap to strictest config to make sure it also passes
|
||||
// TODO: once experimental.typescript is not a thing anymore, this needs to be updated
|
||||
// to replace the first member of the array instead of overriding
|
||||
tsconfig.extends = 'astro/tsconfigs/strictest';
|
||||
tsconfig.compilerOptions ??= {}
|
||||
tsconfig.compilerOptions.types = tsconfig.compilerOptions.types ?? []; // Speeds up tests
|
||||
|
|
Loading…
Add table
Reference in a new issue