@4mbl/tsconfig 0.0.0-alpha.098038f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,75 @@
1
+ # @4mbl/tsconfig Changelog
2
+
3
+ ## 5.0.0-beta.0
4
+
5
+ ### Major Changes
6
+
7
+ - e651e24: Enable `noUncheckedSideEffectImports` on all templates. This is the default in TypeScript 6/7, we set it explicitly to ensure consistent behavior for templates that already enabled it.
8
+ - e651e24: Disable automatic type discovery to align with TypeScript 6/7 behavior. Node.js types are now explicitly enabled for Node.js related templates.
9
+ - e651e24: All templates now have `rootDir` option set to './src' to align with TypeScript 6/7 behavior.
10
+ - e651e24: Drop explicit "dom.iterable" from `lib` as it is included in "dom" by default in TypeScript 6/7.
11
+ - e651e24: Remove explicit `target` from all templates to use the latest ECMAScript version in TypeScript 6/7. The ES version on `lib` is now "ESNext" all templates.
12
+
13
+ ## 4.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 05ab9ba: [browser,node,node-ts] Replace `baseUrl` with `paths` catch-all to improve TypeScript 7 support.
18
+
19
+ ## 4.3.0
20
+
21
+ ### Minor Changes
22
+
23
+ - ce274df: node-ts: add rewriteRelativeImportExtensions
24
+
25
+ ## 4.2.0
26
+
27
+ ### Minor Changes
28
+
29
+ - 090f642: Add node-ts template.
30
+
31
+ ## 4.1.3
32
+
33
+ ### Patch Changes
34
+
35
+ - 0957212: Migrate to monorepo setup internally. No changes to the package itself.
36
+
37
+ ## 4.1.2
38
+
39
+ - Setup npm trusted publishing. No changes to the package itself.
40
+
41
+ ## 4.1.1
42
+
43
+ - Fixed missing artifacts in the previous release.
44
+
45
+ ## 4.1.0
46
+
47
+ - Add vite-react template.
48
+
49
+ ## 4.0.1
50
+
51
+ - Move `baseUrl` definition from the base template to child templates to improve Next.js support.
52
+
53
+ ## 4.0.0
54
+
55
+ - Migrated from versioned templates to a single template per type. The package version is now used to determine the template version. This simplifies both the maintenance and usage of the package.
56
+ - Enabled the following options in the base template:
57
+ - `declarationMap`
58
+ - `tsBuildInfoFile` set to `node_modules/.tmp/tsbuildinfo`
59
+ - `verbatimModuleSyntax`
60
+ - `allowSyntheticDefaultImports`
61
+ - `noImplicitOverride`
62
+ - In the Next.js all paths now use paths relative to the project.
63
+ - Removed `tsBuildInfoFile` from browser template in favor of the base template value.
64
+
65
+ ## 3.0.0
66
+
67
+ - Enabled `erasableSyntaxOnly` option in the base template. Requires TypeScript 5.8.0+.
68
+
69
+ ## 2.0.0
70
+
71
+ - Changed path options to use `${configDir}` instead of relative paths in base template. Requires TypeScript 5.5.0+.
72
+
73
+ ## 1.0.0
74
+
75
+ - Initial release
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @4mbl/tsconfig
2
+
3
+ > Strict TypeScript configuration for various environments.
4
+
5
+ * [Usage](#usage)
6
+ * [Available templates](#available-templates)
7
+ * [Base (tsconfig)](#base-tsconfig)
8
+ * [Node (tsconfig)](#node-tsconfig)
9
+ * [Node-TS (tsconfig)](#node-ts-tsconfig)
10
+ * [Browser (tsconfig)](#browser-tsconfig)
11
+ * [Next (tsconfig)](#next-tsconfig)
12
+ * [Vite React (app | node)](#vite-react-app--node)
13
+ * [Versioning](#versioning)
14
+
15
+ ---
16
+
17
+ ## Usage
18
+
19
+ Install the [`@4mbl/tsconfig`](https://www.npmjs.com/package/@4mbl/tsconfig) npm package.
20
+
21
+ ```shell
22
+ npm install -D @4mbl/tsconfig
23
+ ```
24
+
25
+ Create a `tsconfig.json` file in the root of your project and extend the desired `tsconfig` template.
26
+
27
+ ```jsonc
28
+ {
29
+ "extends": "@4mbl/tsconfig/node"
30
+ // your custom configuration...
31
+ }
32
+ ```
33
+
34
+ ## Available templates
35
+
36
+ These are the currently available `tsconfig` templates.
37
+
38
+ ### Base (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/base.json)</kbd>)
39
+
40
+ This is the base `tsconfig` file that is used by the other templates. It contains common configuration for TypeScript with minimal environment specific configuration.
41
+
42
+ ### Node (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/node.json)</kbd>)
43
+
44
+ Extends the base template with configuration specific to Node.js.
45
+
46
+ ### Node-TS (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/node-ts.json)</kbd>)
47
+
48
+ Extends the node template with configuration for TypeScript-only projects.
49
+
50
+ ### Browser (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/browser.json)</kbd>)
51
+
52
+ Extends the base template with configuration specific to browser and React applications.
53
+
54
+ ### Next (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/next.json)</kbd>)
55
+
56
+ Extends the base template with configuration from the Next.js app template.
57
+
58
+ [Next.js does not yet support tsconfig template variables](https://github.com/vercel/next.js/issues/70912), so you need to override the paths manually on the `tsconfig.json` file of your project.
59
+
60
+ ```jsonc
61
+ {
62
+ "extends": "@4mbl/tsconfig/next",
63
+ "compilerOptions": {
64
+ "paths": {
65
+ "@/*": ["./src/*"]
66
+ }
67
+ },
68
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
69
+ "exclude": ["node_modules"]
70
+ }
71
+ ```
72
+
73
+ ### Vite React (<kbd>[app](https://unpkg.com/@4mbl/tsconfig@latest/vite-react/app.json)</kbd> | <kbd>[node](https://unpkg.com/@4mbl/tsconfig@latest/vite-react/node.json)</kbd>)
74
+
75
+ Extends the base template with configuration from Vite's `react-ts` preset.
76
+
77
+ Vite uses seperate `tsconfig` files for the application and the node environment. So you need to have three files in total:
78
+
79
+ **`tsconfig.json`**
80
+
81
+ ```jsonc
82
+ {
83
+ "files": [],
84
+ "references": [
85
+ { "path": "./tsconfig.app.json" },
86
+ { "path": "./tsconfig.node.json" }
87
+ ]
88
+ }
89
+ ```
90
+
91
+ **`tsconfig.app.json`**
92
+
93
+ ```jsonc
94
+ {
95
+ "extends": "@4mbl/tsconfig/vite-react/app"
96
+ }
97
+ ```
98
+
99
+ **`tsconfig.node.json`**
100
+
101
+ ```jsonc
102
+ {
103
+ "extends": "@4mbl/tsconfig/vite-react/node"
104
+ }
105
+ ```
106
+
107
+ ## Versioning
108
+
109
+ As of version 4.0.0, the package migrated to a single template per type. The package version is now used to determine the template version. This simplifies both the maintenance and usage of the package.
110
+
111
+ The package follows the following versioning scheme: `X.Y.Z`
112
+
113
+ - `X` - Breaking changes to the base template.
114
+ - `Y` - Breaking changes to individual, non-base templates. New templates may be introduced.
115
+ - `Z` - Minor fixes to any template.
package/dist/base.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Base",
4
+ "compilerOptions": {
5
+ /* Base Options */
6
+ "rootDir": "${configDir}/src",
7
+ "lib": ["esnext"],
8
+ "allowJs": true,
9
+ "skipLibCheck": true,
10
+ "resolveJsonModule": true,
11
+ "moduleDetection": "force",
12
+ "paths": {
13
+ "@/*": ["${configDir}/src/*"]
14
+ },
15
+ "types": [],
16
+
17
+ /* Output */
18
+ //* "target" is omitted here intentionally, typescript
19
+ //* defaults to current year's ecmascript standard
20
+
21
+ "outDir": "${configDir}/dist",
22
+ "sourceMap": true,
23
+ "declarationMap": true,
24
+ "declaration": true,
25
+ "incremental": true,
26
+ "isolatedModules": true,
27
+ "esModuleInterop": true,
28
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.tsbuildinfo",
29
+ "verbatimModuleSyntax": true,
30
+
31
+ /* Linting */
32
+ "strict": true,
33
+ "checkJs": true,
34
+ "erasableSyntaxOnly": true,
35
+ "forceConsistentCasingInFileNames": true,
36
+ "allowSyntheticDefaultImports": true,
37
+ "noFallthroughCasesInSwitch": true,
38
+ "noImplicitAny": true,
39
+ "noImplicitOverride": true,
40
+ "noImplicitReturns": false,
41
+ "noUnusedLocals": true,
42
+ "noUnusedParameters": true,
43
+ "noUncheckedIndexedAccess": true,
44
+ "noUncheckedSideEffectImports": true
45
+ },
46
+ "include": ["${configDir}/src/**/*"],
47
+ "exclude": ["${configDir}/node_modules"]
48
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Browser",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["esnext", "dom"],
7
+ "jsx": "react-jsx",
8
+ "module": "ESNext",
9
+ "moduleResolution": "Bundler",
10
+ "paths": { "*": ["${configDir}/src/*"] },
11
+ "types": [],
12
+ "noEmit": true,
13
+ "sourceMap": true
14
+ }
15
+ }
package/dist/next.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Next.js",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["esnext", "dom"],
7
+ "allowJs": true,
8
+ "skipLibCheck": true,
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "module": "preserve",
13
+ "moduleResolution": "bundler",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "jsx": "preserve",
17
+ "incremental": true,
18
+ "plugins": [
19
+ {
20
+ "name": "next"
21
+ }
22
+ ],
23
+ "paths": {
24
+ "@/*": ["${configDir}/src/*"]
25
+ },
26
+ "types": ["node"]
27
+ },
28
+ "include": [
29
+ "${configDir}/next-env.d.ts",
30
+ "${configDir}/**/*.ts",
31
+ "${configDir}/**/*.tsx",
32
+ "${configDir}/.next/types/**/*.ts"
33
+ ],
34
+ "exclude": ["${configDir}/node_modules"]
35
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Node (TS)",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ // same options as node template
7
+ "moduleResolution": "NodeNext",
8
+ "module": "NodeNext",
9
+ "paths": { "*": ["${configDir}/src/*"] },
10
+ "types": ["node"],
11
+
12
+ // options for typescript-only
13
+ // https://nodejs.org/api/typescript.html#type-stripping
14
+ "noEmit": true,
15
+ "allowImportingTsExtensions": true,
16
+ "rewriteRelativeImportExtensions": true
17
+ }
18
+ }
package/dist/node.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Node",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "moduleResolution": "NodeNext",
7
+ "module": "NodeNext",
8
+ "paths": { "*": ["${configDir}/src/*"] },
9
+ "types": ["node"]
10
+ }
11
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Vite React (App)",
4
+ "extends": "../base.json",
5
+ "compilerOptions": {
6
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
+ "useDefineForClassFields": true,
8
+ "lib": ["esnext", "dom"],
9
+ "module": "ESNext",
10
+ "types": [],
11
+
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "allowImportingTsExtensions": true,
15
+ "noEmit": true,
16
+ "jsx": "react-jsx"
17
+ },
18
+ "include": ["${configDir}/src"]
19
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Vite React (Node)",
4
+ "extends": "../base.json",
5
+ "compilerOptions": {
6
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.node.tsbuildinfo",
7
+ "lib": ["esnext"],
8
+ "module": "ESNext",
9
+ "types": ["node"],
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "noEmit": true
15
+ },
16
+ "include": ["${configDir}/vite.config.ts"]
17
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@4mbl/tsconfig",
3
+ "version": "0.0.0-alpha.098038f",
4
+ "description": "Strict TypeScript configuration for various environments.",
5
+ "type": "module",
6
+ "author": "4mbl",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/4mbl/config/tree/main/packages/tsconfig#readme",
9
+ "exports": {
10
+ "./browser": "./dist/browser.json",
11
+ "./next": "./dist/next.json",
12
+ "./node-ts": "./dist/node-ts.json",
13
+ "./node": "./dist/node.json",
14
+ "./vite-react/app": "./dist/vite-react/app.json",
15
+ "./vite-react/node": "./dist/vite-react/node.json"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "package.json",
20
+ "README.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/4mbl/config.git",
26
+ "directory": "packages/tsconfig"
27
+ },
28
+ "keywords": [
29
+ "typescript",
30
+ "tsconfig"
31
+ ],
32
+ "peerDependencies": {
33
+ "typescript": ">=6.0.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "typescript": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "scripts": {
41
+ "build": "rm -rf dist && mkdir dist && cp -r templates/* dist/ && node scripts/generate-exports.mjs"
42
+ }
43
+ }