Skip to content

Commit

Permalink
feat: implement typescript configs V1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Aug 12, 2024
1 parent 60e4e74 commit 79e8dc2
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 18 deletions.
15 changes: 2 additions & 13 deletions src/eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"extends": "../typescript/cjs/tsconfig.json",
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"target": "ES2022",
"outDir": "dist",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"resolveJsonModule": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"rootDir": "./src",
"types": ["node"]
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
49 changes: 49 additions & 0 deletions src/typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<p align="center"><h1 align="center">
TypeScript Config
</h1>

<div align="center">OpenAlly TypeScript CJS & ESM configurations.</div>

## Getting Started

This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).

```bash
$ npm i -D @openally/config.typescript
# or
$ yarn add @openally/config.typescript -D
```

## Usage

```json
{
"extends": "@openally/config.typescript/cjs",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

```

Use either **cjs** or **esm**

```json
{
"exports": {
"./esm": "./src/esm/tsconfig.json",
"./cjs": "./src/cjs/tsconfig.json"
}
}
```

> [!NOTE]
> The original inspiration for those configurations is [The TSConfig Cheat Sheet
](https://www.totaltypescript.com/tsconfig-cheat-sheet) by Matt Pocock.


## License
MIT
26 changes: 26 additions & 0 deletions src/typescript/cjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
/* Base Options: */
"esModuleInterop": true,
"skipLibCheck": true,
"target": "es2022",
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",
"isolatedModules": true,
"verbatimModuleSyntax": false,

/* Strictness */
"strict": true,
"noUncheckedIndexedAccess": false,
"noImplicitOverride": true,

/* Others */
"module": "CommonJS",
"sourceMap": true,
"declaration": true,
"composite": false,
"declarationMap": true,
"lib": ["es2022"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,5 @@
"composite": false,
"declarationMap": true,
"lib": ["es2022"]
},
"exclude": [
"node_modules"
]
}
}
3 changes: 2 additions & 1 deletion src/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "TypeScript configuration (TSConfig)",
"exports": {
"./tsconfig": "./src/tsconfig.json"
"./esm": "./src/esm/tsconfig.json",
"./cjs": "./src/cjs/tsconfig.json"
},
"files": [
"src"
Expand Down

0 comments on commit 79e8dc2

Please sign in to comment.