Skip to content

Instantly share code, notes, and snippets.

@kumarasinghe
Created April 11, 2023 20:00
Show Gist options
  • Save kumarasinghe/f71db1c2ac7cac34c1f5e157425a6343 to your computer and use it in GitHub Desktop.
Save kumarasinghe/f71db1c2ac7cac34c1f5e157425a6343 to your computer and use it in GitHub Desktop.
tsconfig with sensible defaults
{
"compilerOptions": {
/***** BASIC OPTIONS *****/
/* target ECMAScript version */
"target": "esnext",
/* use ECMAScript module system */
"module": "esnext",
/* treat files as isolated independent modules */
"isolatedModules": true,
/* enable importing modules with absolute paths */
"baseUrl": ".",
/* import path aliases */
"paths": {
"@/*": ["src/*"]
},
/***** MODULE RESOLUTION OPTIONS *****/
/* resolve imports like NodeJS */
"moduleResolution": "node",
/* allow default imports from modules without default exports */
"allowSyntheticDefaultImports": true,
/* allow importing CommonJS modules as ECMAScript modules */
"esModuleInterop": true,
/* enable importing json */
"resolveJsonModule": true,
/***** TYPE CHECKING OPTIONS *****/
/* enable strict type-checking */
"strict": true,
/* raise error for implicit any types */
"noImplicitAny": true,
/* treat null different from undefined */
"strictNullChecks": true,
/* raise error when `this` is refereed in an unknown context */
"noImplicitThis": true,
/* enable ECMAScript strict mode */
"alwaysStrict": true,
/***** ADDITIONAL CHECKS *****/
/* raise errors on unused locals */
"noUnusedLocals": true,
/* raise errors on unused parameters */
"noUnusedParameters": true,
/* raise error when not all code paths in function return a value */
"noImplicitReturns": true,
/* raise errors for fallthrough cases in switch statement. */
"noFallthroughCasesInSwitch": true,
/* check casing when importing modules */
"forceConsistentCasingInFileNames": true,
/* speed up type checking with caching */
"incremental": true,
/* do not clear console output on change */
"preserveWatchOutput": true,
/* skip type checking for library code */
"skipLibCheck": true,
/* raise error when accessing fields with an non-indexed key */
"noUncheckedIndexedAccess": true,
/* distinguish undefined from absence of a value */
"exactOptionalPropertyTypes": true,
/* raise error for unreachable code */
"allowUnreachableCode": false,
/* raise error for unused labels */
"allowUnusedLabels": false,
/***** REACT SPECIFIC OPTIONS *****/
/* jsx to js transformation method */
"jsx": "react-jsx",
/* use react when importing jsx modules */
"jsxImportSource": "react",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment