diff --git a/README.md b/README.md index 8e7c24d..0323b8d 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,10 @@ Standard code quality tooling for projects written in TypeScript. module.exports = prettierConfig; ``` -### Install the ESLint and TypeScript configs: +### Add the following to your `eslint.config.js`: #### General Projects -##### Add the following to your `eslint.config.js`: - - For ES modules project: ```javascript @@ -62,16 +60,8 @@ Standard code quality tooling for projects written in TypeScript. module.exports = [...eslintConfigs.base]; ``` -##### Add the following to your `tsconfig.json`: - -```json -{ "extends": "@aligent/ts-code-standards/tsconfigs/base.json" } -``` - #### React Projects -##### Add the following to your `eslint.config.js`: - - For ES modules project: ```javascript @@ -88,14 +78,29 @@ Standard code quality tooling for projects written in TypeScript. module.exports = [...eslintConfigs.react]; ``` -##### Add the following to your `tsconfig.json`: +### Add the following to your `tsconfig.json`: -```json -{ "extends": "@aligent/ts-code-standards/tsconfigs/react.json" } -``` +- General project: + + ```json + { "extends": "@aligent/ts-code-standards/tsconfigs-base" } + ``` + +- Extend project (general project but requires TypeScript project references features): + + ```json + { "extends": "@aligent/ts-code-standards/tsconfigs-extend" } + ``` + +- React project: + + ```json + { "extends": "@aligent/ts-code-standards/tsconfigs-react" } + ``` ## Notes - You'll need to add `include`, `exclude`, `paths` etc. to your `tsconfig` file. These settings will be project specific. - Your project is considered as `ES modules` project if the `type` option in the nearest `package.json` is set to `module`. Otherwise, it's a CommonJS project. For more information on this, please check [CommonJS vs. ES modules in Node.js](https://blog.logrocket.com/commonjs-vs-es-modules-node-js/). - For backward compatibility, we also export `./tsconfigs/base.json` and `./tsconfigs/react.json`. However, you should update to the new syntax when configuring your `tsconfig.json` when possible. +- The `tsconfigs-extend` is the configuration for general projects that require TypeScript project references features to enable incremental builds. This is particular useful for monorepo where we have to manage different packages. diff --git a/package.json b/package.json index d12a076..5169352 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "import": "./dist/index.mjs" }, "./tsconfigs-base": "./tsconfigs/base.json", + "./tsconfigs-extend": "./tsconfigs/extend.json", "./tsconfigs-react": "./tsconfigs/react.json", "./tsconfigs/base.json": "./tsconfigs/base.json", "./tsconfigs/react.json": "./tsconfigs/react.json" diff --git a/tsconfigs/extend.json b/tsconfigs/extend.json new file mode 100644 index 0000000..693ca84 --- /dev/null +++ b/tsconfigs/extend.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "./base.json", + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "moduleResolution": "bundler", + "module": "ESNext", + "noUncheckedSideEffectImports": true, + "strictNullChecks": true, + "target": "ESNext", + "types": ["node", "vitest", "vitest/globals"] + } +}