@tofrankie/tsconfig 0.0.1

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,5 @@
1
+ # Changelog
2
+
3
+ ## tsconfig@0.0.1 (2026-03-29)
4
+
5
+ - Initial release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Frankie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @tofrankie/tsconfig
2
+
3
+ ![npm version](https://img.shields.io/npm/v/@tofrankie/tsconfig) ![node version](https://img.shields.io/node/v/@tofrankie/tsconfig) ![npm package license](https://img.shields.io/npm/l/@tofrankie/tsconfig) ![npm last update](https://img.shields.io/npm/last-update/@tofrankie/tsconfig)
4
+
5
+ Shared [tsconfig](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) configuration.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ $ pnpm add typescript @tofrankie/tsconfig -D
11
+ ```
12
+
13
+ Create a `tsconfig.json` in your project root:
14
+
15
+ ```json
16
+ {
17
+ "extends": "@tofrankie/tsconfig/react.vite.json"
18
+ // other options...
19
+ }
20
+ ```
21
+
22
+ ## Presets
23
+
24
+ Use `@tofrankie/tsconfig/<filename>` in `extends`. If the last column of the table is not `—`, also add those packages to this project's devDependencies.
25
+
26
+ | Preset | Purpose (how to choose) | Extra dependencies |
27
+ | --------------------- | -------------------------------------------------- | ----------------------- |
28
+ | `strict.json` | Stricter rules | — |
29
+ | `dom.json` | Web App / DOM API | — |
30
+ | `node.json` | Node scripts / services / CLI (`@tsconfig/node20`) | — |
31
+ | `lib.json` | npm packages to publish (independent of runtime) | — |
32
+ | `node.lib.json` | Node packages to publish | — |
33
+ | `react.json` | React App (bundler-agnostic) | — |
34
+ | `react.vite.json` | React + Vite | `vite` |
35
+ | `react.lib.json` | React component libraries to publish | — |
36
+ | `react.lib.vite.json` | React component libraries developed with Vite | `vite` |
37
+ | `vue.json` | Vue 3 App (bundler-agnostic) | — |
38
+ | `vue.vite.json` | Vue 3 + Vite | `vite` |
39
+ | `vue.lib.json` | Vue 3 component libraries to publish | — |
40
+ | `vue.lib.vite.json` | Vue 3 component libraries developed with Vite | `vite` |
41
+ | `vitest.json` | Testing with Vitest | `@types/node`, `vitest` |
42
+
43
+ Dependency relationships between them: **[DEPENDENCY_GRAPH](./DEPENDENCY_GRAPH.md)**.
44
+
45
+ ## Examples
46
+
47
+ ### React + Vite
48
+
49
+ `tsconfig.json`
50
+
51
+ ```json
52
+ {
53
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }],
54
+ "files": []
55
+ }
56
+ ```
57
+
58
+ `tsconfig.app.json`
59
+
60
+ ```json
61
+ {
62
+ "extends": "@tofrankie/tsconfig/react.vite.json",
63
+ "compilerOptions": {
64
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo"
65
+ },
66
+ "include": ["src"]
67
+ }
68
+ ```
69
+
70
+ `tsconfig.node.json`
71
+
72
+ ```json
73
+ {
74
+ "extends": "@tofrankie/tsconfig/node.json",
75
+ "compilerOptions": {
76
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
77
+ },
78
+ "include": ["vite.config.ts"]
79
+ }
80
+ ```
81
+
82
+ ## Acknowledgements
83
+
84
+ Thanks to these referenced packages:
85
+
86
+ - `@tsconfig/node20`
87
+ - `@tsconfig/strictest`
88
+ - `@tsconfig/vite-react`
89
+ - `@vue/tsconfig`
90
+
91
+ ## License
92
+
93
+ MIT
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://www.schemastore.org/tsconfig",
3
+ "_version": "20.1.0",
4
+
5
+ "compilerOptions": {
6
+ "lib": ["es2023"],
7
+ "module": "nodenext",
8
+ "target": "es2022",
9
+
10
+ "strict": true,
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "moduleResolution": "node16"
14
+ }
15
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "allowUnusedLabels": false,
5
+ "allowUnreachableCode": false,
6
+ "exactOptionalPropertyTypes": true,
7
+ "noFallthroughCasesInSwitch": true,
8
+ "noImplicitOverride": true,
9
+ "noImplicitReturns": true,
10
+ "noPropertyAccessFromIndexSignature": true,
11
+ "noUncheckedIndexedAccess": true,
12
+ "noUnusedLocals": true,
13
+ "noUnusedParameters": true,
14
+
15
+ "isolatedModules": true,
16
+
17
+ "esModuleInterop": true,
18
+ "skipLibCheck": true
19
+ },
20
+ "$schema": "https://www.schemastore.org/tsconfig",
21
+ "_version": "2.0.0"
22
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://www.schemastore.org/tsconfig",
3
+ "_version": "7.0.0",
4
+
5
+ "compilerOptions": {
6
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
+ "target": "ES2022",
8
+ "useDefineForClassFields": true,
9
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
10
+ "module": "ESNext",
11
+ "skipLibCheck": true,
12
+
13
+ /* Bundler mode */
14
+ "moduleResolution": "bundler",
15
+ "allowImportingTsExtensions": true,
16
+ "verbatimModuleSyntax": true,
17
+ "moduleDetection": "force",
18
+ "noEmit": true,
19
+ "jsx": "react-jsx",
20
+
21
+ /* Linting */
22
+ "strict": true,
23
+ "noUnusedLocals": true,
24
+ "noUnusedParameters": true,
25
+ "erasableSyntaxOnly": true,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noUncheckedSideEffectImports": true
28
+ }
29
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": [
5
+ // Target ES2022 to align with Vite.
6
+ // <https://vite.dev/config/build-options.html#build-target>
7
+ // Support for newer versions of language built-ins are
8
+ // left for the users to include, because that would require:
9
+ // - either the project doesn't need to support older versions of browsers;
10
+ // - or the project has properly included the necessary polyfills.
11
+ "ES2022",
12
+
13
+ "DOM",
14
+ "DOM.Iterable"
15
+
16
+ // No `ScriptHost` because Vue 3 dropped support for IE
17
+ ],
18
+
19
+ // Set to empty to avoid accidental inclusion of unwanted types,
20
+ // e.g. the Node.js types that would pollute the global scope.
21
+ // It's the default value in TS 6+, too.
22
+ "types": []
23
+ }
24
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Most non-library projects don't need to emit declarations.
4
+ // So we add this option by default to make the config more friendly to most users.
5
+ "noEmit": true,
6
+
7
+ // As long as you are using a build tool, we recommend you to author and ship in ES modules.
8
+ // Even if you are targeting Node.js, because
9
+ // - `CommonJS` is too outdated
10
+ // - the ecosystem hasn't fully caught up with `Node16`/`NodeNext`
11
+ // This recommendation includes environments like Vitest, Vite Config File, Vite SSR, etc.
12
+ "module": "ESNext",
13
+
14
+ // We expect users to use bundlers.
15
+ // So here we enable some resolution features that are only available in bundlers.
16
+ "moduleResolution": "bundler",
17
+ "resolveJsonModule": true,
18
+ "allowImportingTsExtensions": true,
19
+ // Even files without `import` or `export` are treated as modules.
20
+ // It helps to avoid mysterious errors such as `Cannot redeclare block-scoped variable 'name`.
21
+ // https://www.totaltypescript.com/cannot-redeclare-block-scoped-variable#solution-3-your-module-isnt-a-module
22
+ "moduleDetection": "force",
23
+
24
+ // Required in Vue projects
25
+ "jsx": "preserve",
26
+ "jsxImportSource": "vue",
27
+
28
+ // `"noImplicitThis": true` is part of `strict`
29
+ // Added again here in case some users decide to disable `strict`.
30
+ // This enables stricter inference for data properties on `this`.
31
+ "noImplicitThis": true,
32
+ // Strict mode is on by default in TS 6+
33
+ "strict": true,
34
+
35
+ // This option is part of the recommended tsconfig as of TS 5.9.
36
+ // Commented out for now. It's hard to land in the current ecosystem.
37
+ // Needs more consensus before moving forward.
38
+ // "exactOptionalPropertyTypes": true,
39
+
40
+ // <https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax>
41
+ // Any imports or exports without a type modifier are left around. This is important for `<script setup>`.
42
+ // Anything that uses the type modifier is dropped entirely.
43
+ "verbatimModuleSyntax": true,
44
+
45
+ // A few notes:
46
+ // - Vue 3 supports ES2016+
47
+ // - For Vite, the actual compilation target is determined by the
48
+ // `build.target` option in the Vite config.
49
+ // So don't change the `target` field here. It has to be
50
+ // at least `ES2020` for dynamic `import()`s and `import.meta` to work correctly.
51
+ // - If you are not using Vite, feel free to overwrite the `target` field.
52
+ "target": "ESNext",
53
+ // For spec compliance.
54
+ // `true` by default if the `target` is `ES2020` or higher.
55
+ // Explicitly set it to `true` here in case some users want to overwrite the `target`.
56
+ "useDefineForClassFields": true,
57
+
58
+ // Recommended
59
+ "esModuleInterop": true,
60
+ "forceConsistentCasingInFileNames": true,
61
+ "libReplacement": false,
62
+ // See <https://github.com/vuejs/vue-cli/pull/5688>
63
+ "skipLibCheck": true,
64
+ }
65
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Emit declaration files for the library.
4
+ "noEmit": false,
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true,
7
+
8
+ // Libraries generally require more strict type accuracy.
9
+ // For example, its types must be compatible with the Vue types.
10
+ // So we don't want to skip the type checking of its dependencies.
11
+ "skipLibCheck": false,
12
+
13
+ // See <https://www.semver-ts.org/formal-spec/5-compiler-considerations.html#strictness>
14
+ // Part of the recommended tsconfig as of TS 5.9.
15
+ // Flags starting with `no` are likely to have false positives,
16
+ // So they are not suitable for existing codebases, but are recommended for new codebases,
17
+ // as well as libraries that need to be more strict about their types.
18
+ // See also <https://github.com/vuejs/tsconfig/issues/38#issuecomment-3524621112> for more discussion.
19
+ "noUncheckedIndexedAccess": true,
20
+ }
21
+ }
package/dom.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./strict.json",
3
+ "compilerOptions": {
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "target": "ES2022",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler"
8
+ }
9
+ }
package/lib.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./strict.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true
6
+ }
7
+ }
package/node.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["./strict.json", "./base/tsconfig/node20/tsconfig.json"]
3
+ }
package/node.lib.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["./node.json", "./lib.json"]
3
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@tofrankie/tsconfig",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "Shared tsconfig configuration",
6
+ "author": "Frankie <1426203851@qq.com>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/tofrankie/config/tree/main/packages/tsconfig",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/tofrankie/config.git",
12
+ "directory": "packages/tsconfig"
13
+ },
14
+ "bugs": "https://github.com/tofrankie/config/issues",
15
+ "keywords": [
16
+ "tsconfig",
17
+ "tofrankie"
18
+ ],
19
+ "files": [
20
+ "CHANGELOG.md",
21
+ "base",
22
+ "dom.json",
23
+ "lib.json",
24
+ "node.json",
25
+ "node.lib.json",
26
+ "react.json",
27
+ "react.lib.json",
28
+ "react.lib.vite.json",
29
+ "react.vite.json",
30
+ "strict.json",
31
+ "vitest.json",
32
+ "vue.json",
33
+ "vue.lib.json",
34
+ "vue.lib.vite.json",
35
+ "vue.vite.json"
36
+ ],
37
+ "engines": {
38
+ "node": "^20.0.0 || ^22.0.0 || ^24.0.0"
39
+ },
40
+ "peerDependencies": {
41
+ "typescript": ">=5.0.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "typescript": {
45
+ "optional": true
46
+ }
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "devDependencies": {
52
+ "@tsconfig/node20": "^20.1.9",
53
+ "@tsconfig/strictest": "^2.0.8",
54
+ "@tsconfig/vite-react": "^7.0.2",
55
+ "@vue/tsconfig": "^0.9.0",
56
+ "jsonc-parser": "^3.3.1",
57
+ "publint": "^0.3.18",
58
+ "tsx": "^4.21.0",
59
+ "typescript": "^5.9.3",
60
+ "vitest": "^4.1.2"
61
+ },
62
+ "scripts": {
63
+ "build": "tsx ./scripts/build.ts",
64
+ "test": "pnpm build && vitest run",
65
+ "publint": "publint"
66
+ }
67
+ }
package/react.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./dom.json",
3
+ "compilerOptions": {
4
+ "jsx": "react-jsx"
5
+ }
6
+ }
package/react.lib.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": ["./dom.json", "./lib.json"],
3
+ "compilerOptions": {
4
+ "jsx": "react-jsx"
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./react.lib.json",
3
+ "compilerOptions": {
4
+ "types": ["vite/client"]
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": ["./react.json", "./base/tsconfig/vite-react/tsconfig.json"],
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": ["vite/client"]
6
+ }
7
+ }
package/strict.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "./base/tsconfig/strictest/tsconfig.json"
3
+ }
package/vitest.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./node.json",
3
+ "compilerOptions": {
4
+ "types": ["node", "vitest/globals"]
5
+ }
6
+ }
package/vue.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["./dom.json", "./base/vue/tsconfig/tsconfig.dom.json"]
3
+ }
package/vue.lib.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["./dom.json", "./lib.json", "./base/vue/tsconfig/tsconfig.lib.json"]
3
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./vue.lib.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": ["vite/client"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler"
8
+ }
9
+ }
package/vue.vite.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./vue.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "types": ["vite/client"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler"
8
+ }
9
+ }