diff --git a/src/index.ts b/src/index.ts index 28b1fbd9..ea3e5350 100755 --- a/src/index.ts +++ b/src/index.ts @@ -236,7 +236,7 @@ async function createApp(projectName: string, options: Required) { // Setup tsconfig if (options.typescript) { - await copyFiles(templateDirBase, ['./tsconfig.json', './tsconfig.dev.json']) + await copyFiles(templateDirBase, ['./tsconfig.json']) } // Setup the package.json file, optionally with typescript and tailwind diff --git a/templates/base/README.md.ejs b/templates/base/README.md.ejs index 89dc1caa..18f3bb31 100644 --- a/templates/base/README.md.ejs +++ b/templates/base/README.md.ejs @@ -61,7 +61,7 @@ With this set up you should be able to navigate to `/about` and see the about pa Of course you don't need to implement the About page in the `main.<%= jsx %>` file. You can create that component in another file and import it into the `main.<%= jsx %>` file, then use it in the `component` property of the `createRoute` call, like so: ```tsx -import About from "./components/About"; +import About from "./components/About.<%= jsx %>"; const aboutRoute = createRoute({ getParentRoute: () => rootRoute, @@ -298,7 +298,7 @@ import { RouterProvider, createRouter } from "@tanstack/react-router"; import { routeTree } from "./routeTree.gen"; import "./styles.css"; -import reportWebVitals from "./reportWebVitals"; +import reportWebVitals from "./reportWebVitals.<%= js %>"; // Create a new router instance const router = createRouter({ routeTree }); diff --git a/templates/base/package.json b/templates/base/package.json index 19348446..04dab92e 100644 --- a/templates/base/package.json +++ b/templates/base/package.json @@ -4,7 +4,7 @@ "type": "module", "scripts": { "start": "vite --port 3000", - "build": "vite build && tsc --noEmit", + "build": "vite build && tsc", "serve": "vite preview", "test": "vitest run" }, diff --git a/templates/base/src/App.test.tsx.ejs b/templates/base/src/App.test.tsx.ejs index 943856cc..b4b45d96 100644 --- a/templates/base/src/App.test.tsx.ejs +++ b/templates/base/src/App.test.tsx.ejs @@ -1,6 +1,6 @@ import { describe, expect, test } from "vitest"; import { render, screen } from "@testing-library/react"; -import App from "./App"; +import App from "./App.<%= jsx %>"; describe("App", () => { test("renders", () => { diff --git a/templates/base/tsconfig.dev.json b/templates/base/tsconfig.dev.json deleted file mode 100644 index 285a09b0..00000000 --- a/templates/base/tsconfig.dev.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "composite": true, - "extends": "../../../tsconfig.base.json", - - "files": ["src/main.tsx"], - "include": [ - "src" - // "__tests__/**/*.test.*" - ] -} diff --git a/templates/base/tsconfig.json b/templates/base/tsconfig.json index 34214ce6..0c9087e6 100644 --- a/templates/base/tsconfig.json +++ b/templates/base/tsconfig.json @@ -1,10 +1,24 @@ { + "include": ["**/*.ts", "**/*.tsx"], "compilerOptions": { - "strict": true, - "types": ["vite/client", "node"], - "esModuleInterop": true, + "target": "ES2022", "jsx": "react-jsx", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "skipLibCheck": true + "module": "ESNext", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "types": ["vite/client"], + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + /* Linting */ + "skipLibCheck": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true } } diff --git a/templates/code-router/src/main.tsx.ejs b/templates/code-router/src/main.tsx.ejs index c6b040ee..751a344e 100644 --- a/templates/code-router/src/main.tsx.ejs +++ b/templates/code-router/src/main.tsx.ejs @@ -10,9 +10,9 @@ import { import { TanStackRouterDevtools } from "@tanstack/router-devtools"; import "./styles.css"; -import reportWebVitals from "./reportWebVitals"; +import reportWebVitals from "./reportWebVitals.<%= js %>"; -import App from "./App"; +import App from "./App.<%= jsx %>"; const rootRoute = createRootRoute({ component: () => ( diff --git a/templates/file-router/src/main.tsx.ejs b/templates/file-router/src/main.tsx.ejs index ab53d49c..c37954e8 100644 --- a/templates/file-router/src/main.tsx.ejs +++ b/templates/file-router/src/main.tsx.ejs @@ -6,7 +6,7 @@ import { RouterProvider, createRouter } from "@tanstack/react-router"; import { routeTree } from "./routeTree.gen"; import "./styles.css"; -import reportWebVitals from "./reportWebVitals"; +import reportWebVitals from "./reportWebVitals.<%= js %>"; // Create a new router instance const router = createRouter({ routeTree });