@effect/language-service 0.79.0 → 0.81.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/README.md +70 -57
- package/cli.js +2022 -274
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +246 -3
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +246 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +246 -3
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -2205,6 +2205,145 @@ var defaults = {
|
|
|
2205
2205
|
mermaidProvider: "mermaid.live",
|
|
2206
2206
|
skipDisabledOptimization: false
|
|
2207
2207
|
};
|
|
2208
|
+
var booleanSchema = (description, defaultValue) => ({
|
|
2209
|
+
type: "boolean",
|
|
2210
|
+
description,
|
|
2211
|
+
default: defaultValue
|
|
2212
|
+
});
|
|
2213
|
+
var stringArraySchema = (description, defaultValue) => ({
|
|
2214
|
+
type: "array",
|
|
2215
|
+
description,
|
|
2216
|
+
default: defaultValue,
|
|
2217
|
+
items: { type: "string" }
|
|
2218
|
+
});
|
|
2219
|
+
var stringEnumSchema = (description, values2, defaultValue) => ({
|
|
2220
|
+
type: "string",
|
|
2221
|
+
description,
|
|
2222
|
+
enum: values2,
|
|
2223
|
+
default: defaultValue
|
|
2224
|
+
});
|
|
2225
|
+
var languageServicePluginAdditionalPropertiesJsonSchema = {
|
|
2226
|
+
refactors: booleanSchema("Controls Effect refactors.", defaults.refactors),
|
|
2227
|
+
diagnostics: booleanSchema("Controls Effect diagnostics.", defaults.diagnostics),
|
|
2228
|
+
diagnosticsName: booleanSchema(
|
|
2229
|
+
"Controls whether to include the rule name in diagnostic messages.",
|
|
2230
|
+
defaults.diagnosticsName
|
|
2231
|
+
),
|
|
2232
|
+
missingDiagnosticNextLine: stringEnumSchema(
|
|
2233
|
+
"Controls the severity of warnings for unused @effect-diagnostics-next-line comments.",
|
|
2234
|
+
["off", "error", "warning", "message", "suggestion"],
|
|
2235
|
+
defaults.missingDiagnosticNextLine
|
|
2236
|
+
),
|
|
2237
|
+
includeSuggestionsInTsc: booleanSchema(
|
|
2238
|
+
"When patch mode is enabled, reports suggestion diagnostics as messages in TSC with a [suggestion] prefix.",
|
|
2239
|
+
defaults.includeSuggestionsInTsc
|
|
2240
|
+
),
|
|
2241
|
+
ignoreEffectWarningsInTscExitCode: booleanSchema(
|
|
2242
|
+
"When enabled, Effect warnings do not affect the patched tsc exit code.",
|
|
2243
|
+
defaults.ignoreEffectWarningsInTscExitCode
|
|
2244
|
+
),
|
|
2245
|
+
ignoreEffectErrorsInTscExitCode: booleanSchema(
|
|
2246
|
+
"When enabled, Effect errors do not affect the patched tsc exit code.",
|
|
2247
|
+
defaults.ignoreEffectErrorsInTscExitCode
|
|
2248
|
+
),
|
|
2249
|
+
ignoreEffectSuggestionsInTscExitCode: booleanSchema(
|
|
2250
|
+
"When enabled, Effect suggestions do not affect the patched tsc exit code.",
|
|
2251
|
+
defaults.ignoreEffectSuggestionsInTscExitCode
|
|
2252
|
+
),
|
|
2253
|
+
quickinfoEffectParameters: stringEnumSchema(
|
|
2254
|
+
"Controls when Effect quickinfo should include full type parameters.",
|
|
2255
|
+
["always", "never", "whentruncated"],
|
|
2256
|
+
defaults.quickinfoEffectParameters
|
|
2257
|
+
),
|
|
2258
|
+
quickinfo: booleanSchema("Controls Effect quickinfo.", defaults.quickinfo),
|
|
2259
|
+
quickinfoMaximumLength: {
|
|
2260
|
+
type: "number",
|
|
2261
|
+
description: "Controls the maximum quickinfo length. Use -1 to disable truncation.",
|
|
2262
|
+
default: defaults.quickinfoMaximumLength
|
|
2263
|
+
},
|
|
2264
|
+
keyPatterns: {
|
|
2265
|
+
type: "array",
|
|
2266
|
+
description: "Configures key patterns used for generated Effect service and error keys.",
|
|
2267
|
+
default: defaults.keyPatterns,
|
|
2268
|
+
items: {
|
|
2269
|
+
type: "object",
|
|
2270
|
+
properties: {
|
|
2271
|
+
target: stringEnumSchema("The key builder target.", ["service", "error", "custom"], "service"),
|
|
2272
|
+
pattern: stringEnumSchema(
|
|
2273
|
+
"The key generation pattern.",
|
|
2274
|
+
["package-identifier", "default", "default-hashed"],
|
|
2275
|
+
"default"
|
|
2276
|
+
),
|
|
2277
|
+
skipLeadingPath: stringArraySchema("Path prefixes to strip before generating keys.", ["src/"])
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
},
|
|
2281
|
+
extendedKeyDetection: booleanSchema(
|
|
2282
|
+
"Enables extended heuristics when detecting key sources.",
|
|
2283
|
+
defaults.extendedKeyDetection
|
|
2284
|
+
),
|
|
2285
|
+
completions: booleanSchema("Controls Effect completions.", defaults.completions),
|
|
2286
|
+
goto: booleanSchema("Controls Effect goto references support.", defaults.goto),
|
|
2287
|
+
inlays: booleanSchema("Controls Effect inlay hints.", defaults.inlays),
|
|
2288
|
+
allowedDuplicatedPackages: stringArraySchema(
|
|
2289
|
+
"Package names that are allowed to duplicate Effect as a peer dependency.",
|
|
2290
|
+
defaults.allowedDuplicatedPackages
|
|
2291
|
+
),
|
|
2292
|
+
namespaceImportPackages: stringArraySchema(
|
|
2293
|
+
"Package names that should prefer namespace imports.",
|
|
2294
|
+
defaults.namespaceImportPackages
|
|
2295
|
+
),
|
|
2296
|
+
topLevelNamedReexports: stringEnumSchema(
|
|
2297
|
+
"For namespaceImportPackages, controls how top-level named re-exports are handled.",
|
|
2298
|
+
["ignore", "follow"],
|
|
2299
|
+
defaults.topLevelNamedReexports
|
|
2300
|
+
),
|
|
2301
|
+
barrelImportPackages: stringArraySchema(
|
|
2302
|
+
"Package names that should prefer imports from their top-level barrel file.",
|
|
2303
|
+
defaults.barrelImportPackages
|
|
2304
|
+
),
|
|
2305
|
+
importAliases: {
|
|
2306
|
+
type: "object",
|
|
2307
|
+
description: "Custom aliases to use for imported identifiers.",
|
|
2308
|
+
default: defaults.importAliases,
|
|
2309
|
+
additionalProperties: {
|
|
2310
|
+
type: "string"
|
|
2311
|
+
}
|
|
2312
|
+
},
|
|
2313
|
+
renames: booleanSchema("Controls Effect rename helpers.", defaults.renames),
|
|
2314
|
+
noExternal: booleanSchema(
|
|
2315
|
+
"Disables features that link to external websites.",
|
|
2316
|
+
defaults.noExternal
|
|
2317
|
+
),
|
|
2318
|
+
pipeableMinArgCount: {
|
|
2319
|
+
type: "number",
|
|
2320
|
+
description: "Minimum argument count required before pipeable suggestions are emitted.",
|
|
2321
|
+
default: defaults.pipeableMinArgCount
|
|
2322
|
+
},
|
|
2323
|
+
effectFn: {
|
|
2324
|
+
type: "array",
|
|
2325
|
+
description: "Configures which Effect.fn variants should be suggested.",
|
|
2326
|
+
default: defaults.effectFn,
|
|
2327
|
+
items: {
|
|
2328
|
+
type: "string",
|
|
2329
|
+
enum: ["untraced", "span", "suggested-span", "inferred-span", "no-span"]
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
layerGraphFollowDepth: {
|
|
2333
|
+
type: "number",
|
|
2334
|
+
description: "Controls how deeply layer graph analysis follows dependencies.",
|
|
2335
|
+
default: defaults.layerGraphFollowDepth
|
|
2336
|
+
},
|
|
2337
|
+
mermaidProvider: {
|
|
2338
|
+
type: "string",
|
|
2339
|
+
description: "Controls which Mermaid renderer is used for layer graphs.",
|
|
2340
|
+
default: defaults.mermaidProvider
|
|
2341
|
+
},
|
|
2342
|
+
skipDisabledOptimization: booleanSchema(
|
|
2343
|
+
"When enabled, disabled diagnostics are still processed so comment-based overrides can be honored.",
|
|
2344
|
+
defaults.skipDisabledOptimization
|
|
2345
|
+
)
|
|
2346
|
+
};
|
|
2208
2347
|
function parseKeyPatterns(patterns) {
|
|
2209
2348
|
const result = [];
|
|
2210
2349
|
for (const entry of patterns) {
|
|
@@ -7014,6 +7153,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
7014
7153
|
name: "anyUnknownInErrorContext",
|
|
7015
7154
|
code: 28,
|
|
7016
7155
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
7156
|
+
group: "correctness",
|
|
7017
7157
|
severity: "off",
|
|
7018
7158
|
fixable: false,
|
|
7019
7159
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7119,6 +7259,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
7119
7259
|
name: "catchAllToMapError",
|
|
7120
7260
|
code: 39,
|
|
7121
7261
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
7262
|
+
group: "style",
|
|
7122
7263
|
severity: "suggestion",
|
|
7123
7264
|
fixable: true,
|
|
7124
7265
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7218,6 +7359,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
7218
7359
|
name: "catchUnfailableEffect",
|
|
7219
7360
|
code: 2,
|
|
7220
7361
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
7362
|
+
group: "antipattern",
|
|
7221
7363
|
severity: "suggestion",
|
|
7222
7364
|
fixable: false,
|
|
7223
7365
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7269,6 +7411,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
7269
7411
|
name: "classSelfMismatch",
|
|
7270
7412
|
code: 20,
|
|
7271
7413
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
7414
|
+
group: "correctness",
|
|
7272
7415
|
severity: "error",
|
|
7273
7416
|
fixable: true,
|
|
7274
7417
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7343,6 +7486,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
7343
7486
|
name: "deterministicKeys",
|
|
7344
7487
|
code: 25,
|
|
7345
7488
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
7489
|
+
group: "style",
|
|
7346
7490
|
severity: "off",
|
|
7347
7491
|
fixable: true,
|
|
7348
7492
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7462,6 +7606,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
7462
7606
|
name: "duplicatePackage",
|
|
7463
7607
|
code: 6,
|
|
7464
7608
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
7609
|
+
group: "correctness",
|
|
7465
7610
|
severity: "warning",
|
|
7466
7611
|
fixable: false,
|
|
7467
7612
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7493,6 +7638,7 @@ var effectFnIife = createDiagnostic({
|
|
|
7493
7638
|
name: "effectFnIife",
|
|
7494
7639
|
code: 46,
|
|
7495
7640
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
7641
|
+
group: "antipattern",
|
|
7496
7642
|
severity: "warning",
|
|
7497
7643
|
fixable: true,
|
|
7498
7644
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7597,6 +7743,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
7597
7743
|
name: "effectFnOpportunity",
|
|
7598
7744
|
code: 41,
|
|
7599
7745
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
7746
|
+
group: "style",
|
|
7600
7747
|
severity: "suggestion",
|
|
7601
7748
|
fixable: true,
|
|
7602
7749
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8191,6 +8338,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
8191
8338
|
name: "effectGenUsesAdapter",
|
|
8192
8339
|
code: 23,
|
|
8193
8340
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
8341
|
+
group: "antipattern",
|
|
8194
8342
|
severity: "warning",
|
|
8195
8343
|
fixable: false,
|
|
8196
8344
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8231,6 +8379,7 @@ var effectInFailure = createDiagnostic({
|
|
|
8231
8379
|
name: "effectInFailure",
|
|
8232
8380
|
code: 49,
|
|
8233
8381
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
8382
|
+
group: "antipattern",
|
|
8234
8383
|
severity: "warning",
|
|
8235
8384
|
fixable: false,
|
|
8236
8385
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8297,6 +8446,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
8297
8446
|
name: "effectInVoidSuccess",
|
|
8298
8447
|
code: 14,
|
|
8299
8448
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
8449
|
+
group: "antipattern",
|
|
8300
8450
|
severity: "warning",
|
|
8301
8451
|
fixable: false,
|
|
8302
8452
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8348,6 +8498,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
8348
8498
|
name: "effectMapVoid",
|
|
8349
8499
|
code: 40,
|
|
8350
8500
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
8501
|
+
group: "style",
|
|
8351
8502
|
severity: "suggestion",
|
|
8352
8503
|
fixable: true,
|
|
8353
8504
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8414,6 +8565,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
8414
8565
|
name: "effectSucceedWithVoid",
|
|
8415
8566
|
code: 47,
|
|
8416
8567
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
8568
|
+
group: "style",
|
|
8417
8569
|
severity: "suggestion",
|
|
8418
8570
|
fixable: true,
|
|
8419
8571
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8467,6 +8619,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
8467
8619
|
name: "extendsNativeError",
|
|
8468
8620
|
code: 50,
|
|
8469
8621
|
description: "Warns when a class directly extends the native Error class",
|
|
8622
|
+
group: "effectNative",
|
|
8470
8623
|
severity: "off",
|
|
8471
8624
|
fixable: false,
|
|
8472
8625
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8519,6 +8672,7 @@ var floatingEffect = createDiagnostic({
|
|
|
8519
8672
|
name: "floatingEffect",
|
|
8520
8673
|
code: 3,
|
|
8521
8674
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
8675
|
+
group: "correctness",
|
|
8522
8676
|
severity: "error",
|
|
8523
8677
|
fixable: false,
|
|
8524
8678
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8572,6 +8726,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
8572
8726
|
name: "genericEffectServices",
|
|
8573
8727
|
code: 10,
|
|
8574
8728
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
8729
|
+
group: "correctness",
|
|
8575
8730
|
severity: "warning",
|
|
8576
8731
|
fixable: false,
|
|
8577
8732
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8621,6 +8776,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
8621
8776
|
name: "globalErrorInEffectCatch",
|
|
8622
8777
|
code: 36,
|
|
8623
8778
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
8779
|
+
group: "antipattern",
|
|
8624
8780
|
severity: "warning",
|
|
8625
8781
|
fixable: false,
|
|
8626
8782
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8683,6 +8839,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
8683
8839
|
name: "globalErrorInEffectFailure",
|
|
8684
8840
|
code: 35,
|
|
8685
8841
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
8842
|
+
group: "antipattern",
|
|
8686
8843
|
severity: "warning",
|
|
8687
8844
|
fixable: false,
|
|
8688
8845
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8733,11 +8890,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
8733
8890
|
})
|
|
8734
8891
|
});
|
|
8735
8892
|
|
|
8893
|
+
// src/diagnostics/globalFetch.ts
|
|
8894
|
+
var globalFetch = createDiagnostic({
|
|
8895
|
+
name: "globalFetch",
|
|
8896
|
+
code: 53,
|
|
8897
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
8898
|
+
group: "effectNative",
|
|
8899
|
+
severity: "off",
|
|
8900
|
+
fixable: false,
|
|
8901
|
+
supportedEffect: ["v3", "v4"],
|
|
8902
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
8903
|
+
const ts = yield* service(TypeScriptApi);
|
|
8904
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
8905
|
+
const typeParser = yield* service(TypeParser);
|
|
8906
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
8907
|
+
if (!fetchSymbol) return;
|
|
8908
|
+
const effectVersion = typeParser.supportedEffect();
|
|
8909
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
8910
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
8911
|
+
const nodeToVisit = [];
|
|
8912
|
+
const appendNodeToVisit = (node) => {
|
|
8913
|
+
nodeToVisit.push(node);
|
|
8914
|
+
return void 0;
|
|
8915
|
+
};
|
|
8916
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
8917
|
+
while (nodeToVisit.length > 0) {
|
|
8918
|
+
const node = nodeToVisit.shift();
|
|
8919
|
+
if (ts.isCallExpression(node)) {
|
|
8920
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
8921
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
8922
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
8923
|
+
report({
|
|
8924
|
+
location: node.expression,
|
|
8925
|
+
messageText,
|
|
8926
|
+
fixes: []
|
|
8927
|
+
});
|
|
8928
|
+
}
|
|
8929
|
+
}
|
|
8930
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
8931
|
+
}
|
|
8932
|
+
})
|
|
8933
|
+
});
|
|
8934
|
+
|
|
8736
8935
|
// src/diagnostics/importFromBarrel.ts
|
|
8737
8936
|
var importFromBarrel = createDiagnostic({
|
|
8738
8937
|
name: "importFromBarrel",
|
|
8739
8938
|
code: 12,
|
|
8740
8939
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
8940
|
+
group: "style",
|
|
8741
8941
|
severity: "off",
|
|
8742
8942
|
fixable: true,
|
|
8743
8943
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8880,6 +9080,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
8880
9080
|
name: "instanceOfSchema",
|
|
8881
9081
|
code: 45,
|
|
8882
9082
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
9083
|
+
group: "effectNative",
|
|
8883
9084
|
severity: "off",
|
|
8884
9085
|
fixable: true,
|
|
8885
9086
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8945,6 +9146,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
8945
9146
|
name: "layerMergeAllWithDependencies",
|
|
8946
9147
|
code: 37,
|
|
8947
9148
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
9149
|
+
group: "antipattern",
|
|
8948
9150
|
severity: "warning",
|
|
8949
9151
|
fixable: true,
|
|
8950
9152
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9060,6 +9262,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
9060
9262
|
name: "leakingRequirements",
|
|
9061
9263
|
code: 8,
|
|
9062
9264
|
description: "Detects implementation services leaked in service methods",
|
|
9265
|
+
group: "antipattern",
|
|
9063
9266
|
severity: "suggestion",
|
|
9064
9267
|
fixable: false,
|
|
9065
9268
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9216,6 +9419,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
9216
9419
|
name: "missedPipeableOpportunity",
|
|
9217
9420
|
code: 26,
|
|
9218
9421
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
9422
|
+
group: "style",
|
|
9219
9423
|
severity: "off",
|
|
9220
9424
|
fixable: true,
|
|
9221
9425
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9398,6 +9602,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
9398
9602
|
name: "missingEffectContext",
|
|
9399
9603
|
code: 1,
|
|
9400
9604
|
description: "Reports missing service requirements in Effect context channel",
|
|
9605
|
+
group: "correctness",
|
|
9401
9606
|
severity: "error",
|
|
9402
9607
|
fixable: false,
|
|
9403
9608
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9449,6 +9654,7 @@ var missingEffectError = createDiagnostic({
|
|
|
9449
9654
|
name: "missingEffectError",
|
|
9450
9655
|
code: 1,
|
|
9451
9656
|
description: "Reports missing error types in Effect error channel",
|
|
9657
|
+
group: "correctness",
|
|
9452
9658
|
severity: "error",
|
|
9453
9659
|
fixable: true,
|
|
9454
9660
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9592,6 +9798,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
9592
9798
|
name: "missingEffectServiceDependency",
|
|
9593
9799
|
code: 22,
|
|
9594
9800
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
9801
|
+
group: "style",
|
|
9595
9802
|
severity: "off",
|
|
9596
9803
|
fixable: false,
|
|
9597
9804
|
supportedEffect: ["v3"],
|
|
@@ -9688,6 +9895,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
9688
9895
|
name: "missingLayerContext",
|
|
9689
9896
|
code: 38,
|
|
9690
9897
|
description: "Reports missing service requirements in Layer context channel",
|
|
9898
|
+
group: "correctness",
|
|
9691
9899
|
severity: "error",
|
|
9692
9900
|
fixable: false,
|
|
9693
9901
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9739,6 +9947,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
9739
9947
|
name: "missingReturnYieldStar",
|
|
9740
9948
|
code: 7,
|
|
9741
9949
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
9950
|
+
group: "correctness",
|
|
9742
9951
|
severity: "error",
|
|
9743
9952
|
fixable: true,
|
|
9744
9953
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9791,6 +10000,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
9791
10000
|
name: "missingStarInYieldEffectGen",
|
|
9792
10001
|
code: 4,
|
|
9793
10002
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
10003
|
+
group: "correctness",
|
|
9794
10004
|
severity: "error",
|
|
9795
10005
|
fixable: true,
|
|
9796
10006
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9868,6 +10078,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
9868
10078
|
name: "multipleEffectProvide",
|
|
9869
10079
|
code: 18,
|
|
9870
10080
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
10081
|
+
group: "antipattern",
|
|
9871
10082
|
severity: "warning",
|
|
9872
10083
|
fixable: true,
|
|
9873
10084
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9970,7 +10181,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
9970
10181
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
9971
10182
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
9972
10183
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
9973
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
10184
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
10185
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
10186
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
10187
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
10188
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
9974
10189
|
]);
|
|
9975
10190
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
9976
10191
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -9984,12 +10199,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
9984
10199
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
9985
10200
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
9986
10201
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
9987
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
10202
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
10203
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
10204
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
10205
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
10206
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
9988
10207
|
]);
|
|
9989
10208
|
var nodeBuiltinImport = createDiagnostic({
|
|
9990
10209
|
name: "nodeBuiltinImport",
|
|
9991
10210
|
code: 52,
|
|
9992
10211
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
10212
|
+
group: "effectNative",
|
|
9993
10213
|
severity: "off",
|
|
9994
10214
|
fixable: false,
|
|
9995
10215
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10033,6 +10253,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
10033
10253
|
name: "nonObjectEffectServiceType",
|
|
10034
10254
|
code: 24,
|
|
10035
10255
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
10256
|
+
group: "correctness",
|
|
10036
10257
|
severity: "error",
|
|
10037
10258
|
fixable: false,
|
|
10038
10259
|
supportedEffect: ["v3"],
|
|
@@ -10817,6 +11038,7 @@ var outdatedApi = createDiagnostic({
|
|
|
10817
11038
|
name: "outdatedApi",
|
|
10818
11039
|
code: 48,
|
|
10819
11040
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
11041
|
+
group: "correctness",
|
|
10820
11042
|
severity: "warning",
|
|
10821
11043
|
fixable: false,
|
|
10822
11044
|
supportedEffect: ["v4"],
|
|
@@ -10886,6 +11108,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
10886
11108
|
name: "outdatedEffectCodegen",
|
|
10887
11109
|
code: 19,
|
|
10888
11110
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
11111
|
+
group: "correctness",
|
|
10889
11112
|
severity: "warning",
|
|
10890
11113
|
fixable: true,
|
|
10891
11114
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10934,6 +11157,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
10934
11157
|
name: "overriddenSchemaConstructor",
|
|
10935
11158
|
code: 30,
|
|
10936
11159
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
11160
|
+
group: "correctness",
|
|
10937
11161
|
severity: "error",
|
|
10938
11162
|
fixable: true,
|
|
10939
11163
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11073,6 +11297,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
11073
11297
|
name: "preferSchemaOverJson",
|
|
11074
11298
|
code: 44,
|
|
11075
11299
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
11300
|
+
group: "effectNative",
|
|
11076
11301
|
severity: "suggestion",
|
|
11077
11302
|
fixable: false,
|
|
11078
11303
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11185,6 +11410,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
11185
11410
|
name: "redundantSchemaTagIdentifier",
|
|
11186
11411
|
code: 42,
|
|
11187
11412
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
11413
|
+
group: "style",
|
|
11188
11414
|
severity: "suggestion",
|
|
11189
11415
|
fixable: true,
|
|
11190
11416
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11237,6 +11463,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
11237
11463
|
name: "returnEffectInGen",
|
|
11238
11464
|
code: 11,
|
|
11239
11465
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
11466
|
+
group: "antipattern",
|
|
11240
11467
|
severity: "suggestion",
|
|
11241
11468
|
fixable: true,
|
|
11242
11469
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11308,6 +11535,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
11308
11535
|
name: "runEffectInsideEffect",
|
|
11309
11536
|
code: 32,
|
|
11310
11537
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
11538
|
+
group: "antipattern",
|
|
11311
11539
|
severity: "suggestion",
|
|
11312
11540
|
fixable: true,
|
|
11313
11541
|
supportedEffect: ["v3"],
|
|
@@ -11434,6 +11662,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
11434
11662
|
name: "schemaStructWithTag",
|
|
11435
11663
|
code: 34,
|
|
11436
11664
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
11665
|
+
group: "style",
|
|
11437
11666
|
severity: "suggestion",
|
|
11438
11667
|
fixable: true,
|
|
11439
11668
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11528,9 +11757,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
11528
11757
|
name: "schemaSyncInEffect",
|
|
11529
11758
|
code: 43,
|
|
11530
11759
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11760
|
+
group: "antipattern",
|
|
11531
11761
|
severity: "suggestion",
|
|
11532
11762
|
fixable: false,
|
|
11533
|
-
supportedEffect: ["v3"
|
|
11763
|
+
supportedEffect: ["v3"],
|
|
11534
11764
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
11535
11765
|
const ts = yield* service(TypeScriptApi);
|
|
11536
11766
|
const typeParser = yield* service(TypeParser);
|
|
@@ -11579,6 +11809,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
11579
11809
|
name: "schemaUnionOfLiterals",
|
|
11580
11810
|
code: 33,
|
|
11581
11811
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11812
|
+
group: "style",
|
|
11582
11813
|
severity: "off",
|
|
11583
11814
|
fixable: true,
|
|
11584
11815
|
supportedEffect: ["v3"],
|
|
@@ -11656,6 +11887,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
11656
11887
|
name: "scopeInLayerEffect",
|
|
11657
11888
|
code: 13,
|
|
11658
11889
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11890
|
+
group: "antipattern",
|
|
11659
11891
|
severity: "warning",
|
|
11660
11892
|
fixable: true,
|
|
11661
11893
|
supportedEffect: ["v3"],
|
|
@@ -11753,6 +11985,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11753
11985
|
name: "serviceNotAsClass",
|
|
11754
11986
|
code: 51,
|
|
11755
11987
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
11988
|
+
group: "style",
|
|
11756
11989
|
severity: "off",
|
|
11757
11990
|
fixable: true,
|
|
11758
11991
|
supportedEffect: ["v4"],
|
|
@@ -11830,6 +12063,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11830
12063
|
name: "strictBooleanExpressions",
|
|
11831
12064
|
code: 17,
|
|
11832
12065
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
12066
|
+
group: "style",
|
|
11833
12067
|
severity: "off",
|
|
11834
12068
|
fixable: false,
|
|
11835
12069
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11903,6 +12137,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
11903
12137
|
name: "strictEffectProvide",
|
|
11904
12138
|
code: 27,
|
|
11905
12139
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
12140
|
+
group: "antipattern",
|
|
11906
12141
|
severity: "off",
|
|
11907
12142
|
fixable: false,
|
|
11908
12143
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11956,6 +12191,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
11956
12191
|
name: "tryCatchInEffectGen",
|
|
11957
12192
|
code: 15,
|
|
11958
12193
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
12194
|
+
group: "antipattern",
|
|
11959
12195
|
severity: "suggestion",
|
|
11960
12196
|
fixable: false,
|
|
11961
12197
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12015,6 +12251,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
12015
12251
|
name: "unknownInEffectCatch",
|
|
12016
12252
|
code: 31,
|
|
12017
12253
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
12254
|
+
group: "antipattern",
|
|
12018
12255
|
severity: "warning",
|
|
12019
12256
|
fixable: false,
|
|
12020
12257
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12078,6 +12315,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
12078
12315
|
name: "unnecessaryEffectGen",
|
|
12079
12316
|
code: 5,
|
|
12080
12317
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
12318
|
+
group: "style",
|
|
12081
12319
|
severity: "suggestion",
|
|
12082
12320
|
fixable: true,
|
|
12083
12321
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12124,6 +12362,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
12124
12362
|
name: "unnecessaryFailYieldableError",
|
|
12125
12363
|
code: 29,
|
|
12126
12364
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
12365
|
+
group: "style",
|
|
12127
12366
|
severity: "suggestion",
|
|
12128
12367
|
fixable: true,
|
|
12129
12368
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12185,6 +12424,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
12185
12424
|
name: "unnecessaryPipe",
|
|
12186
12425
|
code: 9,
|
|
12187
12426
|
description: "Removes pipe calls with no arguments",
|
|
12427
|
+
group: "style",
|
|
12188
12428
|
severity: "suggestion",
|
|
12189
12429
|
fixable: true,
|
|
12190
12430
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12233,6 +12473,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
12233
12473
|
name: "unnecessaryPipeChain",
|
|
12234
12474
|
code: 16,
|
|
12235
12475
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
12476
|
+
group: "style",
|
|
12236
12477
|
severity: "suggestion",
|
|
12237
12478
|
fixable: true,
|
|
12238
12479
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12310,6 +12551,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
12310
12551
|
name: "unsupportedServiceAccessors",
|
|
12311
12552
|
code: 21,
|
|
12312
12553
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
12554
|
+
group: "correctness",
|
|
12313
12555
|
severity: "warning",
|
|
12314
12556
|
fixable: true,
|
|
12315
12557
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12387,6 +12629,7 @@ var diagnostics = [
|
|
|
12387
12629
|
leakingRequirements,
|
|
12388
12630
|
unnecessaryPipe,
|
|
12389
12631
|
genericEffectServices,
|
|
12632
|
+
globalFetch,
|
|
12390
12633
|
returnEffectInGen,
|
|
12391
12634
|
tryCatchInEffectGen,
|
|
12392
12635
|
importFromBarrel,
|