@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
|
@@ -5273,6 +5273,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
5273
5273
|
name: "anyUnknownInErrorContext",
|
|
5274
5274
|
code: 28,
|
|
5275
5275
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
5276
|
+
group: "correctness",
|
|
5276
5277
|
severity: "off",
|
|
5277
5278
|
fixable: false,
|
|
5278
5279
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5378,6 +5379,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
5378
5379
|
name: "catchAllToMapError",
|
|
5379
5380
|
code: 39,
|
|
5380
5381
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
5382
|
+
group: "style",
|
|
5381
5383
|
severity: "suggestion",
|
|
5382
5384
|
fixable: true,
|
|
5383
5385
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5477,6 +5479,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
5477
5479
|
name: "catchUnfailableEffect",
|
|
5478
5480
|
code: 2,
|
|
5479
5481
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
5482
|
+
group: "antipattern",
|
|
5480
5483
|
severity: "suggestion",
|
|
5481
5484
|
fixable: false,
|
|
5482
5485
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5528,6 +5531,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5528
5531
|
name: "classSelfMismatch",
|
|
5529
5532
|
code: 20,
|
|
5530
5533
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
5534
|
+
group: "correctness",
|
|
5531
5535
|
severity: "error",
|
|
5532
5536
|
fixable: true,
|
|
5533
5537
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5545,6 +5549,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5545
5549
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
5546
5550
|
const result = yield* pipe(
|
|
5547
5551
|
typeParser.extendsEffectService(node),
|
|
5552
|
+
orElse2(() => typeParser.extendsServiceMapService(node)),
|
|
5548
5553
|
orElse2(() => typeParser.extendsContextTag(node)),
|
|
5549
5554
|
orElse2(() => typeParser.extendsEffectTag(node)),
|
|
5550
5555
|
orElse2(() => typeParser.extendsSchemaClass(node)),
|
|
@@ -5668,6 +5673,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5668
5673
|
name: "deterministicKeys",
|
|
5669
5674
|
code: 25,
|
|
5670
5675
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
5676
|
+
group: "style",
|
|
5671
5677
|
severity: "off",
|
|
5672
5678
|
fixable: true,
|
|
5673
5679
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5787,6 +5793,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
5787
5793
|
name: "duplicatePackage",
|
|
5788
5794
|
code: 6,
|
|
5789
5795
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
5796
|
+
group: "correctness",
|
|
5790
5797
|
severity: "warning",
|
|
5791
5798
|
fixable: false,
|
|
5792
5799
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5818,6 +5825,7 @@ var effectFnIife = createDiagnostic({
|
|
|
5818
5825
|
name: "effectFnIife",
|
|
5819
5826
|
code: 46,
|
|
5820
5827
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
5828
|
+
group: "antipattern",
|
|
5821
5829
|
severity: "warning",
|
|
5822
5830
|
fixable: true,
|
|
5823
5831
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5917,11 +5925,95 @@ var effectFnIife = createDiagnostic({
|
|
|
5917
5925
|
})
|
|
5918
5926
|
});
|
|
5919
5927
|
|
|
5928
|
+
// src/diagnostics/effectFnImplicitAny.ts
|
|
5929
|
+
var getParameterName = (typescript, name) => {
|
|
5930
|
+
if (typescript.isIdentifier(name)) {
|
|
5931
|
+
return typescript.idText(name);
|
|
5932
|
+
}
|
|
5933
|
+
return "parameter";
|
|
5934
|
+
};
|
|
5935
|
+
var hasOuterContextualFunctionType = (typescript, typeChecker, node) => {
|
|
5936
|
+
const contextualType = typeChecker.getContextualType(node);
|
|
5937
|
+
if (!contextualType) {
|
|
5938
|
+
return false;
|
|
5939
|
+
}
|
|
5940
|
+
return typeChecker.getSignaturesOfType(contextualType, typescript.SignatureKind.Call).length > 0;
|
|
5941
|
+
};
|
|
5942
|
+
var effectFnImplicitAny = createDiagnostic({
|
|
5943
|
+
name: "effectFnImplicitAny",
|
|
5944
|
+
code: 54,
|
|
5945
|
+
description: "Mirrors noImplicitAny for unannotated Effect.fn and Effect.fnUntraced callback parameters when no outer contextual function type exists",
|
|
5946
|
+
group: "correctness",
|
|
5947
|
+
severity: "error",
|
|
5948
|
+
fixable: false,
|
|
5949
|
+
supportedEffect: ["v3", "v4"],
|
|
5950
|
+
apply: fn("effectFnImplicitAny.apply")(function* (sourceFile, report) {
|
|
5951
|
+
const ts = yield* service(TypeScriptApi);
|
|
5952
|
+
const program = yield* service(TypeScriptProgram);
|
|
5953
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
5954
|
+
const typeParser = yield* service(TypeParser);
|
|
5955
|
+
const noImplicitAny = program.getCompilerOptions().noImplicitAny ?? program.getCompilerOptions().strict ?? false;
|
|
5956
|
+
if (!noImplicitAny) {
|
|
5957
|
+
return;
|
|
5958
|
+
}
|
|
5959
|
+
const nodeToVisit = [sourceFile];
|
|
5960
|
+
const appendNodeToVisit = (node) => {
|
|
5961
|
+
nodeToVisit.push(node);
|
|
5962
|
+
return void 0;
|
|
5963
|
+
};
|
|
5964
|
+
while (nodeToVisit.length > 0) {
|
|
5965
|
+
const node = nodeToVisit.pop();
|
|
5966
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
5967
|
+
const parsed = yield* pipe(
|
|
5968
|
+
typeParser.effectFn(node),
|
|
5969
|
+
map4((result) => ({
|
|
5970
|
+
call: result.node,
|
|
5971
|
+
fn: result.regularFunction
|
|
5972
|
+
})),
|
|
5973
|
+
orElse2(
|
|
5974
|
+
() => pipe(
|
|
5975
|
+
typeParser.effectFnGen(node),
|
|
5976
|
+
map4((result) => ({
|
|
5977
|
+
call: result.node,
|
|
5978
|
+
fn: result.generatorFunction
|
|
5979
|
+
}))
|
|
5980
|
+
)
|
|
5981
|
+
),
|
|
5982
|
+
orElse2(
|
|
5983
|
+
() => pipe(
|
|
5984
|
+
typeParser.effectFnUntracedGen(node),
|
|
5985
|
+
map4((result) => ({
|
|
5986
|
+
call: result.node,
|
|
5987
|
+
fn: result.generatorFunction
|
|
5988
|
+
}))
|
|
5989
|
+
)
|
|
5990
|
+
),
|
|
5991
|
+
orUndefined
|
|
5992
|
+
);
|
|
5993
|
+
if (!parsed || hasOuterContextualFunctionType(ts, typeChecker, parsed.call)) {
|
|
5994
|
+
continue;
|
|
5995
|
+
}
|
|
5996
|
+
for (const parameter of parsed.fn.parameters) {
|
|
5997
|
+
if (parameter.type || parameter.initializer) {
|
|
5998
|
+
continue;
|
|
5999
|
+
}
|
|
6000
|
+
const parameterName = getParameterName(ts, parameter.name);
|
|
6001
|
+
report({
|
|
6002
|
+
location: parameter.name,
|
|
6003
|
+
messageText: `Parameter '${parameterName}' implicitly has an 'any' type in Effect.fn/Effect.fnUntraced. Add an explicit type annotation or provide a contextual function type.`,
|
|
6004
|
+
fixes: []
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
6008
|
+
})
|
|
6009
|
+
});
|
|
6010
|
+
|
|
5920
6011
|
// src/diagnostics/effectFnOpportunity.ts
|
|
5921
6012
|
var effectFnOpportunity = createDiagnostic({
|
|
5922
6013
|
name: "effectFnOpportunity",
|
|
5923
6014
|
code: 41,
|
|
5924
6015
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
6016
|
+
group: "style",
|
|
5925
6017
|
severity: "suggestion",
|
|
5926
6018
|
fixable: true,
|
|
5927
6019
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6516,6 +6608,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
6516
6608
|
name: "effectGenUsesAdapter",
|
|
6517
6609
|
code: 23,
|
|
6518
6610
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
6611
|
+
group: "antipattern",
|
|
6519
6612
|
severity: "warning",
|
|
6520
6613
|
fixable: false,
|
|
6521
6614
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6556,6 +6649,7 @@ var effectInFailure = createDiagnostic({
|
|
|
6556
6649
|
name: "effectInFailure",
|
|
6557
6650
|
code: 49,
|
|
6558
6651
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
6652
|
+
group: "antipattern",
|
|
6559
6653
|
severity: "warning",
|
|
6560
6654
|
fixable: false,
|
|
6561
6655
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6622,6 +6716,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
6622
6716
|
name: "effectInVoidSuccess",
|
|
6623
6717
|
code: 14,
|
|
6624
6718
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
6719
|
+
group: "antipattern",
|
|
6625
6720
|
severity: "warning",
|
|
6626
6721
|
fixable: false,
|
|
6627
6722
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6673,6 +6768,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
6673
6768
|
name: "effectMapVoid",
|
|
6674
6769
|
code: 40,
|
|
6675
6770
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
6771
|
+
group: "style",
|
|
6676
6772
|
severity: "suggestion",
|
|
6677
6773
|
fixable: true,
|
|
6678
6774
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6739,6 +6835,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
6739
6835
|
name: "effectSucceedWithVoid",
|
|
6740
6836
|
code: 47,
|
|
6741
6837
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
6838
|
+
group: "style",
|
|
6742
6839
|
severity: "suggestion",
|
|
6743
6840
|
fixable: true,
|
|
6744
6841
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6792,6 +6889,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
6792
6889
|
name: "extendsNativeError",
|
|
6793
6890
|
code: 50,
|
|
6794
6891
|
description: "Warns when a class directly extends the native Error class",
|
|
6892
|
+
group: "effectNative",
|
|
6795
6893
|
severity: "off",
|
|
6796
6894
|
fixable: false,
|
|
6797
6895
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6844,6 +6942,7 @@ var floatingEffect = createDiagnostic({
|
|
|
6844
6942
|
name: "floatingEffect",
|
|
6845
6943
|
code: 3,
|
|
6846
6944
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
6945
|
+
group: "correctness",
|
|
6847
6946
|
severity: "error",
|
|
6848
6947
|
fixable: false,
|
|
6849
6948
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6897,6 +6996,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
6897
6996
|
name: "genericEffectServices",
|
|
6898
6997
|
code: 10,
|
|
6899
6998
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
6999
|
+
group: "correctness",
|
|
6900
7000
|
severity: "warning",
|
|
6901
7001
|
fixable: false,
|
|
6902
7002
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6946,6 +7046,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
6946
7046
|
name: "globalErrorInEffectCatch",
|
|
6947
7047
|
code: 36,
|
|
6948
7048
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
7049
|
+
group: "antipattern",
|
|
6949
7050
|
severity: "warning",
|
|
6950
7051
|
fixable: false,
|
|
6951
7052
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7008,6 +7109,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
7008
7109
|
name: "globalErrorInEffectFailure",
|
|
7009
7110
|
code: 35,
|
|
7010
7111
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
7112
|
+
group: "antipattern",
|
|
7011
7113
|
severity: "warning",
|
|
7012
7114
|
fixable: false,
|
|
7013
7115
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7058,11 +7160,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
7058
7160
|
})
|
|
7059
7161
|
});
|
|
7060
7162
|
|
|
7163
|
+
// src/diagnostics/globalFetch.ts
|
|
7164
|
+
var globalFetch = createDiagnostic({
|
|
7165
|
+
name: "globalFetch",
|
|
7166
|
+
code: 53,
|
|
7167
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
7168
|
+
group: "effectNative",
|
|
7169
|
+
severity: "off",
|
|
7170
|
+
fixable: false,
|
|
7171
|
+
supportedEffect: ["v3", "v4"],
|
|
7172
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
7173
|
+
const ts = yield* service(TypeScriptApi);
|
|
7174
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
7175
|
+
const typeParser = yield* service(TypeParser);
|
|
7176
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
7177
|
+
if (!fetchSymbol) return;
|
|
7178
|
+
const effectVersion = typeParser.supportedEffect();
|
|
7179
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
7180
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
7181
|
+
const nodeToVisit = [];
|
|
7182
|
+
const appendNodeToVisit = (node) => {
|
|
7183
|
+
nodeToVisit.push(node);
|
|
7184
|
+
return void 0;
|
|
7185
|
+
};
|
|
7186
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
7187
|
+
while (nodeToVisit.length > 0) {
|
|
7188
|
+
const node = nodeToVisit.shift();
|
|
7189
|
+
if (ts.isCallExpression(node)) {
|
|
7190
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
7191
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
7192
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
7193
|
+
report({
|
|
7194
|
+
location: node.expression,
|
|
7195
|
+
messageText,
|
|
7196
|
+
fixes: []
|
|
7197
|
+
});
|
|
7198
|
+
}
|
|
7199
|
+
}
|
|
7200
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
7201
|
+
}
|
|
7202
|
+
})
|
|
7203
|
+
});
|
|
7204
|
+
|
|
7061
7205
|
// src/diagnostics/importFromBarrel.ts
|
|
7062
7206
|
var importFromBarrel = createDiagnostic({
|
|
7063
7207
|
name: "importFromBarrel",
|
|
7064
7208
|
code: 12,
|
|
7065
7209
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
7210
|
+
group: "style",
|
|
7066
7211
|
severity: "off",
|
|
7067
7212
|
fixable: true,
|
|
7068
7213
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7205,6 +7350,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
7205
7350
|
name: "instanceOfSchema",
|
|
7206
7351
|
code: 45,
|
|
7207
7352
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
7353
|
+
group: "effectNative",
|
|
7208
7354
|
severity: "off",
|
|
7209
7355
|
fixable: true,
|
|
7210
7356
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7270,6 +7416,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
7270
7416
|
name: "layerMergeAllWithDependencies",
|
|
7271
7417
|
code: 37,
|
|
7272
7418
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
7419
|
+
group: "antipattern",
|
|
7273
7420
|
severity: "warning",
|
|
7274
7421
|
fixable: true,
|
|
7275
7422
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7385,6 +7532,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
7385
7532
|
name: "leakingRequirements",
|
|
7386
7533
|
code: 8,
|
|
7387
7534
|
description: "Detects implementation services leaked in service methods",
|
|
7535
|
+
group: "antipattern",
|
|
7388
7536
|
severity: "suggestion",
|
|
7389
7537
|
fixable: false,
|
|
7390
7538
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7394,6 +7542,24 @@ var leakingRequirements = createDiagnostic({
|
|
|
7394
7542
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7395
7543
|
const typeParser = yield* service(TypeParser);
|
|
7396
7544
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
7545
|
+
const isExpectedLeakingServiceSuppressed = (leakedServiceName, startNode) => {
|
|
7546
|
+
const sourceFile2 = tsUtils.getSourceFileOfNode(startNode);
|
|
7547
|
+
if (!sourceFile2) return false;
|
|
7548
|
+
return !!ts.findAncestor(startNode, (current) => {
|
|
7549
|
+
const ranges = ts.getLeadingCommentRanges(sourceFile2.text, current.pos) ?? [];
|
|
7550
|
+
const isSuppressed = ranges.some((range) => {
|
|
7551
|
+
const commentText = sourceFile2.text.slice(range.pos, range.end);
|
|
7552
|
+
return commentText.split("\n").filter((line) => line.includes("@effect-expect-leaking")).some((line) => {
|
|
7553
|
+
const markerIndex = line.indexOf("@effect-expect-leaking");
|
|
7554
|
+
return markerIndex !== -1 && line.slice(markerIndex + "@effect-expect-leaking".length).includes(leakedServiceName);
|
|
7555
|
+
});
|
|
7556
|
+
});
|
|
7557
|
+
if (isSuppressed) {
|
|
7558
|
+
return true;
|
|
7559
|
+
}
|
|
7560
|
+
return ts.isClassDeclaration(current) || ts.isVariableStatement(current) || ts.isExpressionStatement(current) || ts.isStatement(current) ? "quit" : false;
|
|
7561
|
+
});
|
|
7562
|
+
};
|
|
7397
7563
|
const parseLeakedRequirements = cachedBy(
|
|
7398
7564
|
fn("leakingServices.checkServiceLeaking")(
|
|
7399
7565
|
function* (service2, atLocation) {
|
|
@@ -7475,8 +7641,12 @@ var leakingRequirements = createDiagnostic({
|
|
|
7475
7641
|
(_, service2) => service2
|
|
7476
7642
|
);
|
|
7477
7643
|
function reportLeakingRequirements(node, requirements) {
|
|
7478
|
-
|
|
7479
|
-
|
|
7644
|
+
const filteredRequirements = requirements.filter(
|
|
7645
|
+
(requirement) => !isExpectedLeakingServiceSuppressed(typeChecker.typeToString(requirement), node)
|
|
7646
|
+
);
|
|
7647
|
+
if (filteredRequirements.length === 0) return;
|
|
7648
|
+
const requirementsStr = filteredRequirements.map((_) => typeChecker.typeToString(_)).join(" | ");
|
|
7649
|
+
const firstStr = typeChecker.typeToString(filteredRequirements[0]);
|
|
7480
7650
|
report({
|
|
7481
7651
|
location: node,
|
|
7482
7652
|
messageText: `Methods of this Service require \`${requirementsStr}\` from every caller.
|
|
@@ -7485,7 +7655,7 @@ This leaks implementation details into the service's public type \u2014 callers
|
|
|
7485
7655
|
|
|
7486
7656
|
Resolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.
|
|
7487
7657
|
|
|
7488
|
-
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 \`${
|
|
7658
|
+
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.
|
|
7489
7659
|
|
|
7490
7660
|
More info and examples at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage`,
|
|
7491
7661
|
fixes: []
|
|
@@ -7541,6 +7711,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
7541
7711
|
name: "missedPipeableOpportunity",
|
|
7542
7712
|
code: 26,
|
|
7543
7713
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
7714
|
+
group: "style",
|
|
7544
7715
|
severity: "off",
|
|
7545
7716
|
fixable: true,
|
|
7546
7717
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7723,6 +7894,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
7723
7894
|
name: "missingEffectContext",
|
|
7724
7895
|
code: 1,
|
|
7725
7896
|
description: "Reports missing service requirements in Effect context channel",
|
|
7897
|
+
group: "correctness",
|
|
7726
7898
|
severity: "error",
|
|
7727
7899
|
fixable: false,
|
|
7728
7900
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7774,6 +7946,7 @@ var missingEffectError = createDiagnostic({
|
|
|
7774
7946
|
name: "missingEffectError",
|
|
7775
7947
|
code: 1,
|
|
7776
7948
|
description: "Reports missing error types in Effect error channel",
|
|
7949
|
+
group: "correctness",
|
|
7777
7950
|
severity: "error",
|
|
7778
7951
|
fixable: true,
|
|
7779
7952
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7917,6 +8090,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
7917
8090
|
name: "missingEffectServiceDependency",
|
|
7918
8091
|
code: 22,
|
|
7919
8092
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
8093
|
+
group: "style",
|
|
7920
8094
|
severity: "off",
|
|
7921
8095
|
fixable: false,
|
|
7922
8096
|
supportedEffect: ["v3"],
|
|
@@ -8013,6 +8187,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
8013
8187
|
name: "missingLayerContext",
|
|
8014
8188
|
code: 38,
|
|
8015
8189
|
description: "Reports missing service requirements in Layer context channel",
|
|
8190
|
+
group: "correctness",
|
|
8016
8191
|
severity: "error",
|
|
8017
8192
|
fixable: false,
|
|
8018
8193
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8064,6 +8239,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
8064
8239
|
name: "missingReturnYieldStar",
|
|
8065
8240
|
code: 7,
|
|
8066
8241
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
8242
|
+
group: "correctness",
|
|
8067
8243
|
severity: "error",
|
|
8068
8244
|
fixable: true,
|
|
8069
8245
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8116,6 +8292,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
8116
8292
|
name: "missingStarInYieldEffectGen",
|
|
8117
8293
|
code: 4,
|
|
8118
8294
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
8295
|
+
group: "correctness",
|
|
8119
8296
|
severity: "error",
|
|
8120
8297
|
fixable: true,
|
|
8121
8298
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8193,6 +8370,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
8193
8370
|
name: "multipleEffectProvide",
|
|
8194
8371
|
code: 18,
|
|
8195
8372
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
8373
|
+
group: "antipattern",
|
|
8196
8374
|
severity: "warning",
|
|
8197
8375
|
fixable: true,
|
|
8198
8376
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8295,7 +8473,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
8295
8473
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8296
8474
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8297
8475
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8298
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
8476
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8477
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8478
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8479
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
8480
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
8299
8481
|
]);
|
|
8300
8482
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
8301
8483
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -8309,12 +8491,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
8309
8491
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8310
8492
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8311
8493
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8312
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
8494
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8495
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8496
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8497
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
8498
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
8313
8499
|
]);
|
|
8314
8500
|
var nodeBuiltinImport = createDiagnostic({
|
|
8315
8501
|
name: "nodeBuiltinImport",
|
|
8316
8502
|
code: 52,
|
|
8317
8503
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
8504
|
+
group: "effectNative",
|
|
8318
8505
|
severity: "off",
|
|
8319
8506
|
fixable: false,
|
|
8320
8507
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8358,6 +8545,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
8358
8545
|
name: "nonObjectEffectServiceType",
|
|
8359
8546
|
code: 24,
|
|
8360
8547
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
8548
|
+
group: "correctness",
|
|
8361
8549
|
severity: "error",
|
|
8362
8550
|
fixable: false,
|
|
8363
8551
|
supportedEffect: ["v3"],
|
|
@@ -9142,6 +9330,7 @@ var outdatedApi = createDiagnostic({
|
|
|
9142
9330
|
name: "outdatedApi",
|
|
9143
9331
|
code: 48,
|
|
9144
9332
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
9333
|
+
group: "correctness",
|
|
9145
9334
|
severity: "warning",
|
|
9146
9335
|
fixable: false,
|
|
9147
9336
|
supportedEffect: ["v4"],
|
|
@@ -10280,6 +10469,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
10280
10469
|
name: "outdatedEffectCodegen",
|
|
10281
10470
|
code: 19,
|
|
10282
10471
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
10472
|
+
group: "correctness",
|
|
10283
10473
|
severity: "warning",
|
|
10284
10474
|
fixable: true,
|
|
10285
10475
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10328,6 +10518,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
10328
10518
|
name: "overriddenSchemaConstructor",
|
|
10329
10519
|
code: 30,
|
|
10330
10520
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
10521
|
+
group: "correctness",
|
|
10331
10522
|
severity: "error",
|
|
10332
10523
|
fixable: true,
|
|
10333
10524
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10467,6 +10658,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
10467
10658
|
name: "preferSchemaOverJson",
|
|
10468
10659
|
code: 44,
|
|
10469
10660
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
10661
|
+
group: "effectNative",
|
|
10470
10662
|
severity: "suggestion",
|
|
10471
10663
|
fixable: false,
|
|
10472
10664
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10579,6 +10771,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
10579
10771
|
name: "redundantSchemaTagIdentifier",
|
|
10580
10772
|
code: 42,
|
|
10581
10773
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
10774
|
+
group: "style",
|
|
10582
10775
|
severity: "suggestion",
|
|
10583
10776
|
fixable: true,
|
|
10584
10777
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10631,6 +10824,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
10631
10824
|
name: "returnEffectInGen",
|
|
10632
10825
|
code: 11,
|
|
10633
10826
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
10827
|
+
group: "antipattern",
|
|
10634
10828
|
severity: "suggestion",
|
|
10635
10829
|
fixable: true,
|
|
10636
10830
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10702,6 +10896,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
10702
10896
|
name: "runEffectInsideEffect",
|
|
10703
10897
|
code: 32,
|
|
10704
10898
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
10899
|
+
group: "antipattern",
|
|
10705
10900
|
severity: "suggestion",
|
|
10706
10901
|
fixable: true,
|
|
10707
10902
|
supportedEffect: ["v3"],
|
|
@@ -10828,6 +11023,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
10828
11023
|
name: "schemaStructWithTag",
|
|
10829
11024
|
code: 34,
|
|
10830
11025
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
11026
|
+
group: "style",
|
|
10831
11027
|
severity: "suggestion",
|
|
10832
11028
|
fixable: true,
|
|
10833
11029
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10922,9 +11118,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
10922
11118
|
name: "schemaSyncInEffect",
|
|
10923
11119
|
code: 43,
|
|
10924
11120
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11121
|
+
group: "antipattern",
|
|
10925
11122
|
severity: "suggestion",
|
|
10926
11123
|
fixable: false,
|
|
10927
|
-
supportedEffect: ["v3"
|
|
11124
|
+
supportedEffect: ["v3"],
|
|
10928
11125
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
10929
11126
|
const ts = yield* service(TypeScriptApi);
|
|
10930
11127
|
const typeParser = yield* service(TypeParser);
|
|
@@ -10973,6 +11170,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
10973
11170
|
name: "schemaUnionOfLiterals",
|
|
10974
11171
|
code: 33,
|
|
10975
11172
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11173
|
+
group: "style",
|
|
10976
11174
|
severity: "off",
|
|
10977
11175
|
fixable: true,
|
|
10978
11176
|
supportedEffect: ["v3"],
|
|
@@ -11050,6 +11248,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
11050
11248
|
name: "scopeInLayerEffect",
|
|
11051
11249
|
code: 13,
|
|
11052
11250
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11251
|
+
group: "antipattern",
|
|
11053
11252
|
severity: "warning",
|
|
11054
11253
|
fixable: true,
|
|
11055
11254
|
supportedEffect: ["v3"],
|
|
@@ -11147,6 +11346,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11147
11346
|
name: "serviceNotAsClass",
|
|
11148
11347
|
code: 51,
|
|
11149
11348
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
11349
|
+
group: "style",
|
|
11150
11350
|
severity: "off",
|
|
11151
11351
|
fixable: true,
|
|
11152
11352
|
supportedEffect: ["v4"],
|
|
@@ -11224,6 +11424,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11224
11424
|
name: "strictBooleanExpressions",
|
|
11225
11425
|
code: 17,
|
|
11226
11426
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
11427
|
+
group: "style",
|
|
11227
11428
|
severity: "off",
|
|
11228
11429
|
fixable: false,
|
|
11229
11430
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11297,6 +11498,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
11297
11498
|
name: "strictEffectProvide",
|
|
11298
11499
|
code: 27,
|
|
11299
11500
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
11501
|
+
group: "antipattern",
|
|
11300
11502
|
severity: "off",
|
|
11301
11503
|
fixable: false,
|
|
11302
11504
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11350,6 +11552,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
11350
11552
|
name: "tryCatchInEffectGen",
|
|
11351
11553
|
code: 15,
|
|
11352
11554
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
11555
|
+
group: "antipattern",
|
|
11353
11556
|
severity: "suggestion",
|
|
11354
11557
|
fixable: false,
|
|
11355
11558
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11409,6 +11612,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
11409
11612
|
name: "unknownInEffectCatch",
|
|
11410
11613
|
code: 31,
|
|
11411
11614
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
11615
|
+
group: "antipattern",
|
|
11412
11616
|
severity: "warning",
|
|
11413
11617
|
fixable: false,
|
|
11414
11618
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11472,6 +11676,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
11472
11676
|
name: "unnecessaryEffectGen",
|
|
11473
11677
|
code: 5,
|
|
11474
11678
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
11679
|
+
group: "style",
|
|
11475
11680
|
severity: "suggestion",
|
|
11476
11681
|
fixable: true,
|
|
11477
11682
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11518,6 +11723,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
11518
11723
|
name: "unnecessaryFailYieldableError",
|
|
11519
11724
|
code: 29,
|
|
11520
11725
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
11726
|
+
group: "style",
|
|
11521
11727
|
severity: "suggestion",
|
|
11522
11728
|
fixable: true,
|
|
11523
11729
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11579,6 +11785,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
11579
11785
|
name: "unnecessaryPipe",
|
|
11580
11786
|
code: 9,
|
|
11581
11787
|
description: "Removes pipe calls with no arguments",
|
|
11788
|
+
group: "style",
|
|
11582
11789
|
severity: "suggestion",
|
|
11583
11790
|
fixable: true,
|
|
11584
11791
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11627,6 +11834,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
11627
11834
|
name: "unnecessaryPipeChain",
|
|
11628
11835
|
code: 16,
|
|
11629
11836
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
11837
|
+
group: "style",
|
|
11630
11838
|
severity: "suggestion",
|
|
11631
11839
|
fixable: true,
|
|
11632
11840
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11704,6 +11912,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
11704
11912
|
name: "unsupportedServiceAccessors",
|
|
11705
11913
|
code: 21,
|
|
11706
11914
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
11915
|
+
group: "correctness",
|
|
11707
11916
|
severity: "warning",
|
|
11708
11917
|
fixable: true,
|
|
11709
11918
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11767,6 +11976,7 @@ var diagnostics = [
|
|
|
11767
11976
|
catchUnfailableEffect,
|
|
11768
11977
|
classSelfMismatch,
|
|
11769
11978
|
duplicatePackage,
|
|
11979
|
+
effectFnImplicitAny,
|
|
11770
11980
|
effectGenUsesAdapter,
|
|
11771
11981
|
missingEffectContext,
|
|
11772
11982
|
missingEffectError,
|
|
@@ -11781,6 +11991,7 @@ var diagnostics = [
|
|
|
11781
11991
|
leakingRequirements,
|
|
11782
11992
|
unnecessaryPipe,
|
|
11783
11993
|
genericEffectServices,
|
|
11994
|
+
globalFetch,
|
|
11784
11995
|
returnEffectInGen,
|
|
11785
11996
|
tryCatchInEffectGen,
|
|
11786
11997
|
importFromBarrel,
|