@effect/language-service 0.84.2 → 0.84.3
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/cli.js +127 -106
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +80 -59
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +80 -59
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +80 -59
- package/transform.js.map +1 -1
package/cli.js
CHANGED
|
@@ -25942,7 +25942,7 @@ var runWith2 = (command, config2) => {
|
|
|
25942
25942
|
// package.json
|
|
25943
25943
|
var package_default = {
|
|
25944
25944
|
name: "@effect/language-service",
|
|
25945
|
-
version: "0.84.
|
|
25945
|
+
version: "0.84.3",
|
|
25946
25946
|
publishConfig: {
|
|
25947
25947
|
access: "public",
|
|
25948
25948
|
directory: "dist"
|
|
@@ -29024,6 +29024,14 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
29024
29024
|
),
|
|
29025
29025
|
([A, E, R]) => ({ A, E, R })
|
|
29026
29026
|
);
|
|
29027
|
+
const streamVarianceStruct = (type, atLocation) => map12(
|
|
29028
|
+
all3(
|
|
29029
|
+
varianceStructCovariantType(type, atLocation, "_A"),
|
|
29030
|
+
varianceStructCovariantType(type, atLocation, "_E"),
|
|
29031
|
+
varianceStructCovariantType(type, atLocation, "_R")
|
|
29032
|
+
),
|
|
29033
|
+
([A, E, R]) => ({ A, E, R })
|
|
29034
|
+
);
|
|
29027
29035
|
const layerVarianceStruct = (type, atLocation) => map12(
|
|
29028
29036
|
all3(
|
|
29029
29037
|
varianceStructContravariantType(type, atLocation, "_ROut"),
|
|
@@ -29070,6 +29078,21 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
29070
29078
|
"TypeParser.strictEffectType",
|
|
29071
29079
|
(type) => type
|
|
29072
29080
|
);
|
|
29081
|
+
const streamType = cachedBy(
|
|
29082
|
+
fn3("TypeParser.streamType")(function* (type, atLocation) {
|
|
29083
|
+
if (supportedEffect() === "v3") {
|
|
29084
|
+
return yield* effectType(type, atLocation);
|
|
29085
|
+
}
|
|
29086
|
+
const typeIdSymbol = typeChecker.getPropertyOfType(type, "~effect/Stream");
|
|
29087
|
+
if (!typeIdSymbol) {
|
|
29088
|
+
return yield* typeParserIssue("Type is not a stream", type, atLocation);
|
|
29089
|
+
}
|
|
29090
|
+
const typeIdType = typeChecker.getTypeOfSymbolAtLocation(typeIdSymbol, atLocation);
|
|
29091
|
+
return yield* streamVarianceStruct(typeIdType, atLocation);
|
|
29092
|
+
}),
|
|
29093
|
+
"TypeParser.streamType",
|
|
29094
|
+
(type) => type
|
|
29095
|
+
);
|
|
29073
29096
|
const isEffectTypeSourceFile = cachedBy(
|
|
29074
29097
|
fn3("TypeParser.isEffectTypeSourceFile")(function* (sourceFile) {
|
|
29075
29098
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
@@ -30805,6 +30828,7 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
30805
30828
|
isServiceMapTypeSourceFile,
|
|
30806
30829
|
isNodeReferenceToServiceMapModuleApi,
|
|
30807
30830
|
effectType,
|
|
30831
|
+
streamType,
|
|
30808
30832
|
strictEffectType,
|
|
30809
30833
|
layerType,
|
|
30810
30834
|
fiberType,
|
|
@@ -33487,7 +33511,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
33487
33511
|
const { failArg, failCall } = failCallInfo;
|
|
33488
33512
|
report({
|
|
33489
33513
|
location: transformation.callee,
|
|
33490
|
-
messageText:
|
|
33514
|
+
messageText: `\`Effect.mapError\` expresses the same error-type transformation more directly than \`Effect.${catchAllName}\` followed by \`Effect.fail\`.`,
|
|
33491
33515
|
fixes: [{
|
|
33492
33516
|
fixName: "catchAllToMapError_fix",
|
|
33493
33517
|
description: "Replace with Effect.mapError",
|
|
@@ -33551,7 +33575,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
33551
33575
|
if (E.flags & ts.TypeFlags.Never) {
|
|
33552
33576
|
report({
|
|
33553
33577
|
location: transformation.callee,
|
|
33554
|
-
messageText:
|
|
33578
|
+
messageText: "The previous Effect does not fail, so this error-handling branch will never run.",
|
|
33555
33579
|
fixes: []
|
|
33556
33580
|
});
|
|
33557
33581
|
}
|
|
@@ -33614,7 +33638,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
33614
33638
|
if (actualName !== expectedName) {
|
|
33615
33639
|
report({
|
|
33616
33640
|
location: selfTypeNode,
|
|
33617
|
-
messageText: `Self type parameter should be
|
|
33641
|
+
messageText: `The \`Self\` type parameter for this class should be \`${expectedName}\`.`,
|
|
33618
33642
|
fixes: [{
|
|
33619
33643
|
fixName: "classSelfMismatch_fix",
|
|
33620
33644
|
description: `Replace '${actualName}' with '${expectedName}'`,
|
|
@@ -33804,7 +33828,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
33804
33828
|
if (actualIdentifier !== expectedKey) {
|
|
33805
33829
|
report({
|
|
33806
33830
|
location: keyStringLiteral,
|
|
33807
|
-
messageText: `
|
|
33831
|
+
messageText: `This key does not match the deterministic key for this declaration. The expected key is \`${expectedKey}\`.`,
|
|
33808
33832
|
fixes: [{
|
|
33809
33833
|
fixName: "deterministicKeys_fix",
|
|
33810
33834
|
description: `Replace '${actualIdentifier}' with '${expectedKey}'`,
|
|
@@ -33843,9 +33867,8 @@ var duplicatePackage = createDiagnostic({
|
|
|
33843
33867
|
const versions = Object.keys(resolvedPackages[packageName]);
|
|
33844
33868
|
report({
|
|
33845
33869
|
location: sourceFile.statements[0],
|
|
33846
|
-
messageText: `
|
|
33847
|
-
|
|
33848
|
-
If this is intended set the LSP config "allowedDuplicatedPackages" to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
33870
|
+
messageText: `Multiple versions of package \`${packageName}\` were detected: ${versions.join(", ")}. Package duplication can change runtime identity and type equality across Effect modules.
|
|
33871
|
+
If this is intentional, set the LSP config \`allowedDuplicatedPackages\` to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
33849
33872
|
|
|
33850
33873
|
${versions.map((version2) => `- found ${version2} at ${resolvedPackages[packageName][version2]}`).join("\n")}`,
|
|
33851
33874
|
fixes: []
|
|
@@ -33953,7 +33976,7 @@ var effectFnIife = createDiagnostic({
|
|
|
33953
33976
|
const traceExpressionText = traceExpression ? sourceFile.text.slice(traceExpression.pos, traceExpression.end) : void 0;
|
|
33954
33977
|
report({
|
|
33955
33978
|
location: node,
|
|
33956
|
-
messageText:
|
|
33979
|
+
messageText: `\`${effectModuleName}.${kind}\` returns a reusable function that can take arguments, but it is invoked immediately here. \`Effect.gen\` represents the immediate-use form for this pattern${traceExpressionText ? ` with \`Effect.withSpan(${traceExpressionText})\` piped at the end to maintain tracing spans` : ``}.`,
|
|
33957
33980
|
fixes
|
|
33958
33981
|
});
|
|
33959
33982
|
}
|
|
@@ -34038,7 +34061,7 @@ var effectFnImplicitAny = createDiagnostic({
|
|
|
34038
34061
|
const parameterName = getParameterName(ts, parameter.name);
|
|
34039
34062
|
report({
|
|
34040
34063
|
location: parameter.name,
|
|
34041
|
-
messageText: `Parameter
|
|
34064
|
+
messageText: `Parameter \`${parameterName}\` implicitly has type \`any\` in \`Effect.fn\`, \`Effect.fnUntraced\`, or \`Effect.fnUntracedEager\`. No parameter type is available from an explicit annotation or contextual function type.`,
|
|
34042
34065
|
fixes: []
|
|
34043
34066
|
});
|
|
34044
34067
|
}
|
|
@@ -34634,7 +34657,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
34634
34657
|
const expectedSignature = generateExpectedSignature();
|
|
34635
34658
|
report({
|
|
34636
34659
|
location: nameIdentifier ?? targetNode,
|
|
34637
|
-
messageText: `
|
|
34660
|
+
messageText: `This expression can be rewritten in the reusable function form \`${expectedSignature}\`.`,
|
|
34638
34661
|
fixes
|
|
34639
34662
|
});
|
|
34640
34663
|
}
|
|
@@ -34846,7 +34869,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
34846
34869
|
if (isNone2(match9)) continue;
|
|
34847
34870
|
report({
|
|
34848
34871
|
location: node.expression,
|
|
34849
|
-
messageText: "
|
|
34872
|
+
messageText: "This expression discards the success value through mapping. `Effect.asVoid` represents that form directly.",
|
|
34850
34873
|
fixes: [{
|
|
34851
34874
|
fixName: "effectMapVoid_fix",
|
|
34852
34875
|
description: "Replace with Effect.asVoid",
|
|
@@ -34901,7 +34924,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
34901
34924
|
if (!tsUtils.isVoidExpression(argument)) continue;
|
|
34902
34925
|
report({
|
|
34903
34926
|
location: node,
|
|
34904
|
-
messageText: "Effect.void
|
|
34927
|
+
messageText: "`Effect.void` represents the same outcome as `Effect.succeed(undefined)` or `Effect.succeed(void 0)`.",
|
|
34905
34928
|
fixes: [{
|
|
34906
34929
|
fixName: "effectSucceedWithVoid_fix",
|
|
34907
34930
|
description: "Replace with Effect.void",
|
|
@@ -34963,7 +34986,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
34963
34986
|
if (isNativeError) {
|
|
34964
34987
|
report({
|
|
34965
34988
|
location: node.name ?? typeExpression,
|
|
34966
|
-
messageText: "
|
|
34989
|
+
messageText: "This class extends the native `Error` type directly. Untagged native errors lose distinction in the Effect failure channel.",
|
|
34967
34990
|
fixes: []
|
|
34968
34991
|
});
|
|
34969
34992
|
}
|
|
@@ -35008,7 +35031,12 @@ var floatingEffect = createDiagnostic({
|
|
|
35008
35031
|
if (!isFloatingExpression(node)) continue;
|
|
35009
35032
|
const type = typeCheckerUtils.getTypeAtLocation(node.expression);
|
|
35010
35033
|
if (!type) continue;
|
|
35011
|
-
const effect2 = yield* option4(
|
|
35034
|
+
const effect2 = yield* option4(
|
|
35035
|
+
pipe(
|
|
35036
|
+
typeParser.effectType(type, node.expression),
|
|
35037
|
+
orElse5(() => typeParser.streamType(type, node.expression))
|
|
35038
|
+
)
|
|
35039
|
+
);
|
|
35012
35040
|
if (isSome2(effect2)) {
|
|
35013
35041
|
const allowedFloatingEffects = yield* pipe(
|
|
35014
35042
|
typeParser.fiberType(type, node.expression),
|
|
@@ -35017,10 +35045,9 @@ var floatingEffect = createDiagnostic({
|
|
|
35017
35045
|
);
|
|
35018
35046
|
if (isNone2(allowedFloatingEffects)) {
|
|
35019
35047
|
const isStrictEffect = yield* option4(typeParser.strictEffectType(type, node.expression));
|
|
35020
|
-
const name = isSome2(isStrictEffect) ? "Effect" : "Effect-able " + typeChecker.typeToString(type);
|
|
35021
35048
|
report({
|
|
35022
35049
|
location: node,
|
|
35023
|
-
messageText:
|
|
35050
|
+
messageText: isSome2(isStrictEffect) ? "This Effect value is neither yielded nor used in an assignment." : `This Effect-able \`${typeChecker.typeToString(type)}\` value is neither yielded nor assigned to a variable.`,
|
|
35024
35051
|
fixes: []
|
|
35025
35052
|
});
|
|
35026
35053
|
}
|
|
@@ -35115,7 +35142,7 @@ var makeGlobalConsoleApply = (checkInEffect) => fn3(`globalConsole${checkInEffec
|
|
|
35115
35142
|
if (inEffect !== checkInEffect) continue;
|
|
35116
35143
|
report({
|
|
35117
35144
|
location: node,
|
|
35118
|
-
messageText: checkInEffect ? `
|
|
35145
|
+
messageText: checkInEffect ? `This Effect code uses \`console.${method}\`, logging in Effect code is represented through \`${alternative}\`.` : `This code uses \`console.${method}\`, the corresponding Effect logging API is \`${alternative}\`.`,
|
|
35119
35146
|
fixes: []
|
|
35120
35147
|
});
|
|
35121
35148
|
}
|
|
@@ -35164,10 +35191,10 @@ var makeGlobalDateApply = (checkInEffect) => fn3(`globalDate${checkInEffect ? "I
|
|
|
35164
35191
|
let objectNode;
|
|
35165
35192
|
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.idText(node.expression.name) === "now") {
|
|
35166
35193
|
objectNode = node.expression.expression;
|
|
35167
|
-
messageText = checkInEffect ? "
|
|
35194
|
+
messageText = checkInEffect ? "This Effect code uses `Date.now()`, time access in Effect code is represented through `Clock` from Effect." : "This code uses `Date.now()`, time access is represented through `Clock` from Effect.";
|
|
35168
35195
|
} else if (ts.isNewExpression(node)) {
|
|
35169
35196
|
objectNode = node.expression;
|
|
35170
|
-
messageText = checkInEffect ? "
|
|
35197
|
+
messageText = checkInEffect ? "This Effect code constructs `new Date()`, date values in Effect code are represented through `DateTime` from Effect." : "This code constructs `new Date()`, date values are represented through `DateTime` from Effect.";
|
|
35171
35198
|
}
|
|
35172
35199
|
if (!messageText || !objectNode) continue;
|
|
35173
35200
|
const symbol4 = typeChecker.getSymbolAtLocation(objectNode);
|
|
@@ -35250,7 +35277,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
35250
35277
|
);
|
|
35251
35278
|
report({
|
|
35252
35279
|
location: node.expression,
|
|
35253
|
-
messageText: `The
|
|
35280
|
+
messageText: `The \`catch\` callback in \`${nodeText}\` returns the global \`Error\` type. Untagged errors merge together in the Effect error channel and lose type-level distinction; a tagged error preserves that distinction and can wrap the original error in a \`cause\` property.`,
|
|
35254
35281
|
fixes: []
|
|
35255
35282
|
});
|
|
35256
35283
|
}
|
|
@@ -35330,7 +35357,7 @@ var makeGlobalFetchApply = (checkInEffect) => fn3(`globalFetch${checkInEffect ?
|
|
|
35330
35357
|
if (!fetchSymbol) return;
|
|
35331
35358
|
const effectVersion = typeParser.supportedEffect();
|
|
35332
35359
|
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
35333
|
-
const messageText = checkInEffect ? `
|
|
35360
|
+
const messageText = checkInEffect ? `This Effect code calls the global \`fetch\` function, HTTP requests in Effect code are represented through \`HttpClient\` from \`${packageName}\`.` : `This code uses the global \`fetch\` function, HTTP requests are represented through \`HttpClient\` from \`${packageName}\`.`;
|
|
35334
35361
|
const nodeToVisit = [];
|
|
35335
35362
|
const appendNodeToVisit = (node) => {
|
|
35336
35363
|
nodeToVisit.push(node);
|
|
@@ -35403,7 +35430,7 @@ var makeGlobalRandomApply = (checkInEffect) => fn3(`globalRandom${checkInEffect
|
|
|
35403
35430
|
if (inEffect !== checkInEffect) continue;
|
|
35404
35431
|
report({
|
|
35405
35432
|
location: node,
|
|
35406
|
-
messageText: checkInEffect ? "
|
|
35433
|
+
messageText: checkInEffect ? "This Effect code uses `Math.random()`, randomness is represented through the Effect `Random` service." : "This code uses `Math.random()`, randomness is represented through the Effect `Random` service.",
|
|
35407
35434
|
fixes: []
|
|
35408
35435
|
});
|
|
35409
35436
|
}
|
|
@@ -35434,12 +35461,12 @@ var globalRandom = createDiagnostic({
|
|
|
35434
35461
|
// src/diagnostics/globalTimersInEffect.ts
|
|
35435
35462
|
var timerAlternatives = {
|
|
35436
35463
|
"setTimeout": {
|
|
35437
|
-
inEffect: "
|
|
35438
|
-
outsideEffect: "
|
|
35464
|
+
inEffect: "This Effect code uses `setTimeout`, the corresponding timer API in this context is `Effect.sleep or Schedule` from Effect.",
|
|
35465
|
+
outsideEffect: "This code uses `setTimeout`, the corresponding Effect timer API is `Effect.sleep or Schedule` from Effect."
|
|
35439
35466
|
},
|
|
35440
35467
|
"setInterval": {
|
|
35441
|
-
inEffect: "
|
|
35442
|
-
outsideEffect: "
|
|
35468
|
+
inEffect: "This Effect code uses `setInterval`, the corresponding timer API in this context is `Schedule or Effect.repeat` from Effect.",
|
|
35469
|
+
outsideEffect: "This code uses `setInterval`, the corresponding Effect timer API is `Schedule or Effect.repeat` from Effect."
|
|
35443
35470
|
}
|
|
35444
35471
|
};
|
|
35445
35472
|
var makeGlobalTimersApply = (checkInEffect) => fn3(`globalTimers${checkInEffect ? "InEffect" : ""}.apply`)(function* (sourceFile, report) {
|
|
@@ -35681,7 +35708,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
35681
35708
|
if (isSchemaType._tag === "Some") {
|
|
35682
35709
|
report({
|
|
35683
35710
|
location: node,
|
|
35684
|
-
messageText: "
|
|
35711
|
+
messageText: "This code uses `instanceof` with an Effect Schema type. `Schema.is` is the schema-aware runtime check for this case.",
|
|
35685
35712
|
fixes: [{
|
|
35686
35713
|
fixName: "instanceOfSchema_fix",
|
|
35687
35714
|
description: "Replace with Schema.is",
|
|
@@ -35951,7 +35978,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
35951
35978
|
location: node,
|
|
35952
35979
|
messageText: `Methods of this Service require \`${requirementsStr}\` from every caller.
|
|
35953
35980
|
|
|
35954
|
-
|
|
35981
|
+
The requirement becomes part of the public service surface instead of remaining internal to Layer implementation.
|
|
35955
35982
|
|
|
35956
35983
|
Resolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.
|
|
35957
35984
|
|
|
@@ -36148,7 +36175,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
36148
36175
|
).trim() : "";
|
|
36149
36176
|
report({
|
|
36150
36177
|
location: flow2.node,
|
|
36151
|
-
messageText: `
|
|
36178
|
+
messageText: `This nested call structure has a pipeable form. \`${subjectText}.pipe(...)\` represents the same call sequence in pipe style and may be easier to read.`,
|
|
36152
36179
|
fixes: [{
|
|
36153
36180
|
fixName: "missedPipeableOpportunity_fix",
|
|
36154
36181
|
description: "Convert to pipe style",
|
|
@@ -36229,7 +36256,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
36229
36256
|
(missingTypes) => missingTypes.length > 0 ? report(
|
|
36230
36257
|
{
|
|
36231
36258
|
location: node,
|
|
36232
|
-
messageText: `
|
|
36259
|
+
messageText: `This Effect requires a service that is missing from the expected Effect context: \`${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}\`.`,
|
|
36233
36260
|
fixes: []
|
|
36234
36261
|
}
|
|
36235
36262
|
) : void 0
|
|
@@ -36580,7 +36607,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
36580
36607
|
}];
|
|
36581
36608
|
report({
|
|
36582
36609
|
location: unwrapped,
|
|
36583
|
-
messageText:
|
|
36610
|
+
messageText: "This Effect never succeeds; using `return yield*` preserves a definitive generator exit point for type narrowing and tooling support.",
|
|
36584
36611
|
fixes: fix
|
|
36585
36612
|
});
|
|
36586
36613
|
}
|
|
@@ -36636,7 +36663,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
36636
36663
|
brokenGenerators.forEach(
|
|
36637
36664
|
(pos) => report({
|
|
36638
36665
|
location: { pos, end: pos + "function".length },
|
|
36639
|
-
messageText: `
|
|
36666
|
+
messageText: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context.",
|
|
36640
36667
|
fixes: []
|
|
36641
36668
|
})
|
|
36642
36669
|
);
|
|
@@ -36658,7 +36685,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
36658
36685
|
}] : [];
|
|
36659
36686
|
report({
|
|
36660
36687
|
location: node,
|
|
36661
|
-
messageText: `
|
|
36688
|
+
messageText: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context.",
|
|
36662
36689
|
fixes: fix
|
|
36663
36690
|
});
|
|
36664
36691
|
});
|
|
@@ -36726,7 +36753,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
36726
36753
|
if (chunk.length < 2) continue;
|
|
36727
36754
|
report({
|
|
36728
36755
|
location: chunk[0].node,
|
|
36729
|
-
messageText: "
|
|
36756
|
+
messageText: "This expression chains multiple `Effect.provide` calls. Providing Layers in multiple calls in a chain can break service lifecycle behavior compared with a single combined provide with merged layers.",
|
|
36730
36757
|
fixes: [{
|
|
36731
36758
|
fixName: "multipleEffectProvide_fix",
|
|
36732
36759
|
description: "Combine into a single provide",
|
|
@@ -36816,7 +36843,7 @@ var nodeBuiltinImport = createDiagnostic({
|
|
|
36816
36843
|
if (match9) {
|
|
36817
36844
|
report({
|
|
36818
36845
|
location: statement.moduleSpecifier,
|
|
36819
|
-
messageText: `
|
|
36846
|
+
messageText: `This module reference uses the \`${match9.module}\` module, the corresponding Effect API is \`${match9.alternative}\` from \`${match9.package}\`.`,
|
|
36820
36847
|
fixes: []
|
|
36821
36848
|
});
|
|
36822
36849
|
}
|
|
@@ -36829,7 +36856,7 @@ var nodeBuiltinImport = createDiagnostic({
|
|
|
36829
36856
|
if (match9) {
|
|
36830
36857
|
report({
|
|
36831
36858
|
location: arg,
|
|
36832
|
-
messageText: `
|
|
36859
|
+
messageText: `This module reference uses the \`${match9.module}\` module, the corresponding Effect API is \`${match9.alternative}\` from \`${match9.package}\`.`,
|
|
36833
36860
|
fixes: []
|
|
36834
36861
|
});
|
|
36835
36862
|
}
|
|
@@ -36883,7 +36910,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
36883
36910
|
const propertyValue = property.initializer;
|
|
36884
36911
|
const errorToReport = {
|
|
36885
36912
|
location: property.name,
|
|
36886
|
-
messageText: "Effect.Service
|
|
36913
|
+
messageText: "`Effect.Service` is declared with a primitive service type. `Effect.Service` models object-shaped services; primitive values use `Context.Tag` or `Effect.Tag` directly.",
|
|
36887
36914
|
fixes: []
|
|
36888
36915
|
};
|
|
36889
36916
|
if (propertyName === "succeed") {
|
|
@@ -37645,7 +37672,7 @@ var outdatedApi = createDiagnostic({
|
|
|
37645
37672
|
hasReported = true;
|
|
37646
37673
|
report({
|
|
37647
37674
|
location: propertyAccess.name,
|
|
37648
|
-
messageText:
|
|
37675
|
+
messageText: `This project targets Effect v4, but this code uses the Effect v3 API \`${propertyName}\`. The referenced API belongs to the v3 surface rather than the configured v4 surface.`,
|
|
37649
37676
|
fixes: []
|
|
37650
37677
|
});
|
|
37651
37678
|
}
|
|
@@ -37688,7 +37715,7 @@ var outdatedApi = createDiagnostic({
|
|
|
37688
37715
|
if (hasReported) {
|
|
37689
37716
|
report({
|
|
37690
37717
|
location: { pos: 0, end: 0 },
|
|
37691
|
-
messageText: "This project targets Effect v4, but
|
|
37718
|
+
messageText: "This project targets Effect v4, but this code uses Effect v3 APIs. The referenced API belongs to the v3 surface rather than the configured v4 surface.",
|
|
37692
37719
|
fixes: []
|
|
37693
37720
|
});
|
|
37694
37721
|
}
|
|
@@ -37864,7 +37891,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
37864
37891
|
};
|
|
37865
37892
|
report({
|
|
37866
37893
|
location: member,
|
|
37867
|
-
messageText: "
|
|
37894
|
+
messageText: "This Schema subclass defines its own constructor. For Schema classes, constructor overrides break decoding behavior for the class shape. Custom construction can be expressed through a static `new` method instead.",
|
|
37868
37895
|
fixes: (member.body ? [fixAsStaticNew] : []).concat([{
|
|
37869
37896
|
fixName: "overriddenSchemaConstructor_fix",
|
|
37870
37897
|
description: "Remove the constructor override",
|
|
@@ -37986,7 +38013,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
37986
38013
|
if (isSome2(match9)) {
|
|
37987
38014
|
report({
|
|
37988
38015
|
location: match9.value,
|
|
37989
|
-
messageText: "
|
|
38016
|
+
messageText: "This code uses `JSON.parse` or `JSON.stringify`. Effect Schema provides Effect-aware APIs for JSON parsing and stringifying.",
|
|
37990
38017
|
fixes: []
|
|
37991
38018
|
});
|
|
37992
38019
|
}
|
|
@@ -38104,9 +38131,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
38104
38131
|
}] : [];
|
|
38105
38132
|
report({
|
|
38106
38133
|
location: node,
|
|
38107
|
-
messageText:
|
|
38108
|
-
Maybe you wanted to return yield* instead?
|
|
38109
|
-
Nested Effect-able types may be intended if you plan to later manually flatten or unwrap this Effect, if so you can safely disable this diagnostic for this line through quickfixes.`,
|
|
38134
|
+
messageText: "This generator returns an Effect-able value directly, which produces a nested `Effect<Effect<...>>`. If the intended result is the inner Effect value, `return yield*` represents that form.",
|
|
38110
38135
|
fixes: fix
|
|
38111
38136
|
});
|
|
38112
38137
|
}),
|
|
@@ -38261,9 +38286,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
38261
38286
|
);
|
|
38262
38287
|
});
|
|
38263
38288
|
const v4MethodName = `${isEffectRunCall.value.methodName}With`;
|
|
38264
|
-
const messageText = supportedEffect === "v4" ?
|
|
38265
|
-
Consider extracting the current services by using for example Effect.services and then use Effect.${v4MethodName} with the extracted services instead.` : `Using ${nodeText} inside an Effect is not recommended. The same runtime should generally be used instead to run child effects.
|
|
38266
|
-
Consider extracting the Runtime by using for example Effect.runtime and then use Runtime.${isEffectRunCall.value.methodName} with the extracted runtime instead.`;
|
|
38289
|
+
const messageText = supportedEffect === "v4" ? `\`${nodeText}\` is called inside an Effect with a separate services invocation. In this context, child Effects run with the surrounding services, which can be accessed through \`Effect.services\` and \`Effect.${v4MethodName}\`.` : `\`${nodeText}\` is called inside an Effect with a separate runtime invocation. In this context, run child Effects with the surrounding runtime, which can be accessed through \`Effect.runtime\` and \`Runtime.${isEffectRunCall.value.methodName}\`.`;
|
|
38267
38290
|
report({
|
|
38268
38291
|
location: node.expression,
|
|
38269
38292
|
messageText,
|
|
@@ -38276,7 +38299,7 @@ Consider extracting the Runtime by using for example Effect.runtime and then use
|
|
|
38276
38299
|
} else {
|
|
38277
38300
|
report({
|
|
38278
38301
|
location: node.expression,
|
|
38279
|
-
messageText:
|
|
38302
|
+
messageText: `\`${nodeText}\` is called inside an existing Effect context. Here, the inner Effect can be used directly.`,
|
|
38280
38303
|
fixes: []
|
|
38281
38304
|
});
|
|
38282
38305
|
}
|
|
@@ -38331,7 +38354,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
38331
38354
|
const otherProperties = arg.properties.filter((prop) => prop !== tagProperty);
|
|
38332
38355
|
report({
|
|
38333
38356
|
location: node,
|
|
38334
|
-
messageText: "Schema.Struct
|
|
38357
|
+
messageText: "This `Schema.Struct` includes a `_tag` field. `Schema.TaggedStruct` is the tagged-struct form for this pattern and makes the tag optional in the constructor.",
|
|
38335
38358
|
fixes: [{
|
|
38336
38359
|
fixName: "schemaStructWithTag_fix",
|
|
38337
38360
|
description: "Replace with Schema.TaggedStruct",
|
|
@@ -38424,7 +38447,7 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
38424
38447
|
const effectMethodName = syncToEffectMethod[isSchemaSyncCall.value.methodName];
|
|
38425
38448
|
report({
|
|
38426
38449
|
location: node.expression,
|
|
38427
|
-
messageText:
|
|
38450
|
+
messageText: `\`${nodeText}\` is used inside an Effect generator. \`Schema.${effectMethodName}\` preserves the typed Effect error channel for this operation without throwing.`,
|
|
38428
38451
|
fixes: []
|
|
38429
38452
|
});
|
|
38430
38453
|
}
|
|
@@ -38484,7 +38507,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
38484
38507
|
const schemaLiteralExpression = firstLiteralCall.expression;
|
|
38485
38508
|
report({
|
|
38486
38509
|
location: node,
|
|
38487
|
-
messageText: "
|
|
38510
|
+
messageText: "This `Schema.Union` contains multiple `Schema.Literal` members and can be simplified to a single `Schema.Literal` call.",
|
|
38488
38511
|
fixes: [{
|
|
38489
38512
|
fixName: "schemaUnionOfLiterals_fix",
|
|
38490
38513
|
description: "Replace with a single Schema.Literal call",
|
|
@@ -38547,8 +38570,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
38547
38570
|
map12(
|
|
38548
38571
|
() => report({
|
|
38549
38572
|
location: node,
|
|
38550
|
-
messageText: `
|
|
38551
|
-
Consider using "scoped" instead to get rid of the scope in the requirements.`,
|
|
38573
|
+
messageText: "This layer construction leaves `Scope` in the requirement set. The scoped API removes `Scope` from the resulting requirements.",
|
|
38552
38574
|
fixes: methodIdentifier ? [{
|
|
38553
38575
|
fixName: "scopeInLayerEffect_scoped",
|
|
38554
38576
|
description: "Use scoped for Layer creation",
|
|
@@ -38648,7 +38670,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
38648
38670
|
const shapeText = typeArgs.length > 0 ? typeArgs.map((t) => sourceFile.text.substring(ts.getTokenPosOfNode(t, sourceFile), t.end)).join(", ") : "Shape";
|
|
38649
38671
|
report({
|
|
38650
38672
|
location: callExpr,
|
|
38651
|
-
messageText:
|
|
38673
|
+
messageText: `\`ServiceMap.Service\` is assigned to a variable here, but this API is intended for a class declaration shape such as \`class ${variableName} extends ServiceMap.Service<${variableName}, ${shapeText}>()("${argsText.replace(/['"]/g, "")}") {}\`.`,
|
|
38652
38674
|
fixes: [{
|
|
38653
38675
|
fixName: "serviceNotAsClass",
|
|
38654
38676
|
description: `Convert to class declaration`,
|
|
@@ -38861,7 +38883,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
38861
38883
|
map12(() => {
|
|
38862
38884
|
report({
|
|
38863
38885
|
location: node,
|
|
38864
|
-
messageText: `
|
|
38886
|
+
messageText: `This Effect generator contains \`try/catch\`; in this context, error handling is expressed with Effect APIs such as ${alternatives.join(", ")}).`,
|
|
38865
38887
|
fixes: []
|
|
38866
38888
|
});
|
|
38867
38889
|
}),
|
|
@@ -38922,8 +38944,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
38922
38944
|
);
|
|
38923
38945
|
report({
|
|
38924
38946
|
location: node.expression,
|
|
38925
|
-
messageText: `The
|
|
38926
|
-
Consider wrapping unknown errors into Effect's Data.TaggedError for example, or narrow down the type to the specific error raised.`,
|
|
38947
|
+
messageText: `The \`catch\` callback in \`${nodeText}\` returns \`unknown\`, so the Effect error type stays untyped. A specific typed error preserves error-channel information, for example by narrowing the value or wrapping it in \`Data.TaggedError\`.`,
|
|
38927
38948
|
fixes: []
|
|
38928
38949
|
});
|
|
38929
38950
|
}
|
|
@@ -39020,7 +39041,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
39020
39041
|
map12(
|
|
39021
39042
|
() => report({
|
|
39022
39043
|
location: node,
|
|
39023
|
-
messageText:
|
|
39044
|
+
messageText: "This `yield* Effect.fail(...)` passes a yieldable error value. `yield*` represents that value directly without wrapping it in `Effect.fail`.",
|
|
39024
39045
|
fixes: [{
|
|
39025
39046
|
fixName: "unnecessaryFailYieldableError_fix",
|
|
39026
39047
|
description: "Replace yield* Effect.fail with yield*",
|
|
@@ -39125,7 +39146,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
39125
39146
|
map12(({ innerCall, pipeCall }) => {
|
|
39126
39147
|
report({
|
|
39127
39148
|
location: node,
|
|
39128
|
-
messageText: `
|
|
39149
|
+
messageText: "This expression contains chained `pipe` calls that can be simplified to a single `pipe` call.",
|
|
39129
39150
|
fixes: [{
|
|
39130
39151
|
fixName: "unnecessaryPipeChain_fix",
|
|
39131
39152
|
description: "Rewrite as single pipe call",
|
|
@@ -39395,7 +39416,7 @@ var metadata_default = {
|
|
|
39395
39416
|
{
|
|
39396
39417
|
start: 154,
|
|
39397
39418
|
end: 169,
|
|
39398
|
-
text: "Self type parameter should be
|
|
39419
|
+
text: "The `Self` type parameter for this class should be `InvalidContextTag`. effect(classSelfMismatch)"
|
|
39399
39420
|
}
|
|
39400
39421
|
]
|
|
39401
39422
|
}
|
|
@@ -39431,7 +39452,7 @@ var metadata_default = {
|
|
|
39431
39452
|
{
|
|
39432
39453
|
start: 86,
|
|
39433
39454
|
end: 91,
|
|
39434
|
-
text: "Parameter
|
|
39455
|
+
text: "Parameter `input` implicitly has type `any` in `Effect.fn`, `Effect.fnUntraced`, or `Effect.fnUntracedEager`. No parameter type is available from an explicit annotation or contextual function type. effect(effectFnImplicitAny)"
|
|
39435
39456
|
}
|
|
39436
39457
|
]
|
|
39437
39458
|
}
|
|
@@ -39452,7 +39473,7 @@ var metadata_default = {
|
|
|
39452
39473
|
{
|
|
39453
39474
|
start: 41,
|
|
39454
39475
|
end: 64,
|
|
39455
|
-
text: "Effect
|
|
39476
|
+
text: "This Effect value is neither yielded nor used in an assignment. effect(floatingEffect)"
|
|
39456
39477
|
}
|
|
39457
39478
|
]
|
|
39458
39479
|
}
|
|
@@ -39494,7 +39515,7 @@ var metadata_default = {
|
|
|
39494
39515
|
{
|
|
39495
39516
|
start: 160,
|
|
39496
39517
|
end: 167,
|
|
39497
|
-
text: "
|
|
39518
|
+
text: "This Effect requires a service that is missing from the expected Effect context: `Db`. effect(missingEffectContext)"
|
|
39498
39519
|
}
|
|
39499
39520
|
]
|
|
39500
39521
|
}
|
|
@@ -39557,7 +39578,7 @@ var metadata_default = {
|
|
|
39557
39578
|
{
|
|
39558
39579
|
start: 121,
|
|
39559
39580
|
end: 147,
|
|
39560
|
-
text: "
|
|
39581
|
+
text: "This Effect never succeeds; using `return yield*` preserves a definitive generator exit point for type narrowing and tooling support. effect(missingReturnYieldStar)"
|
|
39561
39582
|
}
|
|
39562
39583
|
]
|
|
39563
39584
|
}
|
|
@@ -39578,12 +39599,12 @@ var metadata_default = {
|
|
|
39578
39599
|
{
|
|
39579
39600
|
start: 75,
|
|
39580
39601
|
end: 83,
|
|
39581
|
-
text: "
|
|
39602
|
+
text: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context. effect(missingStarInYieldEffectGen)"
|
|
39582
39603
|
},
|
|
39583
39604
|
{
|
|
39584
39605
|
start: 105,
|
|
39585
39606
|
end: 128,
|
|
39586
|
-
text: "
|
|
39607
|
+
text: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context. effect(missingStarInYieldEffectGen)"
|
|
39587
39608
|
}
|
|
39588
39609
|
]
|
|
39589
39610
|
}
|
|
@@ -39603,7 +39624,7 @@ var metadata_default = {
|
|
|
39603
39624
|
{
|
|
39604
39625
|
start: 142,
|
|
39605
39626
|
end: 149,
|
|
39606
|
-
text: "Effect.Service
|
|
39627
|
+
text: "`Effect.Service` is declared with a primitive service type. `Effect.Service` models object-shaped services; primitive values use `Context.Tag` or `Effect.Tag` directly. effect(nonObjectEffectServiceType)"
|
|
39607
39628
|
}
|
|
39608
39629
|
]
|
|
39609
39630
|
}
|
|
@@ -39623,12 +39644,12 @@ var metadata_default = {
|
|
|
39623
39644
|
{
|
|
39624
39645
|
start: 0,
|
|
39625
39646
|
end: 0,
|
|
39626
|
-
text: "This project targets Effect v4, but
|
|
39647
|
+
text: "This project targets Effect v4, but this code uses Effect v3 APIs. The referenced API belongs to the v3 surface rather than the configured v4 surface. effect(outdatedApi)"
|
|
39627
39648
|
},
|
|
39628
39649
|
{
|
|
39629
39650
|
start: 126,
|
|
39630
39651
|
end: 133,
|
|
39631
|
-
text: "
|
|
39652
|
+
text: "This project targets Effect v4, but this code uses the Effect v3 API `runtime`. The referenced API belongs to the v3 surface rather than the configured v4 surface. effect(outdatedApi)"
|
|
39632
39653
|
}
|
|
39633
39654
|
]
|
|
39634
39655
|
}
|
|
@@ -39670,7 +39691,7 @@ var metadata_default = {
|
|
|
39670
39691
|
{
|
|
39671
39692
|
start: 123,
|
|
39672
39693
|
end: 185,
|
|
39673
|
-
text: "
|
|
39694
|
+
text: "This Schema subclass defines its own constructor. For Schema classes, constructor overrides break decoding behavior for the class shape. Custom construction can be expressed through a static `new` method instead. effect(overriddenSchemaConstructor)"
|
|
39674
39695
|
}
|
|
39675
39696
|
]
|
|
39676
39697
|
}
|
|
@@ -39712,7 +39733,7 @@ var metadata_default = {
|
|
|
39712
39733
|
{
|
|
39713
39734
|
start: 82,
|
|
39714
39735
|
end: 94,
|
|
39715
|
-
text: "
|
|
39736
|
+
text: "The previous Effect does not fail, so this error-handling branch will never run. effect(catchUnfailableEffect)"
|
|
39716
39737
|
}
|
|
39717
39738
|
]
|
|
39718
39739
|
}
|
|
@@ -39733,7 +39754,7 @@ var metadata_default = {
|
|
|
39733
39754
|
{
|
|
39734
39755
|
start: 64,
|
|
39735
39756
|
end: 137,
|
|
39736
|
-
text: `Effect.fn returns a reusable function that can take arguments, but
|
|
39757
|
+
text: '`Effect.fn` returns a reusable function that can take arguments, but it is invoked immediately here. `Effect.gen` represents the immediate-use form for this pattern with `Effect.withSpan("preview")` piped at the end to maintain tracing spans. effect(effectFnIife)'
|
|
39737
39758
|
}
|
|
39738
39759
|
]
|
|
39739
39760
|
}
|
|
@@ -39822,7 +39843,7 @@ var metadata_default = {
|
|
|
39822
39843
|
{
|
|
39823
39844
|
start: 56,
|
|
39824
39845
|
end: 73,
|
|
39825
|
-
text: "The
|
|
39846
|
+
text: "The `catch` callback in `Effect.tryPromise` returns the global `Error` type. Untagged errors merge together in the Effect error channel and lose type-level distinction; a tagged error preserves that distinction and can wrap the original error in a `cause` property. effect(globalErrorInEffectCatch)"
|
|
39826
39847
|
}
|
|
39827
39848
|
]
|
|
39828
39849
|
}
|
|
@@ -39885,7 +39906,7 @@ var metadata_default = {
|
|
|
39885
39906
|
{
|
|
39886
39907
|
start: 212,
|
|
39887
39908
|
end: 217,
|
|
39888
|
-
text: "Methods of this Service require `FileSystem` from every caller.\n\
|
|
39909
|
+
text: "Methods of this Service require `FileSystem` from every caller.\n\nThe requirement becomes part of the public service surface instead of remaining internal to Layer implementation.\n\nResolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.\n\nTo suppress this diagnostic for specific dependency types that are intentionally passed through (e.g., HttpServerRequest), add `@effect-leakable-service` JSDoc to their interface declarations (e.g., the `FileSystem` interface), or to this service by adding a `@effect-expect-leaking FileSystem` JSDoc.\n\nMore info and examples at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage effect(leakingRequirements)"
|
|
39889
39910
|
}
|
|
39890
39911
|
]
|
|
39891
39912
|
}
|
|
@@ -39906,7 +39927,7 @@ var metadata_default = {
|
|
|
39906
39927
|
{
|
|
39907
39928
|
start: 348,
|
|
39908
39929
|
end: 373,
|
|
39909
|
-
text: "
|
|
39930
|
+
text: "This expression chains multiple `Effect.provide` calls. Providing Layers in multiple calls in a chain can break service lifecycle behavior compared with a single combined provide with merged layers. effect(multipleEffectProvide)"
|
|
39910
39931
|
}
|
|
39911
39932
|
]
|
|
39912
39933
|
}
|
|
@@ -39927,7 +39948,7 @@ var metadata_default = {
|
|
|
39927
39948
|
{
|
|
39928
39949
|
start: 91,
|
|
39929
39950
|
end: 115,
|
|
39930
|
-
text: "
|
|
39951
|
+
text: "This generator returns an Effect-able value directly, which produces a nested `Effect<Effect<...>>`. If the intended result is the inner Effect value, `return yield*` represents that form. effect(returnEffectInGen)"
|
|
39931
39952
|
}
|
|
39932
39953
|
]
|
|
39933
39954
|
}
|
|
@@ -39948,7 +39969,7 @@ var metadata_default = {
|
|
|
39948
39969
|
{
|
|
39949
39970
|
start: 101,
|
|
39950
39971
|
end: 115,
|
|
39951
|
-
text: "
|
|
39972
|
+
text: "`Effect.runSync` is called inside an Effect with a separate services invocation. In this context, child Effects run with the surrounding services, which can be accessed through `Effect.services` and `Effect.runSyncWith`. effect(runEffectInsideEffect)"
|
|
39952
39973
|
}
|
|
39953
39974
|
]
|
|
39954
39975
|
}
|
|
@@ -39968,7 +39989,7 @@ var metadata_default = {
|
|
|
39968
39989
|
{
|
|
39969
39990
|
start: 276,
|
|
39970
39991
|
end: 293,
|
|
39971
|
-
text: "
|
|
39992
|
+
text: "`Schema.decodeSync` is used inside an Effect generator. `Schema.decode` preserves the typed Effect error channel for this operation without throwing. effect(schemaSyncInEffect)"
|
|
39972
39993
|
}
|
|
39973
39994
|
]
|
|
39974
39995
|
}
|
|
@@ -39988,7 +40009,7 @@ var metadata_default = {
|
|
|
39988
40009
|
{
|
|
39989
40010
|
start: 211,
|
|
39990
40011
|
end: 338,
|
|
39991
|
-
text:
|
|
40012
|
+
text: "This layer construction leaves `Scope` in the requirement set. The scoped API removes `Scope` from the resulting requirements. effect(scopeInLayerEffect)"
|
|
39992
40013
|
}
|
|
39993
40014
|
]
|
|
39994
40015
|
}
|
|
@@ -40030,7 +40051,7 @@ var metadata_default = {
|
|
|
40030
40051
|
{
|
|
40031
40052
|
start: 91,
|
|
40032
40053
|
end: 151,
|
|
40033
|
-
text: "
|
|
40054
|
+
text: "This Effect generator contains `try/catch`; in this context, error handling is expressed with Effect APIs such as Effect.try, Effect.tryPromise, Effect.catch, Effect.catchTag). effect(tryCatchInEffectGen)"
|
|
40034
40055
|
}
|
|
40035
40056
|
]
|
|
40036
40057
|
}
|
|
@@ -40051,7 +40072,7 @@ var metadata_default = {
|
|
|
40051
40072
|
{
|
|
40052
40073
|
start: 56,
|
|
40053
40074
|
end: 73,
|
|
40054
|
-
text: "The
|
|
40075
|
+
text: "The `catch` callback in `Effect.tryPromise` returns `unknown`, so the Effect error type stays untyped. A specific typed error preserves error-channel information, for example by narrowing the value or wrapping it in `Data.TaggedError`. effect(unknownInEffectCatch)"
|
|
40055
40076
|
}
|
|
40056
40077
|
]
|
|
40057
40078
|
}
|
|
@@ -40072,7 +40093,7 @@ var metadata_default = {
|
|
|
40072
40093
|
{
|
|
40073
40094
|
start: 14,
|
|
40074
40095
|
end: 26,
|
|
40075
|
-
text: "
|
|
40096
|
+
text: "This class extends the native `Error` type directly. Untagged native errors lose distinction in the Effect failure channel. effect(extendsNativeError)"
|
|
40076
40097
|
}
|
|
40077
40098
|
]
|
|
40078
40099
|
}
|
|
@@ -40093,7 +40114,7 @@ var metadata_default = {
|
|
|
40093
40114
|
{
|
|
40094
40115
|
start: 1,
|
|
40095
40116
|
end: 23,
|
|
40096
|
-
text: "
|
|
40117
|
+
text: "This code uses `console.log`, the corresponding Effect logging API is `Effect.log or Logger`. effect(globalConsole)"
|
|
40097
40118
|
}
|
|
40098
40119
|
]
|
|
40099
40120
|
}
|
|
@@ -40114,7 +40135,7 @@ var metadata_default = {
|
|
|
40114
40135
|
{
|
|
40115
40136
|
start: 83,
|
|
40116
40137
|
end: 103,
|
|
40117
|
-
text: "
|
|
40138
|
+
text: "This Effect code uses `console.log`, logging in Effect code is represented through `Effect.log or Logger`. effect(globalConsoleInEffect)"
|
|
40118
40139
|
}
|
|
40119
40140
|
]
|
|
40120
40141
|
}
|
|
@@ -40135,7 +40156,7 @@ var metadata_default = {
|
|
|
40135
40156
|
{
|
|
40136
40157
|
start: 24,
|
|
40137
40158
|
end: 34,
|
|
40138
|
-
text: "
|
|
40159
|
+
text: "This code uses `Date.now()`, time access is represented through `Clock` from Effect. effect(globalDate)"
|
|
40139
40160
|
}
|
|
40140
40161
|
]
|
|
40141
40162
|
}
|
|
@@ -40156,7 +40177,7 @@ var metadata_default = {
|
|
|
40156
40177
|
{
|
|
40157
40178
|
start: 95,
|
|
40158
40179
|
end: 105,
|
|
40159
|
-
text: "
|
|
40180
|
+
text: "This Effect code uses `Date.now()`, time access in Effect code is represented through `Clock` from Effect. effect(globalDateInEffect)"
|
|
40160
40181
|
}
|
|
40161
40182
|
]
|
|
40162
40183
|
}
|
|
@@ -40177,7 +40198,7 @@ var metadata_default = {
|
|
|
40177
40198
|
{
|
|
40178
40199
|
start: 24,
|
|
40179
40200
|
end: 29,
|
|
40180
|
-
text: "
|
|
40201
|
+
text: "This code uses the global `fetch` function, HTTP requests are represented through `HttpClient` from `@effect/platform`. effect(globalFetch)"
|
|
40181
40202
|
}
|
|
40182
40203
|
]
|
|
40183
40204
|
}
|
|
@@ -40213,7 +40234,7 @@ var metadata_default = {
|
|
|
40213
40234
|
{
|
|
40214
40235
|
start: 24,
|
|
40215
40236
|
end: 37,
|
|
40216
|
-
text: "
|
|
40237
|
+
text: "This code uses `Math.random()`, randomness is represented through the Effect `Random` service. effect(globalRandom)"
|
|
40217
40238
|
}
|
|
40218
40239
|
]
|
|
40219
40240
|
}
|
|
@@ -40234,7 +40255,7 @@ var metadata_default = {
|
|
|
40234
40255
|
{
|
|
40235
40256
|
start: 93,
|
|
40236
40257
|
end: 106,
|
|
40237
|
-
text: "
|
|
40258
|
+
text: "This Effect code uses `Math.random()`, randomness is represented through the Effect `Random` service. effect(globalRandomInEffect)"
|
|
40238
40259
|
}
|
|
40239
40260
|
]
|
|
40240
40261
|
}
|
|
@@ -40255,7 +40276,7 @@ var metadata_default = {
|
|
|
40255
40276
|
{
|
|
40256
40277
|
start: 1,
|
|
40257
40278
|
end: 26,
|
|
40258
|
-
text: "
|
|
40279
|
+
text: "This code uses `setTimeout`, the corresponding Effect timer API is `Effect.sleep or Schedule` from Effect. effect(globalTimers)"
|
|
40259
40280
|
}
|
|
40260
40281
|
]
|
|
40261
40282
|
}
|
|
@@ -40276,7 +40297,7 @@ var metadata_default = {
|
|
|
40276
40297
|
{
|
|
40277
40298
|
start: 83,
|
|
40278
40299
|
end: 108,
|
|
40279
|
-
text: "
|
|
40300
|
+
text: "This Effect code uses `setTimeout`, the corresponding timer API in this context is `Effect.sleep or Schedule` from Effect. effect(globalTimersInEffect)"
|
|
40280
40301
|
}
|
|
40281
40302
|
]
|
|
40282
40303
|
}
|
|
@@ -40297,7 +40318,7 @@ var metadata_default = {
|
|
|
40297
40318
|
{
|
|
40298
40319
|
start: 159,
|
|
40299
40320
|
end: 180,
|
|
40300
|
-
text: "
|
|
40321
|
+
text: "This code uses `instanceof` with an Effect Schema type. `Schema.is` is the schema-aware runtime check for this case. effect(instanceOfSchema)"
|
|
40301
40322
|
}
|
|
40302
40323
|
]
|
|
40303
40324
|
}
|
|
@@ -40318,7 +40339,7 @@ var metadata_default = {
|
|
|
40318
40339
|
{
|
|
40319
40340
|
start: 15,
|
|
40320
40341
|
end: 24,
|
|
40321
|
-
text: "
|
|
40342
|
+
text: "This module reference uses the `fs` module, the corresponding Effect API is `FileSystem` from `@effect/platform`. effect(nodeBuiltinImport)"
|
|
40322
40343
|
}
|
|
40323
40344
|
]
|
|
40324
40345
|
}
|
|
@@ -40345,7 +40366,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40345
40366
|
{
|
|
40346
40367
|
start: 142,
|
|
40347
40368
|
end: 158,
|
|
40348
|
-
text: "
|
|
40369
|
+
text: "This code uses `JSON.parse` or `JSON.stringify`. Effect Schema provides Effect-aware APIs for JSON parsing and stringifying. effect(preferSchemaOverJson)"
|
|
40349
40370
|
}
|
|
40350
40371
|
]
|
|
40351
40372
|
}
|
|
@@ -40366,7 +40387,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40366
40387
|
{
|
|
40367
40388
|
start: 150,
|
|
40368
40389
|
end: 162,
|
|
40369
|
-
text: "
|
|
40390
|
+
text: "`Effect.mapError` expresses the same error-type transformation more directly than `Effect.catch` followed by `Effect.fail`. effect(catchAllToMapError)"
|
|
40370
40391
|
}
|
|
40371
40392
|
]
|
|
40372
40393
|
}
|
|
@@ -40387,7 +40408,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40387
40408
|
{
|
|
40388
40409
|
start: 116,
|
|
40389
40410
|
end: 134,
|
|
40390
|
-
text: "
|
|
40411
|
+
text: "This key does not match the deterministic key for this declaration. The expected key is `@effect/harness-effect-v4/examples/diagnostics/deterministicKeys_preview/RenamedService`. effect(deterministicKeys)"
|
|
40391
40412
|
}
|
|
40392
40413
|
]
|
|
40393
40414
|
}
|
|
@@ -40408,7 +40429,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40408
40429
|
{
|
|
40409
40430
|
start: 54,
|
|
40410
40431
|
end: 61,
|
|
40411
|
-
text: "
|
|
40432
|
+
text: "This expression can be rewritten in the reusable function form `Effect.fn(function*() { ... })`. effect(effectFnOpportunity)"
|
|
40412
40433
|
}
|
|
40413
40434
|
]
|
|
40414
40435
|
}
|
|
@@ -40429,7 +40450,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40429
40450
|
{
|
|
40430
40451
|
start: 82,
|
|
40431
40452
|
end: 92,
|
|
40432
|
-
text: "
|
|
40453
|
+
text: "This expression discards the success value through mapping. `Effect.asVoid` represents that form directly. effect(effectMapVoid)"
|
|
40433
40454
|
}
|
|
40434
40455
|
]
|
|
40435
40456
|
}
|
|
@@ -40450,7 +40471,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40450
40471
|
{
|
|
40451
40472
|
start: 56,
|
|
40452
40473
|
end: 81,
|
|
40453
|
-
text: "Effect.void
|
|
40474
|
+
text: "`Effect.void` represents the same outcome as `Effect.succeed(undefined)` or `Effect.succeed(void 0)`. effect(effectSucceedWithVoid)"
|
|
40454
40475
|
}
|
|
40455
40476
|
]
|
|
40456
40477
|
}
|
|
@@ -40492,7 +40513,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40492
40513
|
{
|
|
40493
40514
|
start: 116,
|
|
40494
40515
|
end: 172,
|
|
40495
|
-
text: "
|
|
40516
|
+
text: "This nested call structure has a pipeable form. `Schema.decodeEffect(User)({ id: 1 }).pipe(...)` represents the same call sequence in pipe style and may be easier to read. effect(missedPipeableOpportunity)"
|
|
40496
40517
|
}
|
|
40497
40518
|
]
|
|
40498
40519
|
}
|
|
@@ -40554,7 +40575,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40554
40575
|
{
|
|
40555
40576
|
start: 64,
|
|
40556
40577
|
end: 136,
|
|
40557
|
-
text: "Schema.Struct
|
|
40578
|
+
text: "This `Schema.Struct` includes a `_tag` field. `Schema.TaggedStruct` is the tagged-struct form for this pattern and makes the tag optional in the constructor. effect(schemaStructWithTag)"
|
|
40558
40579
|
}
|
|
40559
40580
|
]
|
|
40560
40581
|
}
|
|
@@ -40574,7 +40595,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40574
40595
|
{
|
|
40575
40596
|
start: 64,
|
|
40576
40597
|
end: 118,
|
|
40577
|
-
text: "
|
|
40598
|
+
text: "This `Schema.Union` contains multiple `Schema.Literal` members and can be simplified to a single `Schema.Literal` call. effect(schemaUnionOfLiterals)"
|
|
40578
40599
|
}
|
|
40579
40600
|
]
|
|
40580
40601
|
}
|
|
@@ -40594,7 +40615,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40594
40615
|
{
|
|
40595
40616
|
start: 60,
|
|
40596
40617
|
end: 107,
|
|
40597
|
-
text: 'ServiceMap.Service
|
|
40618
|
+
text: '`ServiceMap.Service` is assigned to a variable here, but this API is intended for a class declaration shape such as `class Preview extends ServiceMap.Service<Preview, { port: number }>()("Preview") {}`. effect(serviceNotAsClass)'
|
|
40598
40619
|
}
|
|
40599
40620
|
]
|
|
40600
40621
|
}
|
|
@@ -40662,7 +40683,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40662
40683
|
{
|
|
40663
40684
|
start: 178,
|
|
40664
40685
|
end: 208,
|
|
40665
|
-
text: "This Effect.fail
|
|
40686
|
+
text: "This `yield* Effect.fail(...)` passes a yieldable error value. `yield*` represents that value directly without wrapping it in `Effect.fail`. effect(unnecessaryFailYieldableError)"
|
|
40666
40687
|
}
|
|
40667
40688
|
]
|
|
40668
40689
|
}
|
|
@@ -40704,7 +40725,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40704
40725
|
{
|
|
40705
40726
|
start: 64,
|
|
40706
40727
|
end: 125,
|
|
40707
|
-
text: "
|
|
40728
|
+
text: "This expression contains chained `pipe` calls that can be simplified to a single `pipe` call. effect(unnecessaryPipeChain)"
|
|
40708
40729
|
}
|
|
40709
40730
|
]
|
|
40710
40731
|
}
|