@effect/language-service 0.80.0 → 0.82.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 +71 -56
- package/cli.js +1974 -270
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +217 -6
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +217 -6
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/schema.json +2828 -0
- package/transform.js +217 -6
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -7153,6 +7153,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
7153
7153
|
name: "anyUnknownInErrorContext",
|
|
7154
7154
|
code: 28,
|
|
7155
7155
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
7156
|
+
group: "correctness",
|
|
7156
7157
|
severity: "off",
|
|
7157
7158
|
fixable: false,
|
|
7158
7159
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7258,6 +7259,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
7258
7259
|
name: "catchAllToMapError",
|
|
7259
7260
|
code: 39,
|
|
7260
7261
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
7262
|
+
group: "style",
|
|
7261
7263
|
severity: "suggestion",
|
|
7262
7264
|
fixable: true,
|
|
7263
7265
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7357,6 +7359,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
7357
7359
|
name: "catchUnfailableEffect",
|
|
7358
7360
|
code: 2,
|
|
7359
7361
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
7362
|
+
group: "antipattern",
|
|
7360
7363
|
severity: "suggestion",
|
|
7361
7364
|
fixable: false,
|
|
7362
7365
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7408,6 +7411,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
7408
7411
|
name: "classSelfMismatch",
|
|
7409
7412
|
code: 20,
|
|
7410
7413
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
7414
|
+
group: "correctness",
|
|
7411
7415
|
severity: "error",
|
|
7412
7416
|
fixable: true,
|
|
7413
7417
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7425,6 +7429,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
7425
7429
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
7426
7430
|
const result = yield* pipe(
|
|
7427
7431
|
typeParser.extendsEffectService(node),
|
|
7432
|
+
orElse2(() => typeParser.extendsServiceMapService(node)),
|
|
7428
7433
|
orElse2(() => typeParser.extendsContextTag(node)),
|
|
7429
7434
|
orElse2(() => typeParser.extendsEffectTag(node)),
|
|
7430
7435
|
orElse2(() => typeParser.extendsSchemaClass(node)),
|
|
@@ -7482,6 +7487,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
7482
7487
|
name: "deterministicKeys",
|
|
7483
7488
|
code: 25,
|
|
7484
7489
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
7490
|
+
group: "style",
|
|
7485
7491
|
severity: "off",
|
|
7486
7492
|
fixable: true,
|
|
7487
7493
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7601,6 +7607,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
7601
7607
|
name: "duplicatePackage",
|
|
7602
7608
|
code: 6,
|
|
7603
7609
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
7610
|
+
group: "correctness",
|
|
7604
7611
|
severity: "warning",
|
|
7605
7612
|
fixable: false,
|
|
7606
7613
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7632,6 +7639,7 @@ var effectFnIife = createDiagnostic({
|
|
|
7632
7639
|
name: "effectFnIife",
|
|
7633
7640
|
code: 46,
|
|
7634
7641
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
7642
|
+
group: "antipattern",
|
|
7635
7643
|
severity: "warning",
|
|
7636
7644
|
fixable: true,
|
|
7637
7645
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7731,11 +7739,95 @@ var effectFnIife = createDiagnostic({
|
|
|
7731
7739
|
})
|
|
7732
7740
|
});
|
|
7733
7741
|
|
|
7742
|
+
// src/diagnostics/effectFnImplicitAny.ts
|
|
7743
|
+
var getParameterName = (typescript, name) => {
|
|
7744
|
+
if (typescript.isIdentifier(name)) {
|
|
7745
|
+
return typescript.idText(name);
|
|
7746
|
+
}
|
|
7747
|
+
return "parameter";
|
|
7748
|
+
};
|
|
7749
|
+
var hasOuterContextualFunctionType = (typescript, typeChecker, node) => {
|
|
7750
|
+
const contextualType = typeChecker.getContextualType(node);
|
|
7751
|
+
if (!contextualType) {
|
|
7752
|
+
return false;
|
|
7753
|
+
}
|
|
7754
|
+
return typeChecker.getSignaturesOfType(contextualType, typescript.SignatureKind.Call).length > 0;
|
|
7755
|
+
};
|
|
7756
|
+
var effectFnImplicitAny = createDiagnostic({
|
|
7757
|
+
name: "effectFnImplicitAny",
|
|
7758
|
+
code: 54,
|
|
7759
|
+
description: "Mirrors noImplicitAny for unannotated Effect.fn and Effect.fnUntraced callback parameters when no outer contextual function type exists",
|
|
7760
|
+
group: "correctness",
|
|
7761
|
+
severity: "error",
|
|
7762
|
+
fixable: false,
|
|
7763
|
+
supportedEffect: ["v3", "v4"],
|
|
7764
|
+
apply: fn("effectFnImplicitAny.apply")(function* (sourceFile, report) {
|
|
7765
|
+
const ts = yield* service(TypeScriptApi);
|
|
7766
|
+
const program = yield* service(TypeScriptProgram);
|
|
7767
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
7768
|
+
const typeParser = yield* service(TypeParser);
|
|
7769
|
+
const noImplicitAny = program.getCompilerOptions().noImplicitAny ?? program.getCompilerOptions().strict ?? false;
|
|
7770
|
+
if (!noImplicitAny) {
|
|
7771
|
+
return;
|
|
7772
|
+
}
|
|
7773
|
+
const nodeToVisit = [sourceFile];
|
|
7774
|
+
const appendNodeToVisit = (node) => {
|
|
7775
|
+
nodeToVisit.push(node);
|
|
7776
|
+
return void 0;
|
|
7777
|
+
};
|
|
7778
|
+
while (nodeToVisit.length > 0) {
|
|
7779
|
+
const node = nodeToVisit.pop();
|
|
7780
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
7781
|
+
const parsed = yield* pipe(
|
|
7782
|
+
typeParser.effectFn(node),
|
|
7783
|
+
map5((result) => ({
|
|
7784
|
+
call: result.node,
|
|
7785
|
+
fn: result.regularFunction
|
|
7786
|
+
})),
|
|
7787
|
+
orElse2(
|
|
7788
|
+
() => pipe(
|
|
7789
|
+
typeParser.effectFnGen(node),
|
|
7790
|
+
map5((result) => ({
|
|
7791
|
+
call: result.node,
|
|
7792
|
+
fn: result.generatorFunction
|
|
7793
|
+
}))
|
|
7794
|
+
)
|
|
7795
|
+
),
|
|
7796
|
+
orElse2(
|
|
7797
|
+
() => pipe(
|
|
7798
|
+
typeParser.effectFnUntracedGen(node),
|
|
7799
|
+
map5((result) => ({
|
|
7800
|
+
call: result.node,
|
|
7801
|
+
fn: result.generatorFunction
|
|
7802
|
+
}))
|
|
7803
|
+
)
|
|
7804
|
+
),
|
|
7805
|
+
orUndefined
|
|
7806
|
+
);
|
|
7807
|
+
if (!parsed || hasOuterContextualFunctionType(ts, typeChecker, parsed.call)) {
|
|
7808
|
+
continue;
|
|
7809
|
+
}
|
|
7810
|
+
for (const parameter of parsed.fn.parameters) {
|
|
7811
|
+
if (parameter.type || parameter.initializer) {
|
|
7812
|
+
continue;
|
|
7813
|
+
}
|
|
7814
|
+
const parameterName = getParameterName(ts, parameter.name);
|
|
7815
|
+
report({
|
|
7816
|
+
location: parameter.name,
|
|
7817
|
+
messageText: `Parameter '${parameterName}' implicitly has an 'any' type in Effect.fn/Effect.fnUntraced. Add an explicit type annotation or provide a contextual function type.`,
|
|
7818
|
+
fixes: []
|
|
7819
|
+
});
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
})
|
|
7823
|
+
});
|
|
7824
|
+
|
|
7734
7825
|
// src/diagnostics/effectFnOpportunity.ts
|
|
7735
7826
|
var effectFnOpportunity = createDiagnostic({
|
|
7736
7827
|
name: "effectFnOpportunity",
|
|
7737
7828
|
code: 41,
|
|
7738
7829
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
7830
|
+
group: "style",
|
|
7739
7831
|
severity: "suggestion",
|
|
7740
7832
|
fixable: true,
|
|
7741
7833
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8330,6 +8422,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
8330
8422
|
name: "effectGenUsesAdapter",
|
|
8331
8423
|
code: 23,
|
|
8332
8424
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
8425
|
+
group: "antipattern",
|
|
8333
8426
|
severity: "warning",
|
|
8334
8427
|
fixable: false,
|
|
8335
8428
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8370,6 +8463,7 @@ var effectInFailure = createDiagnostic({
|
|
|
8370
8463
|
name: "effectInFailure",
|
|
8371
8464
|
code: 49,
|
|
8372
8465
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
8466
|
+
group: "antipattern",
|
|
8373
8467
|
severity: "warning",
|
|
8374
8468
|
fixable: false,
|
|
8375
8469
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8436,6 +8530,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
8436
8530
|
name: "effectInVoidSuccess",
|
|
8437
8531
|
code: 14,
|
|
8438
8532
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
8533
|
+
group: "antipattern",
|
|
8439
8534
|
severity: "warning",
|
|
8440
8535
|
fixable: false,
|
|
8441
8536
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8487,6 +8582,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
8487
8582
|
name: "effectMapVoid",
|
|
8488
8583
|
code: 40,
|
|
8489
8584
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
8585
|
+
group: "style",
|
|
8490
8586
|
severity: "suggestion",
|
|
8491
8587
|
fixable: true,
|
|
8492
8588
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8553,6 +8649,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
8553
8649
|
name: "effectSucceedWithVoid",
|
|
8554
8650
|
code: 47,
|
|
8555
8651
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
8652
|
+
group: "style",
|
|
8556
8653
|
severity: "suggestion",
|
|
8557
8654
|
fixable: true,
|
|
8558
8655
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8606,6 +8703,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
8606
8703
|
name: "extendsNativeError",
|
|
8607
8704
|
code: 50,
|
|
8608
8705
|
description: "Warns when a class directly extends the native Error class",
|
|
8706
|
+
group: "effectNative",
|
|
8609
8707
|
severity: "off",
|
|
8610
8708
|
fixable: false,
|
|
8611
8709
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8658,6 +8756,7 @@ var floatingEffect = createDiagnostic({
|
|
|
8658
8756
|
name: "floatingEffect",
|
|
8659
8757
|
code: 3,
|
|
8660
8758
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
8759
|
+
group: "correctness",
|
|
8661
8760
|
severity: "error",
|
|
8662
8761
|
fixable: false,
|
|
8663
8762
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8711,6 +8810,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
8711
8810
|
name: "genericEffectServices",
|
|
8712
8811
|
code: 10,
|
|
8713
8812
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
8813
|
+
group: "correctness",
|
|
8714
8814
|
severity: "warning",
|
|
8715
8815
|
fixable: false,
|
|
8716
8816
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8760,6 +8860,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
8760
8860
|
name: "globalErrorInEffectCatch",
|
|
8761
8861
|
code: 36,
|
|
8762
8862
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
8863
|
+
group: "antipattern",
|
|
8763
8864
|
severity: "warning",
|
|
8764
8865
|
fixable: false,
|
|
8765
8866
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8822,6 +8923,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
8822
8923
|
name: "globalErrorInEffectFailure",
|
|
8823
8924
|
code: 35,
|
|
8824
8925
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
8926
|
+
group: "antipattern",
|
|
8825
8927
|
severity: "warning",
|
|
8826
8928
|
fixable: false,
|
|
8827
8929
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8872,11 +8974,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
8872
8974
|
})
|
|
8873
8975
|
});
|
|
8874
8976
|
|
|
8977
|
+
// src/diagnostics/globalFetch.ts
|
|
8978
|
+
var globalFetch = createDiagnostic({
|
|
8979
|
+
name: "globalFetch",
|
|
8980
|
+
code: 53,
|
|
8981
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
8982
|
+
group: "effectNative",
|
|
8983
|
+
severity: "off",
|
|
8984
|
+
fixable: false,
|
|
8985
|
+
supportedEffect: ["v3", "v4"],
|
|
8986
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
8987
|
+
const ts = yield* service(TypeScriptApi);
|
|
8988
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
8989
|
+
const typeParser = yield* service(TypeParser);
|
|
8990
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
8991
|
+
if (!fetchSymbol) return;
|
|
8992
|
+
const effectVersion = typeParser.supportedEffect();
|
|
8993
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
8994
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
8995
|
+
const nodeToVisit = [];
|
|
8996
|
+
const appendNodeToVisit = (node) => {
|
|
8997
|
+
nodeToVisit.push(node);
|
|
8998
|
+
return void 0;
|
|
8999
|
+
};
|
|
9000
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
9001
|
+
while (nodeToVisit.length > 0) {
|
|
9002
|
+
const node = nodeToVisit.shift();
|
|
9003
|
+
if (ts.isCallExpression(node)) {
|
|
9004
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
9005
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
9006
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
9007
|
+
report({
|
|
9008
|
+
location: node.expression,
|
|
9009
|
+
messageText,
|
|
9010
|
+
fixes: []
|
|
9011
|
+
});
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
9014
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
9015
|
+
}
|
|
9016
|
+
})
|
|
9017
|
+
});
|
|
9018
|
+
|
|
8875
9019
|
// src/diagnostics/importFromBarrel.ts
|
|
8876
9020
|
var importFromBarrel = createDiagnostic({
|
|
8877
9021
|
name: "importFromBarrel",
|
|
8878
9022
|
code: 12,
|
|
8879
9023
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
9024
|
+
group: "style",
|
|
8880
9025
|
severity: "off",
|
|
8881
9026
|
fixable: true,
|
|
8882
9027
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9019,6 +9164,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
9019
9164
|
name: "instanceOfSchema",
|
|
9020
9165
|
code: 45,
|
|
9021
9166
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
9167
|
+
group: "effectNative",
|
|
9022
9168
|
severity: "off",
|
|
9023
9169
|
fixable: true,
|
|
9024
9170
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9084,6 +9230,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
9084
9230
|
name: "layerMergeAllWithDependencies",
|
|
9085
9231
|
code: 37,
|
|
9086
9232
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
9233
|
+
group: "antipattern",
|
|
9087
9234
|
severity: "warning",
|
|
9088
9235
|
fixable: true,
|
|
9089
9236
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9199,6 +9346,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
9199
9346
|
name: "leakingRequirements",
|
|
9200
9347
|
code: 8,
|
|
9201
9348
|
description: "Detects implementation services leaked in service methods",
|
|
9349
|
+
group: "antipattern",
|
|
9202
9350
|
severity: "suggestion",
|
|
9203
9351
|
fixable: false,
|
|
9204
9352
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9208,6 +9356,24 @@ var leakingRequirements = createDiagnostic({
|
|
|
9208
9356
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
9209
9357
|
const typeParser = yield* service(TypeParser);
|
|
9210
9358
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
9359
|
+
const isExpectedLeakingServiceSuppressed = (leakedServiceName, startNode) => {
|
|
9360
|
+
const sourceFile2 = tsUtils.getSourceFileOfNode(startNode);
|
|
9361
|
+
if (!sourceFile2) return false;
|
|
9362
|
+
return !!ts.findAncestor(startNode, (current) => {
|
|
9363
|
+
const ranges = ts.getLeadingCommentRanges(sourceFile2.text, current.pos) ?? [];
|
|
9364
|
+
const isSuppressed = ranges.some((range) => {
|
|
9365
|
+
const commentText = sourceFile2.text.slice(range.pos, range.end);
|
|
9366
|
+
return commentText.split("\n").filter((line) => line.includes("@effect-expect-leaking")).some((line) => {
|
|
9367
|
+
const markerIndex = line.indexOf("@effect-expect-leaking");
|
|
9368
|
+
return markerIndex !== -1 && line.slice(markerIndex + "@effect-expect-leaking".length).includes(leakedServiceName);
|
|
9369
|
+
});
|
|
9370
|
+
});
|
|
9371
|
+
if (isSuppressed) {
|
|
9372
|
+
return true;
|
|
9373
|
+
}
|
|
9374
|
+
return ts.isClassDeclaration(current) || ts.isVariableStatement(current) || ts.isExpressionStatement(current) || ts.isStatement(current) ? "quit" : false;
|
|
9375
|
+
});
|
|
9376
|
+
};
|
|
9211
9377
|
const parseLeakedRequirements = cachedBy(
|
|
9212
9378
|
fn("leakingServices.checkServiceLeaking")(
|
|
9213
9379
|
function* (service2, atLocation) {
|
|
@@ -9289,8 +9455,12 @@ var leakingRequirements = createDiagnostic({
|
|
|
9289
9455
|
(_, service2) => service2
|
|
9290
9456
|
);
|
|
9291
9457
|
function reportLeakingRequirements(node, requirements) {
|
|
9292
|
-
|
|
9293
|
-
|
|
9458
|
+
const filteredRequirements = requirements.filter(
|
|
9459
|
+
(requirement) => !isExpectedLeakingServiceSuppressed(typeChecker.typeToString(requirement), node)
|
|
9460
|
+
);
|
|
9461
|
+
if (filteredRequirements.length === 0) return;
|
|
9462
|
+
const requirementsStr = filteredRequirements.map((_) => typeChecker.typeToString(_)).join(" | ");
|
|
9463
|
+
const firstStr = typeChecker.typeToString(filteredRequirements[0]);
|
|
9294
9464
|
report({
|
|
9295
9465
|
location: node,
|
|
9296
9466
|
messageText: `Methods of this Service require \`${requirementsStr}\` from every caller.
|
|
@@ -9299,7 +9469,7 @@ This leaks implementation details into the service's public type \u2014 callers
|
|
|
9299
9469
|
|
|
9300
9470
|
Resolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.
|
|
9301
9471
|
|
|
9302
|
-
To 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 \`${
|
|
9472
|
+
To 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 \`${firstStr}\` interface), or to this service by adding a \`@effect-expect-leaking ${firstStr}\` JSDoc.
|
|
9303
9473
|
|
|
9304
9474
|
More info and examples at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage`,
|
|
9305
9475
|
fixes: []
|
|
@@ -9355,6 +9525,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
9355
9525
|
name: "missedPipeableOpportunity",
|
|
9356
9526
|
code: 26,
|
|
9357
9527
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
9528
|
+
group: "style",
|
|
9358
9529
|
severity: "off",
|
|
9359
9530
|
fixable: true,
|
|
9360
9531
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9537,6 +9708,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
9537
9708
|
name: "missingEffectContext",
|
|
9538
9709
|
code: 1,
|
|
9539
9710
|
description: "Reports missing service requirements in Effect context channel",
|
|
9711
|
+
group: "correctness",
|
|
9540
9712
|
severity: "error",
|
|
9541
9713
|
fixable: false,
|
|
9542
9714
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9588,6 +9760,7 @@ var missingEffectError = createDiagnostic({
|
|
|
9588
9760
|
name: "missingEffectError",
|
|
9589
9761
|
code: 1,
|
|
9590
9762
|
description: "Reports missing error types in Effect error channel",
|
|
9763
|
+
group: "correctness",
|
|
9591
9764
|
severity: "error",
|
|
9592
9765
|
fixable: true,
|
|
9593
9766
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9731,6 +9904,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
9731
9904
|
name: "missingEffectServiceDependency",
|
|
9732
9905
|
code: 22,
|
|
9733
9906
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
9907
|
+
group: "style",
|
|
9734
9908
|
severity: "off",
|
|
9735
9909
|
fixable: false,
|
|
9736
9910
|
supportedEffect: ["v3"],
|
|
@@ -9827,6 +10001,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
9827
10001
|
name: "missingLayerContext",
|
|
9828
10002
|
code: 38,
|
|
9829
10003
|
description: "Reports missing service requirements in Layer context channel",
|
|
10004
|
+
group: "correctness",
|
|
9830
10005
|
severity: "error",
|
|
9831
10006
|
fixable: false,
|
|
9832
10007
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9878,6 +10053,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
9878
10053
|
name: "missingReturnYieldStar",
|
|
9879
10054
|
code: 7,
|
|
9880
10055
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
10056
|
+
group: "correctness",
|
|
9881
10057
|
severity: "error",
|
|
9882
10058
|
fixable: true,
|
|
9883
10059
|
supportedEffect: ["v3", "v4"],
|
|
@@ -9930,6 +10106,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
9930
10106
|
name: "missingStarInYieldEffectGen",
|
|
9931
10107
|
code: 4,
|
|
9932
10108
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
10109
|
+
group: "correctness",
|
|
9933
10110
|
severity: "error",
|
|
9934
10111
|
fixable: true,
|
|
9935
10112
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10007,6 +10184,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
10007
10184
|
name: "multipleEffectProvide",
|
|
10008
10185
|
code: 18,
|
|
10009
10186
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
10187
|
+
group: "antipattern",
|
|
10010
10188
|
severity: "warning",
|
|
10011
10189
|
fixable: true,
|
|
10012
10190
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10109,7 +10287,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
10109
10287
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
10110
10288
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
10111
10289
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
10112
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
10290
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
10291
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
10292
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
10293
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
10294
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
10113
10295
|
]);
|
|
10114
10296
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
10115
10297
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -10123,12 +10305,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
10123
10305
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
10124
10306
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
10125
10307
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
10126
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
10308
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
10309
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
10310
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
10311
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
10312
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
10127
10313
|
]);
|
|
10128
10314
|
var nodeBuiltinImport = createDiagnostic({
|
|
10129
10315
|
name: "nodeBuiltinImport",
|
|
10130
10316
|
code: 52,
|
|
10131
10317
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
10318
|
+
group: "effectNative",
|
|
10132
10319
|
severity: "off",
|
|
10133
10320
|
fixable: false,
|
|
10134
10321
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10172,6 +10359,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
10172
10359
|
name: "nonObjectEffectServiceType",
|
|
10173
10360
|
code: 24,
|
|
10174
10361
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
10362
|
+
group: "correctness",
|
|
10175
10363
|
severity: "error",
|
|
10176
10364
|
fixable: false,
|
|
10177
10365
|
supportedEffect: ["v3"],
|
|
@@ -10956,6 +11144,7 @@ var outdatedApi = createDiagnostic({
|
|
|
10956
11144
|
name: "outdatedApi",
|
|
10957
11145
|
code: 48,
|
|
10958
11146
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
11147
|
+
group: "correctness",
|
|
10959
11148
|
severity: "warning",
|
|
10960
11149
|
fixable: false,
|
|
10961
11150
|
supportedEffect: ["v4"],
|
|
@@ -11025,6 +11214,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
11025
11214
|
name: "outdatedEffectCodegen",
|
|
11026
11215
|
code: 19,
|
|
11027
11216
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
11217
|
+
group: "correctness",
|
|
11028
11218
|
severity: "warning",
|
|
11029
11219
|
fixable: true,
|
|
11030
11220
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11073,6 +11263,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
11073
11263
|
name: "overriddenSchemaConstructor",
|
|
11074
11264
|
code: 30,
|
|
11075
11265
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
11266
|
+
group: "correctness",
|
|
11076
11267
|
severity: "error",
|
|
11077
11268
|
fixable: true,
|
|
11078
11269
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11212,6 +11403,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
11212
11403
|
name: "preferSchemaOverJson",
|
|
11213
11404
|
code: 44,
|
|
11214
11405
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
11406
|
+
group: "effectNative",
|
|
11215
11407
|
severity: "suggestion",
|
|
11216
11408
|
fixable: false,
|
|
11217
11409
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11324,6 +11516,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
11324
11516
|
name: "redundantSchemaTagIdentifier",
|
|
11325
11517
|
code: 42,
|
|
11326
11518
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
11519
|
+
group: "style",
|
|
11327
11520
|
severity: "suggestion",
|
|
11328
11521
|
fixable: true,
|
|
11329
11522
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11376,6 +11569,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
11376
11569
|
name: "returnEffectInGen",
|
|
11377
11570
|
code: 11,
|
|
11378
11571
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
11572
|
+
group: "antipattern",
|
|
11379
11573
|
severity: "suggestion",
|
|
11380
11574
|
fixable: true,
|
|
11381
11575
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11447,6 +11641,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
11447
11641
|
name: "runEffectInsideEffect",
|
|
11448
11642
|
code: 32,
|
|
11449
11643
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
11644
|
+
group: "antipattern",
|
|
11450
11645
|
severity: "suggestion",
|
|
11451
11646
|
fixable: true,
|
|
11452
11647
|
supportedEffect: ["v3"],
|
|
@@ -11573,6 +11768,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
11573
11768
|
name: "schemaStructWithTag",
|
|
11574
11769
|
code: 34,
|
|
11575
11770
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
11771
|
+
group: "style",
|
|
11576
11772
|
severity: "suggestion",
|
|
11577
11773
|
fixable: true,
|
|
11578
11774
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11667,9 +11863,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
11667
11863
|
name: "schemaSyncInEffect",
|
|
11668
11864
|
code: 43,
|
|
11669
11865
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11866
|
+
group: "antipattern",
|
|
11670
11867
|
severity: "suggestion",
|
|
11671
11868
|
fixable: false,
|
|
11672
|
-
supportedEffect: ["v3"
|
|
11869
|
+
supportedEffect: ["v3"],
|
|
11673
11870
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
11674
11871
|
const ts = yield* service(TypeScriptApi);
|
|
11675
11872
|
const typeParser = yield* service(TypeParser);
|
|
@@ -11718,6 +11915,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
11718
11915
|
name: "schemaUnionOfLiterals",
|
|
11719
11916
|
code: 33,
|
|
11720
11917
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11918
|
+
group: "style",
|
|
11721
11919
|
severity: "off",
|
|
11722
11920
|
fixable: true,
|
|
11723
11921
|
supportedEffect: ["v3"],
|
|
@@ -11795,6 +11993,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
11795
11993
|
name: "scopeInLayerEffect",
|
|
11796
11994
|
code: 13,
|
|
11797
11995
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11996
|
+
group: "antipattern",
|
|
11798
11997
|
severity: "warning",
|
|
11799
11998
|
fixable: true,
|
|
11800
11999
|
supportedEffect: ["v3"],
|
|
@@ -11892,6 +12091,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11892
12091
|
name: "serviceNotAsClass",
|
|
11893
12092
|
code: 51,
|
|
11894
12093
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
12094
|
+
group: "style",
|
|
11895
12095
|
severity: "off",
|
|
11896
12096
|
fixable: true,
|
|
11897
12097
|
supportedEffect: ["v4"],
|
|
@@ -11969,6 +12169,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11969
12169
|
name: "strictBooleanExpressions",
|
|
11970
12170
|
code: 17,
|
|
11971
12171
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
12172
|
+
group: "style",
|
|
11972
12173
|
severity: "off",
|
|
11973
12174
|
fixable: false,
|
|
11974
12175
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12042,6 +12243,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
12042
12243
|
name: "strictEffectProvide",
|
|
12043
12244
|
code: 27,
|
|
12044
12245
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
12246
|
+
group: "antipattern",
|
|
12045
12247
|
severity: "off",
|
|
12046
12248
|
fixable: false,
|
|
12047
12249
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12095,6 +12297,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
12095
12297
|
name: "tryCatchInEffectGen",
|
|
12096
12298
|
code: 15,
|
|
12097
12299
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
12300
|
+
group: "antipattern",
|
|
12098
12301
|
severity: "suggestion",
|
|
12099
12302
|
fixable: false,
|
|
12100
12303
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12154,6 +12357,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
12154
12357
|
name: "unknownInEffectCatch",
|
|
12155
12358
|
code: 31,
|
|
12156
12359
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
12360
|
+
group: "antipattern",
|
|
12157
12361
|
severity: "warning",
|
|
12158
12362
|
fixable: false,
|
|
12159
12363
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12217,6 +12421,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
12217
12421
|
name: "unnecessaryEffectGen",
|
|
12218
12422
|
code: 5,
|
|
12219
12423
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
12424
|
+
group: "style",
|
|
12220
12425
|
severity: "suggestion",
|
|
12221
12426
|
fixable: true,
|
|
12222
12427
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12263,6 +12468,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
12263
12468
|
name: "unnecessaryFailYieldableError",
|
|
12264
12469
|
code: 29,
|
|
12265
12470
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
12471
|
+
group: "style",
|
|
12266
12472
|
severity: "suggestion",
|
|
12267
12473
|
fixable: true,
|
|
12268
12474
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12324,6 +12530,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
12324
12530
|
name: "unnecessaryPipe",
|
|
12325
12531
|
code: 9,
|
|
12326
12532
|
description: "Removes pipe calls with no arguments",
|
|
12533
|
+
group: "style",
|
|
12327
12534
|
severity: "suggestion",
|
|
12328
12535
|
fixable: true,
|
|
12329
12536
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12372,6 +12579,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
12372
12579
|
name: "unnecessaryPipeChain",
|
|
12373
12580
|
code: 16,
|
|
12374
12581
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
12582
|
+
group: "style",
|
|
12375
12583
|
severity: "suggestion",
|
|
12376
12584
|
fixable: true,
|
|
12377
12585
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12449,6 +12657,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
12449
12657
|
name: "unsupportedServiceAccessors",
|
|
12450
12658
|
code: 21,
|
|
12451
12659
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
12660
|
+
group: "correctness",
|
|
12452
12661
|
severity: "warning",
|
|
12453
12662
|
fixable: true,
|
|
12454
12663
|
supportedEffect: ["v3", "v4"],
|
|
@@ -12512,6 +12721,7 @@ var diagnostics = [
|
|
|
12512
12721
|
catchUnfailableEffect,
|
|
12513
12722
|
classSelfMismatch,
|
|
12514
12723
|
duplicatePackage,
|
|
12724
|
+
effectFnImplicitAny,
|
|
12515
12725
|
effectGenUsesAdapter,
|
|
12516
12726
|
missingEffectContext,
|
|
12517
12727
|
missingEffectError,
|
|
@@ -12526,6 +12736,7 @@ var diagnostics = [
|
|
|
12526
12736
|
leakingRequirements,
|
|
12527
12737
|
unnecessaryPipe,
|
|
12528
12738
|
genericEffectServices,
|
|
12739
|
+
globalFetch,
|
|
12529
12740
|
returnEffectInGen,
|
|
12530
12741
|
tryCatchInEffectGen,
|
|
12531
12742
|
importFromBarrel,
|