diff --git a/templates/basic/tsconfig.json b/templates/basic/tsconfig.json index 816d09263..2c85b2d99 100644 --- a/templates/basic/tsconfig.json +++ b/templates/basic/tsconfig.json @@ -1,19 +1,35 @@ { + // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, + // output .d.ts declaration files for consumers "declaration": true, + // output .js.map sourcemap files for consumers "sourceMap": true, + // match output dir to input dir. e.g. dist/index instead of dist/src/index "rootDir": "./src", + // stricter type-checking for stronger correctness. Recommended by TS "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + // linter checks for common issues "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, + // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative + "noUnusedLocals": true, + "noUnusedParameters": true, + // use Node's module resolution algorithm, instead of the legacy TS one "moduleResolution": "node", + // transpile JSX to React.createElement "jsx": "react", - "esModuleInterop": true + // interop between ESM and CJS modules. Recommended by TS + "esModuleInterop": true, + // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS + "skipLibCheck": true, + // error out if import and file system have a casing mismatch. Recommended by TS + "forceConsistentCasingInFileNames": true, + // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc` + "noEmit": true, } } diff --git a/templates/react-with-storybook/tsconfig.json b/templates/react-with-storybook/tsconfig.json index 816d09263..2c85b2d99 100644 --- a/templates/react-with-storybook/tsconfig.json +++ b/templates/react-with-storybook/tsconfig.json @@ -1,19 +1,35 @@ { + // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, + // output .d.ts declaration files for consumers "declaration": true, + // output .js.map sourcemap files for consumers "sourceMap": true, + // match output dir to input dir. e.g. dist/index instead of dist/src/index "rootDir": "./src", + // stricter type-checking for stronger correctness. Recommended by TS "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + // linter checks for common issues "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, + // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative + "noUnusedLocals": true, + "noUnusedParameters": true, + // use Node's module resolution algorithm, instead of the legacy TS one "moduleResolution": "node", + // transpile JSX to React.createElement "jsx": "react", - "esModuleInterop": true + // interop between ESM and CJS modules. Recommended by TS + "esModuleInterop": true, + // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS + "skipLibCheck": true, + // error out if import and file system have a casing mismatch. Recommended by TS + "forceConsistentCasingInFileNames": true, + // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc` + "noEmit": true, } } diff --git a/templates/react/tsconfig.json b/templates/react/tsconfig.json index 816d09263..2c85b2d99 100644 --- a/templates/react/tsconfig.json +++ b/templates/react/tsconfig.json @@ -1,19 +1,35 @@ { + // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs "include": ["src", "types"], "compilerOptions": { "module": "esnext", "lib": ["dom", "esnext"], "importHelpers": true, + // output .d.ts declaration files for consumers "declaration": true, + // output .js.map sourcemap files for consumers "sourceMap": true, + // match output dir to input dir. e.g. dist/index instead of dist/src/index "rootDir": "./src", + // stricter type-checking for stronger correctness. Recommended by TS "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + // linter checks for common issues "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, + // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative + "noUnusedLocals": true, + "noUnusedParameters": true, + // use Node's module resolution algorithm, instead of the legacy TS one "moduleResolution": "node", + // transpile JSX to React.createElement "jsx": "react", - "esModuleInterop": true + // interop between ESM and CJS modules. Recommended by TS + "esModuleInterop": true, + // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS + "skipLibCheck": true, + // error out if import and file system have a casing mismatch. Recommended by TS + "forceConsistentCasingInFileNames": true, + // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc` + "noEmit": true, } } diff --git a/test/e2e/fixtures/build-default/tsconfig.json b/test/e2e/fixtures/build-default/tsconfig.json index b25c2e554..d0dea9704 100644 --- a/test/e2e/fixtures/build-default/tsconfig.json +++ b/test/e2e/fixtures/build-default/tsconfig.json @@ -12,7 +12,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "include": ["src", "types"] } diff --git a/test/e2e/fixtures/build-invalid/tsconfig.json b/test/e2e/fixtures/build-invalid/tsconfig.json index b25c2e554..d0dea9704 100644 --- a/test/e2e/fixtures/build-invalid/tsconfig.json +++ b/test/e2e/fixtures/build-invalid/tsconfig.json @@ -12,7 +12,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "include": ["src", "types"] } diff --git a/test/e2e/fixtures/build-withTsconfig/tsconfig.base.json b/test/e2e/fixtures/build-withTsconfig/tsconfig.base.json index c5a66c1ea..639f22f26 100644 --- a/test/e2e/fixtures/build-withTsconfig/tsconfig.base.json +++ b/test/e2e/fixtures/build-withTsconfig/tsconfig.base.json @@ -14,7 +14,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": false + "esModuleInterop": false, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "include": ["src", "types"], // test parsing of trailing comma & comment } diff --git a/test/integration/fixtures/build-options/tsconfig.json b/test/integration/fixtures/build-options/tsconfig.json index 3645ceed5..bb0179011 100644 --- a/test/integration/fixtures/build-options/tsconfig.json +++ b/test/integration/fixtures/build-options/tsconfig.json @@ -12,7 +12,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "include": ["src", "types"], } diff --git a/test/integration/fixtures/build-withBabel/tsconfig.json b/test/integration/fixtures/build-withBabel/tsconfig.json index 3645ceed5..547e772e3 100644 --- a/test/integration/fixtures/build-withBabel/tsconfig.json +++ b/test/integration/fixtures/build-withBabel/tsconfig.json @@ -12,7 +12,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": false }, "include": ["src", "types"], } diff --git a/test/integration/fixtures/build-withConfig/tsconfig.json b/test/integration/fixtures/build-withConfig/tsconfig.json index 3645ceed5..bb0179011 100644 --- a/test/integration/fixtures/build-withConfig/tsconfig.json +++ b/test/integration/fixtures/build-withConfig/tsconfig.json @@ -12,7 +12,10 @@ "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "jsx": "react", - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true }, "include": ["src", "types"], }