Skip to content

Commit

Permalink
docs: use consistent tsconfig for both in docs and bun init (#8953)
Browse files Browse the repository at this point in the history
  • Loading branch information
risu729 authored Feb 17, 2024
1 parent a6acb25 commit bc74154
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/guides/runtime/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Below is the full set of recommended `compilerOptions` for a Bun project. With t
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx", // support JSX
"allowJs": true, // allow importing `.js` from `.ts`
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
Expand Down
6 changes: 3 additions & 3 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Bun supports things like top-level await, JSX, and extensioned `.ts` imports, wh
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx", // support JSX
"allowJs": true, // allow importing `.js` from `.ts`
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
Expand All @@ -44,7 +44,7 @@ Bun supports things like top-level await, JSX, and extensioned `.ts` imports, wh
}
```

If you run `bun init` in a new directory, this `tsconfig.json` will be generated for you.
If you run `bun init` in a new directory, this `tsconfig.json` will be generated for you. (The stricter flags are disabled by default.)

```sh
$ bun init
Expand Down
10 changes: 8 additions & 2 deletions src/cli/tsconfig-for-init.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

/* Bundler mode */
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

/* Linting */
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

0 comments on commit bc74154

Please sign in to comment.