Skip to content

Commit 63f5467

Browse files
Merge pull request #53 from aligent/feature/MI-250-microservice-config
MI-250: Add tsconfig-extend to support Typescript project references
2 parents 18f0ed4 + 540222b commit 63f5467

3 files changed

Lines changed: 39 additions & 15 deletions

File tree

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ Standard code quality tooling for projects written in TypeScript.
4040
module.exports = prettierConfig;
4141
```
4242

43-
### Install the ESLint and TypeScript configs:
43+
### Add the following to your `eslint.config.js`:
4444

4545
#### General Projects
4646

47-
##### Add the following to your `eslint.config.js`:
48-
4947
- For ES modules project:
5048

5149
```javascript
@@ -62,16 +60,8 @@ Standard code quality tooling for projects written in TypeScript.
6260
module.exports = [...eslintConfigs.base];
6361
```
6462

65-
##### Add the following to your `tsconfig.json`:
66-
67-
```json
68-
{ "extends": "@aligent/ts-code-standards/tsconfigs/base.json" }
69-
```
70-
7163
#### React Projects
7264

73-
##### Add the following to your `eslint.config.js`:
74-
7565
- For ES modules project:
7666

7767
```javascript
@@ -88,14 +78,29 @@ Standard code quality tooling for projects written in TypeScript.
8878
module.exports = [...eslintConfigs.react];
8979
```
9080

91-
##### Add the following to your `tsconfig.json`:
81+
### Add the following to your `tsconfig.json`:
9282

93-
```json
94-
{ "extends": "@aligent/ts-code-standards/tsconfigs/react.json" }
95-
```
83+
- General project:
84+
85+
```json
86+
{ "extends": "@aligent/ts-code-standards/tsconfigs-base" }
87+
```
88+
89+
- Extend project (general project but requires TypeScript project references features):
90+
91+
```json
92+
{ "extends": "@aligent/ts-code-standards/tsconfigs-extend" }
93+
```
94+
95+
- React project:
96+
97+
```json
98+
{ "extends": "@aligent/ts-code-standards/tsconfigs-react" }
99+
```
96100

97101
## Notes
98102

99103
- You'll need to add `include`, `exclude`, `paths` etc. to your `tsconfig` file. These settings will be project specific.
100104
- 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/).
101105
- 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.
106+
- 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.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"import": "./dist/index.mjs"
88
},
99
"./tsconfigs-base": "./tsconfigs/base.json",
10+
"./tsconfigs-extend": "./tsconfigs/extend.json",
1011
"./tsconfigs-react": "./tsconfigs/react.json",
1112
"./tsconfigs/base.json": "./tsconfigs/base.json",
1213
"./tsconfigs/react.json": "./tsconfigs/react.json"

tsconfigs/extend.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "./base.json",
4+
"compilerOptions": {
5+
"composite": true,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true,
9+
"forceConsistentCasingInFileNames": true,
10+
"importHelpers": true,
11+
"moduleResolution": "bundler",
12+
"module": "ESNext",
13+
"noUncheckedSideEffectImports": true,
14+
"strictNullChecks": true,
15+
"target": "ESNext",
16+
"types": ["node", "vitest", "vitest/globals"]
17+
}
18+
}

0 commit comments

Comments
 (0)