@effect/tsgo 0.0.17 → 0.0.19
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/README.md +93 -25
- package/{bin → dist}/effect-tsgo.js +5066 -3140
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -7,6 +7,20 @@ This project targets **Effect V4** (codename: "smol") primarily and also Effect
|
|
|
7
7
|
The TypeScript-Go version of the Effect LSP should be considered in Alpha. Expect breaking changes between releases and some missing features compared to previous version.
|
|
8
8
|
Some of them are currently on hold due to not yet complete pipeline on the upstream TypeScript repository.
|
|
9
9
|
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
The setup of the TSGO version of the LSP can be performed via the command line interface:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @effect/tsgo setup
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This will guide you through the installation process, which includes:
|
|
19
|
+
1. Adding the `@effect/tsgo` dependency to your project.
|
|
20
|
+
2. Configuring your `tsconfig.json` to use the Effect Language Service plugin.
|
|
21
|
+
3. Adjusting plugin options to your preference.
|
|
22
|
+
4. Hinting at any additional editor configuration needed to ensure the LSP is active.
|
|
23
|
+
|
|
10
24
|
## Diagnostic Status
|
|
11
25
|
|
|
12
26
|
Some diagnostics are off by default or have a default severity of suggestion, but you can always enable them or change their default severity in the plugin options.
|
|
@@ -21,6 +35,7 @@ Some diagnostics are off by default or have a default severity of suggestion, bu
|
|
|
21
35
|
<tr><td><code>anyUnknownInErrorContext</code></td><td>➖</td><td></td><td>Detects 'any' or 'unknown' types in Effect error or requirements channels</td><td>✓</td><td>✓</td></tr>
|
|
22
36
|
<tr><td><code>classSelfMismatch</code></td><td>❌</td><td>🔧</td><td>Ensures Self type parameter matches the class name in ServiceMap/Service/Tag/Schema classes</td><td>✓</td><td>✓</td></tr>
|
|
23
37
|
<tr><td><code>duplicatePackage</code></td><td>⚠️</td><td></td><td>Warns when multiple versions of an Effect-related package are detected in the program</td><td>✓</td><td>✓</td></tr>
|
|
38
|
+
<tr><td><code>effectFnImplicitAny</code></td><td>❌</td><td></td><td>Mirrors noImplicitAny for unannotated Effect.fn, Effect.fnUntraced, and Effect.fnUntracedEager callback parameters when no outer contextual function type exists. Requires TS's noImplicitAny: true</td><td>✓</td><td>✓</td></tr>
|
|
24
39
|
<tr><td><code>floatingEffect</code></td><td>❌</td><td></td><td>Detects Effect values that are neither yielded nor assigned</td><td>✓</td><td>✓</td></tr>
|
|
25
40
|
<tr><td><code>genericEffectServices</code></td><td>⚠️</td><td></td><td>Prevents services with type parameters that cannot be discriminated at runtime</td><td>✓</td><td>✓</td></tr>
|
|
26
41
|
<tr><td><code>missingEffectContext</code></td><td>❌</td><td></td><td>Detects Effect values with unhandled context requirements</td><td>✓</td><td>✓</td></tr>
|
|
@@ -51,7 +66,16 @@ Some diagnostics are off by default or have a default severity of suggestion, bu
|
|
|
51
66
|
<tr><td><code>unknownInEffectCatch</code></td><td>⚠️</td><td></td><td>Warns when catch callbacks return unknown instead of typed errors</td><td>✓</td><td>✓</td></tr>
|
|
52
67
|
<tr><td colspan="6"><strong>Effect-native</strong> <em>Prefer Effect-native APIs and abstractions when available.</em></td></tr>
|
|
53
68
|
<tr><td><code>extendsNativeError</code></td><td>➖</td><td></td><td>Warns when a class directly extends the native Error class</td><td>✓</td><td>✓</td></tr>
|
|
54
|
-
<tr><td><code>
|
|
69
|
+
<tr><td><code>globalConsole</code></td><td>➖</td><td></td><td>Warns when using console methods outside Effect generators instead of Effect.log/Logger</td><td>✓</td><td>✓</td></tr>
|
|
70
|
+
<tr><td><code>globalConsoleInEffect</code></td><td>➖</td><td></td><td>Warns when using console methods inside Effect generators instead of Effect.log/Logger</td><td>✓</td><td>✓</td></tr>
|
|
71
|
+
<tr><td><code>globalDate</code></td><td>➖</td><td></td><td>Warns when using Date.now() or new Date() outside Effect generators instead of Clock/DateTime</td><td>✓</td><td>✓</td></tr>
|
|
72
|
+
<tr><td><code>globalDateInEffect</code></td><td>➖</td><td></td><td>Warns when using Date.now() or new Date() inside Effect generators instead of Clock/DateTime</td><td>✓</td><td>✓</td></tr>
|
|
73
|
+
<tr><td><code>globalFetch</code></td><td>➖</td><td></td><td>Warns when using the global fetch function outside Effect generators instead of the Effect HTTP client</td><td>✓</td><td>✓</td></tr>
|
|
74
|
+
<tr><td><code>globalFetchInEffect</code></td><td>➖</td><td></td><td>Warns when using the global fetch function inside Effect generators instead of the Effect HTTP client</td><td>✓</td><td>✓</td></tr>
|
|
75
|
+
<tr><td><code>globalRandom</code></td><td>➖</td><td></td><td>Warns when using Math.random() outside Effect generators instead of the Random service</td><td>✓</td><td>✓</td></tr>
|
|
76
|
+
<tr><td><code>globalRandomInEffect</code></td><td>➖</td><td></td><td>Warns when using Math.random() inside Effect generators instead of the Random service</td><td>✓</td><td>✓</td></tr>
|
|
77
|
+
<tr><td><code>globalTimers</code></td><td>➖</td><td></td><td>Warns when using setTimeout/setInterval outside Effect generators instead of Effect.sleep/Schedule</td><td>✓</td><td>✓</td></tr>
|
|
78
|
+
<tr><td><code>globalTimersInEffect</code></td><td>➖</td><td></td><td>Warns when using setTimeout/setInterval inside Effect generators instead of Effect.sleep/Schedule</td><td>✓</td><td>✓</td></tr>
|
|
55
79
|
<tr><td><code>instanceOfSchema</code></td><td>➖</td><td>🔧</td><td>Suggests using Schema.is instead of instanceof for Effect Schema types</td><td>✓</td><td>✓</td></tr>
|
|
56
80
|
<tr><td><code>nodeBuiltinImport</code></td><td>➖</td><td></td><td>Warns when importing Node.js built-in modules that have Effect-native counterparts</td><td>✓</td><td>✓</td></tr>
|
|
57
81
|
<tr><td><code>preferSchemaOverJson</code></td><td>💡</td><td></td><td>Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify</td><td>✓</td><td>✓</td></tr>
|
|
@@ -153,27 +177,71 @@ Each release of `effect-tsgo` is built against a specific upstream `tsgo` commit
|
|
|
153
177
|
|
|
154
178
|
## Plugin Options
|
|
155
179
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
<!-- example-config:start -->
|
|
181
|
+
```jsonc
|
|
182
|
+
{
|
|
183
|
+
"compilerOptions": {
|
|
184
|
+
"plugins": [
|
|
185
|
+
{
|
|
186
|
+
"name": "@effect/language-service",
|
|
187
|
+
// Maps rule names to severity levels. Use {} to enable diagnostics with rule defaults. (default: {})
|
|
188
|
+
"diagnosticSeverity": {},
|
|
189
|
+
// When false, suggestion-level Effect diagnostics are omitted from tsc CLI output. (default: true)
|
|
190
|
+
"includeSuggestionsInTsc": true,
|
|
191
|
+
// When true, suggestion diagnostics do not affect the tsc exit code. (default: true)
|
|
192
|
+
"ignoreEffectSuggestionsInTscExitCode": true,
|
|
193
|
+
// When true, warning diagnostics do not affect the tsc exit code. (default: false)
|
|
194
|
+
"ignoreEffectWarningsInTscExitCode": false,
|
|
195
|
+
// When true, error diagnostics do not affect the tsc exit code. (default: false)
|
|
196
|
+
"ignoreEffectErrorsInTscExitCode": false,
|
|
197
|
+
// When true, disabled diagnostics are still processed so directives can re-enable them. (default: false)
|
|
198
|
+
"skipDisabledOptimization": false,
|
|
199
|
+
// Configures key pattern formulas for the deterministicKeys rule. (default: [{"target":"service","pattern":"default","skipLeadingPath":["src/"]},{"target":"custom","pattern":"default","skipLeadingPath":["src/"]}])
|
|
200
|
+
"keyPatterns": [
|
|
201
|
+
{
|
|
202
|
+
"target": "service",
|
|
203
|
+
"pattern": "default",
|
|
204
|
+
"skipLeadingPath": [
|
|
205
|
+
"src/"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"target": "custom",
|
|
210
|
+
"pattern": "default",
|
|
211
|
+
"skipLeadingPath": [
|
|
212
|
+
"src/"
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
// Enables matching constructors with @effect-identifier annotations. (default: false)
|
|
217
|
+
"extendedKeyDetection": false,
|
|
218
|
+
// Minimum number of contiguous pipeable transformations to trigger missedPipeableOpportunity. (default: 2)
|
|
219
|
+
"pipeableMinArgCount": 2,
|
|
220
|
+
// Mermaid rendering service for layer graph links. Accepts mermaid.live, mermaid.com, or a custom URL. (default: "mermaid.live")
|
|
221
|
+
"mermaidProvider": "mermaid.live",
|
|
222
|
+
// When true, suppresses external Mermaid links in hover output. (default: false)
|
|
223
|
+
"noExternal": false,
|
|
224
|
+
// How many levels deep the layer graph extraction follows symbol references. (default: 0)
|
|
225
|
+
"layerGraphFollowDepth": 0,
|
|
226
|
+
// Controls which effectFnOpportunity quickfix variants are offered. (default: ["span"])
|
|
227
|
+
"effectFn": [
|
|
228
|
+
"span"
|
|
229
|
+
],
|
|
230
|
+
// When true, suppresses redundant return-type inlay hints on supported Effect generator functions. (default: false)
|
|
231
|
+
"inlays": false,
|
|
232
|
+
// Package names allowed to have multiple versions without triggering duplicatePackage. (default: [])
|
|
233
|
+
"allowedDuplicatedPackages": [],
|
|
234
|
+
// Package names that should prefer namespace imports. (default: [])
|
|
235
|
+
"namespaceImportPackages": [],
|
|
236
|
+
// Package names that should prefer barrel named imports. (default: [])
|
|
237
|
+
"barrelImportPackages": [],
|
|
238
|
+
// Package-level import aliases keyed by package name. (default: {})
|
|
239
|
+
"importAliases": {},
|
|
240
|
+
// Controls whether named reexports are followed at package top-level. (default: "ignore")
|
|
241
|
+
"topLevelNamedReexports": "ignore"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
<!-- example-config:end -->
|