@adamaho/nopeus-tsconfig 0.3.0
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/LICENSE +21 -0
- package/README.md +111 -0
- package/base.json +17 -0
- package/effect.json +26 -0
- package/node.json +9 -0
- package/package.json +31 -0
- package/vite.json +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nopeus contributors
|
|
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,111 @@
|
|
|
1
|
+
# @adamaho/nopeus-tsconfig
|
|
2
|
+
|
|
3
|
+
Canonical TypeScript compiler policy for Nopeus projects.
|
|
4
|
+
|
|
5
|
+
| Config | Policy |
|
|
6
|
+
| --------------------------------- | ------------------------------------------------------------- |
|
|
7
|
+
| `@adamaho/nopeus-tsconfig/base` | Strict TypeScript defaults. |
|
|
8
|
+
| `@adamaho/nopeus-tsconfig/effect` | Base defaults plus all canonical Effect compiler diagnostics. |
|
|
9
|
+
|
|
10
|
+
Combine one policy with an environment: `/node` supplies NodeNext resolution,
|
|
11
|
+
ES2022 libraries, and Node types; `/vite` supplies bundler resolution, ES2022 and
|
|
12
|
+
browser libraries, and Vite client types. Environment configs do not extend a
|
|
13
|
+
policy or change its strictness or Effect diagnostics.
|
|
14
|
+
|
|
15
|
+
All exports are plain JSON. The package has no dependencies, compiler patches,
|
|
16
|
+
or installation scripts. JSX, paths, included files, and build output settings
|
|
17
|
+
belong to the consuming project.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Install from the public npm registry without a registry override or authentication:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -D -E @adamaho/nopeus-tsconfig typescript@7.0.2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
For a Vite project without Effect, install `vite` as a development dependency
|
|
28
|
+
and combine `/base` with `/vite`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"extends": ["@adamaho/nopeus-tsconfig/base", "@adamaho/nopeus-tsconfig/vite"],
|
|
33
|
+
"include": ["src/**/*.ts"]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The base policy enables strict checking, exact optional properties, checked index
|
|
38
|
+
access, unused-local checks, explicit overrides, isolated modules, verbatim
|
|
39
|
+
module syntax, and TypeScript import extensions. It targets ES2022, checks
|
|
40
|
+
without emitting, and skips dependency declaration checking. A project that owns
|
|
41
|
+
its build output can set its own emit options.
|
|
42
|
+
|
|
43
|
+
## Effect projects
|
|
44
|
+
|
|
45
|
+
Use `/effect` to inherit the base policy and eleven canonical Effect
|
|
46
|
+
diagnostics. For a Node project, combine it with `/node`:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"extends": ["@adamaho/nopeus-tsconfig/effect", "@adamaho/nopeus-tsconfig/node"]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Install the compiler integration in the workspace that owns TypeScript:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pnpm add -D -E @effect/tsgo@0.41.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Retain the project's existing preparation commands and add the compiler patch:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"scripts": {
|
|
65
|
+
"prepare": "effect-tsgo patch",
|
|
66
|
+
"typecheck": "tsc --noEmit"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Run `pnpm install` after adding the preparation step. CI must run installation
|
|
72
|
+
scripts before typechecking. The JSON config supplies policy; the patched
|
|
73
|
+
compiler executes Effect diagnostics. An unpatched compiler does not enforce
|
|
74
|
+
them. Keep TypeScript and `@effect/tsgo` on compatible versions; the tested pair
|
|
75
|
+
is TypeScript 7.0.2 with `@effect/tsgo` 0.41.0 and Effect 4.0.0-rc.112.
|
|
76
|
+
Install `@types/node` when using `/node`. Vite projects using Effect combine
|
|
77
|
+
`/effect` with `/vite` and install `vite`. Neither environment preset installs
|
|
78
|
+
these dependencies automatically. `/node` excludes browser globals; `/vite`
|
|
79
|
+
excludes automatically included Node globals. React projects set their own JSX
|
|
80
|
+
option and install the React types they need.
|
|
81
|
+
|
|
82
|
+
| Diagnostic | Required behavior |
|
|
83
|
+
| ------------------------- | --------------------------------------------------------------- |
|
|
84
|
+
| `floatingEffect` | Execute, return, or retain Effects. |
|
|
85
|
+
| `returnEffectInGen` | Use `return yield*` to execute returned Effects in generators. |
|
|
86
|
+
| `effectInVoidSuccess` | Avoid unexecuted Effects inside a void success value. |
|
|
87
|
+
| `lazyPromiseInEffectSync` | Adapt Promise work with an Effect Promise adapter. |
|
|
88
|
+
| `promiseInEffectSuccess` | Avoid wrapping Promises as success values. |
|
|
89
|
+
| `schemaSyncInEffect` | Use Effect-returning schema decoders inside Effect workflows. |
|
|
90
|
+
| `leakingRequirements` | Capture implementation dependencies when constructing services. |
|
|
91
|
+
| `floatingEffectInVitest` | Execute Effects through the Effect-aware test API. |
|
|
92
|
+
| `lazyEffect` | Avoid zero-argument functions that return Effects. |
|
|
93
|
+
| `preferSucceedSomeOrNone` | Use the dedicated constructors for optional success values. |
|
|
94
|
+
| `unnecessaryTypeofType` | Use named types instead of redundant schema type queries. |
|
|
95
|
+
|
|
96
|
+
These diagnostics are errors and cause a failing `tsc` exit code. Other upstream
|
|
97
|
+
diagnostics retain their defaults. A child config's `compilerOptions.plugins`
|
|
98
|
+
replaces the inherited array, so preserve the Effect entry if adding another
|
|
99
|
+
compiler plugin.
|
|
100
|
+
|
|
101
|
+
For editor support, run `pnpm exec effect-tsgo setup` and follow the
|
|
102
|
+
[official editor instructions](https://github.com/Effect-TS/tsgo#installation).
|
|
103
|
+
Compiler patching and editor language-server selection are separate setup steps.
|
|
104
|
+
|
|
105
|
+
## Shared repository configs
|
|
106
|
+
|
|
107
|
+
Keep thin `tools/tsconfig` wrappers to select a policy and environment once per
|
|
108
|
+
repository. Packages can continue extending those wrappers and owning their
|
|
109
|
+
source paths and build settings. The environment presets leave output and
|
|
110
|
+
project-reference settings untouched. Arrays such as `types` and `lib` replace
|
|
111
|
+
inherited arrays; include every required entry when overriding them.
|
package/base.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"moduleDetection": "force",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"exactOptionalPropertyTypes": true,
|
|
8
|
+
"noUncheckedIndexedAccess": true,
|
|
9
|
+
"noUnusedLocals": true,
|
|
10
|
+
"noImplicitOverride": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"skipLibCheck": true
|
|
16
|
+
}
|
|
17
|
+
}
|
package/effect.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"plugins": [
|
|
6
|
+
{
|
|
7
|
+
"name": "@effect/language-service",
|
|
8
|
+
"diagnostics": true,
|
|
9
|
+
"ignoreEffectErrorsInTscExitCode": false,
|
|
10
|
+
"diagnosticSeverity": {
|
|
11
|
+
"floatingEffect": "error",
|
|
12
|
+
"returnEffectInGen": "error",
|
|
13
|
+
"effectInVoidSuccess": "error",
|
|
14
|
+
"lazyPromiseInEffectSync": "error",
|
|
15
|
+
"promiseInEffectSuccess": "error",
|
|
16
|
+
"schemaSyncInEffect": "error",
|
|
17
|
+
"leakingRequirements": "error",
|
|
18
|
+
"floatingEffectInVitest": "error",
|
|
19
|
+
"lazyEffect": "error",
|
|
20
|
+
"preferSucceedSomeOrNone": "error",
|
|
21
|
+
"unnecessaryTypeofType": "error"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
package/node.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adamaho/nopeus-tsconfig",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Canonical base and Effect TypeScript compiler policies.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/adamaho/nopeus.git",
|
|
9
|
+
"directory": "packages/nopeus-tsconfig"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"base.json",
|
|
13
|
+
"effect.json",
|
|
14
|
+
"node.json",
|
|
15
|
+
"vite.json",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"exports": {
|
|
22
|
+
"./base": "./base.json",
|
|
23
|
+
"./effect": "./effect.json",
|
|
24
|
+
"./node": "./node.json",
|
|
25
|
+
"./vite": "./vite.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org"
|
|
30
|
+
}
|
|
31
|
+
}
|