@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/transform.js
CHANGED
|
@@ -5269,6 +5269,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
5269
5269
|
name: "anyUnknownInErrorContext",
|
|
5270
5270
|
code: 28,
|
|
5271
5271
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
5272
|
+
group: "correctness",
|
|
5272
5273
|
severity: "off",
|
|
5273
5274
|
fixable: false,
|
|
5274
5275
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5374,6 +5375,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
5374
5375
|
name: "catchAllToMapError",
|
|
5375
5376
|
code: 39,
|
|
5376
5377
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
5378
|
+
group: "style",
|
|
5377
5379
|
severity: "suggestion",
|
|
5378
5380
|
fixable: true,
|
|
5379
5381
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5473,6 +5475,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
5473
5475
|
name: "catchUnfailableEffect",
|
|
5474
5476
|
code: 2,
|
|
5475
5477
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
5478
|
+
group: "antipattern",
|
|
5476
5479
|
severity: "suggestion",
|
|
5477
5480
|
fixable: false,
|
|
5478
5481
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5524,6 +5527,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5524
5527
|
name: "classSelfMismatch",
|
|
5525
5528
|
code: 20,
|
|
5526
5529
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
5530
|
+
group: "correctness",
|
|
5527
5531
|
severity: "error",
|
|
5528
5532
|
fixable: true,
|
|
5529
5533
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5541,6 +5545,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5541
5545
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
5542
5546
|
const result = yield* pipe(
|
|
5543
5547
|
typeParser.extendsEffectService(node),
|
|
5548
|
+
orElse2(() => typeParser.extendsServiceMapService(node)),
|
|
5544
5549
|
orElse2(() => typeParser.extendsContextTag(node)),
|
|
5545
5550
|
orElse2(() => typeParser.extendsEffectTag(node)),
|
|
5546
5551
|
orElse2(() => typeParser.extendsSchemaClass(node)),
|
|
@@ -5664,6 +5669,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5664
5669
|
name: "deterministicKeys",
|
|
5665
5670
|
code: 25,
|
|
5666
5671
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
5672
|
+
group: "style",
|
|
5667
5673
|
severity: "off",
|
|
5668
5674
|
fixable: true,
|
|
5669
5675
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5783,6 +5789,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
5783
5789
|
name: "duplicatePackage",
|
|
5784
5790
|
code: 6,
|
|
5785
5791
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
5792
|
+
group: "correctness",
|
|
5786
5793
|
severity: "warning",
|
|
5787
5794
|
fixable: false,
|
|
5788
5795
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5814,6 +5821,7 @@ var effectFnIife = createDiagnostic({
|
|
|
5814
5821
|
name: "effectFnIife",
|
|
5815
5822
|
code: 46,
|
|
5816
5823
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
5824
|
+
group: "antipattern",
|
|
5817
5825
|
severity: "warning",
|
|
5818
5826
|
fixable: true,
|
|
5819
5827
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5913,11 +5921,95 @@ var effectFnIife = createDiagnostic({
|
|
|
5913
5921
|
})
|
|
5914
5922
|
});
|
|
5915
5923
|
|
|
5924
|
+
// src/diagnostics/effectFnImplicitAny.ts
|
|
5925
|
+
var getParameterName = (typescript, name) => {
|
|
5926
|
+
if (typescript.isIdentifier(name)) {
|
|
5927
|
+
return typescript.idText(name);
|
|
5928
|
+
}
|
|
5929
|
+
return "parameter";
|
|
5930
|
+
};
|
|
5931
|
+
var hasOuterContextualFunctionType = (typescript, typeChecker, node) => {
|
|
5932
|
+
const contextualType = typeChecker.getContextualType(node);
|
|
5933
|
+
if (!contextualType) {
|
|
5934
|
+
return false;
|
|
5935
|
+
}
|
|
5936
|
+
return typeChecker.getSignaturesOfType(contextualType, typescript.SignatureKind.Call).length > 0;
|
|
5937
|
+
};
|
|
5938
|
+
var effectFnImplicitAny = createDiagnostic({
|
|
5939
|
+
name: "effectFnImplicitAny",
|
|
5940
|
+
code: 54,
|
|
5941
|
+
description: "Mirrors noImplicitAny for unannotated Effect.fn and Effect.fnUntraced callback parameters when no outer contextual function type exists",
|
|
5942
|
+
group: "correctness",
|
|
5943
|
+
severity: "error",
|
|
5944
|
+
fixable: false,
|
|
5945
|
+
supportedEffect: ["v3", "v4"],
|
|
5946
|
+
apply: fn("effectFnImplicitAny.apply")(function* (sourceFile, report) {
|
|
5947
|
+
const ts = yield* service(TypeScriptApi);
|
|
5948
|
+
const program = yield* service(TypeScriptProgram);
|
|
5949
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
5950
|
+
const typeParser = yield* service(TypeParser);
|
|
5951
|
+
const noImplicitAny = program.getCompilerOptions().noImplicitAny ?? program.getCompilerOptions().strict ?? false;
|
|
5952
|
+
if (!noImplicitAny) {
|
|
5953
|
+
return;
|
|
5954
|
+
}
|
|
5955
|
+
const nodeToVisit = [sourceFile];
|
|
5956
|
+
const appendNodeToVisit = (node) => {
|
|
5957
|
+
nodeToVisit.push(node);
|
|
5958
|
+
return void 0;
|
|
5959
|
+
};
|
|
5960
|
+
while (nodeToVisit.length > 0) {
|
|
5961
|
+
const node = nodeToVisit.pop();
|
|
5962
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
5963
|
+
const parsed = yield* pipe(
|
|
5964
|
+
typeParser.effectFn(node),
|
|
5965
|
+
map4((result) => ({
|
|
5966
|
+
call: result.node,
|
|
5967
|
+
fn: result.regularFunction
|
|
5968
|
+
})),
|
|
5969
|
+
orElse2(
|
|
5970
|
+
() => pipe(
|
|
5971
|
+
typeParser.effectFnGen(node),
|
|
5972
|
+
map4((result) => ({
|
|
5973
|
+
call: result.node,
|
|
5974
|
+
fn: result.generatorFunction
|
|
5975
|
+
}))
|
|
5976
|
+
)
|
|
5977
|
+
),
|
|
5978
|
+
orElse2(
|
|
5979
|
+
() => pipe(
|
|
5980
|
+
typeParser.effectFnUntracedGen(node),
|
|
5981
|
+
map4((result) => ({
|
|
5982
|
+
call: result.node,
|
|
5983
|
+
fn: result.generatorFunction
|
|
5984
|
+
}))
|
|
5985
|
+
)
|
|
5986
|
+
),
|
|
5987
|
+
orUndefined
|
|
5988
|
+
);
|
|
5989
|
+
if (!parsed || hasOuterContextualFunctionType(ts, typeChecker, parsed.call)) {
|
|
5990
|
+
continue;
|
|
5991
|
+
}
|
|
5992
|
+
for (const parameter of parsed.fn.parameters) {
|
|
5993
|
+
if (parameter.type || parameter.initializer) {
|
|
5994
|
+
continue;
|
|
5995
|
+
}
|
|
5996
|
+
const parameterName = getParameterName(ts, parameter.name);
|
|
5997
|
+
report({
|
|
5998
|
+
location: parameter.name,
|
|
5999
|
+
messageText: `Parameter '${parameterName}' implicitly has an 'any' type in Effect.fn/Effect.fnUntraced. Add an explicit type annotation or provide a contextual function type.`,
|
|
6000
|
+
fixes: []
|
|
6001
|
+
});
|
|
6002
|
+
}
|
|
6003
|
+
}
|
|
6004
|
+
})
|
|
6005
|
+
});
|
|
6006
|
+
|
|
5916
6007
|
// src/diagnostics/effectFnOpportunity.ts
|
|
5917
6008
|
var effectFnOpportunity = createDiagnostic({
|
|
5918
6009
|
name: "effectFnOpportunity",
|
|
5919
6010
|
code: 41,
|
|
5920
6011
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
6012
|
+
group: "style",
|
|
5921
6013
|
severity: "suggestion",
|
|
5922
6014
|
fixable: true,
|
|
5923
6015
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6512,6 +6604,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
6512
6604
|
name: "effectGenUsesAdapter",
|
|
6513
6605
|
code: 23,
|
|
6514
6606
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
6607
|
+
group: "antipattern",
|
|
6515
6608
|
severity: "warning",
|
|
6516
6609
|
fixable: false,
|
|
6517
6610
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6552,6 +6645,7 @@ var effectInFailure = createDiagnostic({
|
|
|
6552
6645
|
name: "effectInFailure",
|
|
6553
6646
|
code: 49,
|
|
6554
6647
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
6648
|
+
group: "antipattern",
|
|
6555
6649
|
severity: "warning",
|
|
6556
6650
|
fixable: false,
|
|
6557
6651
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6618,6 +6712,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
6618
6712
|
name: "effectInVoidSuccess",
|
|
6619
6713
|
code: 14,
|
|
6620
6714
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
6715
|
+
group: "antipattern",
|
|
6621
6716
|
severity: "warning",
|
|
6622
6717
|
fixable: false,
|
|
6623
6718
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6669,6 +6764,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
6669
6764
|
name: "effectMapVoid",
|
|
6670
6765
|
code: 40,
|
|
6671
6766
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
6767
|
+
group: "style",
|
|
6672
6768
|
severity: "suggestion",
|
|
6673
6769
|
fixable: true,
|
|
6674
6770
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6735,6 +6831,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
6735
6831
|
name: "effectSucceedWithVoid",
|
|
6736
6832
|
code: 47,
|
|
6737
6833
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
6834
|
+
group: "style",
|
|
6738
6835
|
severity: "suggestion",
|
|
6739
6836
|
fixable: true,
|
|
6740
6837
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6788,6 +6885,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
6788
6885
|
name: "extendsNativeError",
|
|
6789
6886
|
code: 50,
|
|
6790
6887
|
description: "Warns when a class directly extends the native Error class",
|
|
6888
|
+
group: "effectNative",
|
|
6791
6889
|
severity: "off",
|
|
6792
6890
|
fixable: false,
|
|
6793
6891
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6840,6 +6938,7 @@ var floatingEffect = createDiagnostic({
|
|
|
6840
6938
|
name: "floatingEffect",
|
|
6841
6939
|
code: 3,
|
|
6842
6940
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
6941
|
+
group: "correctness",
|
|
6843
6942
|
severity: "error",
|
|
6844
6943
|
fixable: false,
|
|
6845
6944
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6893,6 +6992,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
6893
6992
|
name: "genericEffectServices",
|
|
6894
6993
|
code: 10,
|
|
6895
6994
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
6995
|
+
group: "correctness",
|
|
6896
6996
|
severity: "warning",
|
|
6897
6997
|
fixable: false,
|
|
6898
6998
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6942,6 +7042,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
6942
7042
|
name: "globalErrorInEffectCatch",
|
|
6943
7043
|
code: 36,
|
|
6944
7044
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
7045
|
+
group: "antipattern",
|
|
6945
7046
|
severity: "warning",
|
|
6946
7047
|
fixable: false,
|
|
6947
7048
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7004,6 +7105,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
7004
7105
|
name: "globalErrorInEffectFailure",
|
|
7005
7106
|
code: 35,
|
|
7006
7107
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
7108
|
+
group: "antipattern",
|
|
7007
7109
|
severity: "warning",
|
|
7008
7110
|
fixable: false,
|
|
7009
7111
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7054,11 +7156,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
7054
7156
|
})
|
|
7055
7157
|
});
|
|
7056
7158
|
|
|
7159
|
+
// src/diagnostics/globalFetch.ts
|
|
7160
|
+
var globalFetch = createDiagnostic({
|
|
7161
|
+
name: "globalFetch",
|
|
7162
|
+
code: 53,
|
|
7163
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
7164
|
+
group: "effectNative",
|
|
7165
|
+
severity: "off",
|
|
7166
|
+
fixable: false,
|
|
7167
|
+
supportedEffect: ["v3", "v4"],
|
|
7168
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
7169
|
+
const ts = yield* service(TypeScriptApi);
|
|
7170
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
7171
|
+
const typeParser = yield* service(TypeParser);
|
|
7172
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
7173
|
+
if (!fetchSymbol) return;
|
|
7174
|
+
const effectVersion = typeParser.supportedEffect();
|
|
7175
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
7176
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
7177
|
+
const nodeToVisit = [];
|
|
7178
|
+
const appendNodeToVisit = (node) => {
|
|
7179
|
+
nodeToVisit.push(node);
|
|
7180
|
+
return void 0;
|
|
7181
|
+
};
|
|
7182
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
7183
|
+
while (nodeToVisit.length > 0) {
|
|
7184
|
+
const node = nodeToVisit.shift();
|
|
7185
|
+
if (ts.isCallExpression(node)) {
|
|
7186
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
7187
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
7188
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
7189
|
+
report({
|
|
7190
|
+
location: node.expression,
|
|
7191
|
+
messageText,
|
|
7192
|
+
fixes: []
|
|
7193
|
+
});
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
7197
|
+
}
|
|
7198
|
+
})
|
|
7199
|
+
});
|
|
7200
|
+
|
|
7057
7201
|
// src/diagnostics/importFromBarrel.ts
|
|
7058
7202
|
var importFromBarrel = createDiagnostic({
|
|
7059
7203
|
name: "importFromBarrel",
|
|
7060
7204
|
code: 12,
|
|
7061
7205
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
7206
|
+
group: "style",
|
|
7062
7207
|
severity: "off",
|
|
7063
7208
|
fixable: true,
|
|
7064
7209
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7201,6 +7346,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
7201
7346
|
name: "instanceOfSchema",
|
|
7202
7347
|
code: 45,
|
|
7203
7348
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
7349
|
+
group: "effectNative",
|
|
7204
7350
|
severity: "off",
|
|
7205
7351
|
fixable: true,
|
|
7206
7352
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7266,6 +7412,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
7266
7412
|
name: "layerMergeAllWithDependencies",
|
|
7267
7413
|
code: 37,
|
|
7268
7414
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
7415
|
+
group: "antipattern",
|
|
7269
7416
|
severity: "warning",
|
|
7270
7417
|
fixable: true,
|
|
7271
7418
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7381,6 +7528,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
7381
7528
|
name: "leakingRequirements",
|
|
7382
7529
|
code: 8,
|
|
7383
7530
|
description: "Detects implementation services leaked in service methods",
|
|
7531
|
+
group: "antipattern",
|
|
7384
7532
|
severity: "suggestion",
|
|
7385
7533
|
fixable: false,
|
|
7386
7534
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7390,6 +7538,24 @@ var leakingRequirements = createDiagnostic({
|
|
|
7390
7538
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
7391
7539
|
const typeParser = yield* service(TypeParser);
|
|
7392
7540
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
7541
|
+
const isExpectedLeakingServiceSuppressed = (leakedServiceName, startNode) => {
|
|
7542
|
+
const sourceFile2 = tsUtils.getSourceFileOfNode(startNode);
|
|
7543
|
+
if (!sourceFile2) return false;
|
|
7544
|
+
return !!ts.findAncestor(startNode, (current) => {
|
|
7545
|
+
const ranges = ts.getLeadingCommentRanges(sourceFile2.text, current.pos) ?? [];
|
|
7546
|
+
const isSuppressed = ranges.some((range) => {
|
|
7547
|
+
const commentText = sourceFile2.text.slice(range.pos, range.end);
|
|
7548
|
+
return commentText.split("\n").filter((line) => line.includes("@effect-expect-leaking")).some((line) => {
|
|
7549
|
+
const markerIndex = line.indexOf("@effect-expect-leaking");
|
|
7550
|
+
return markerIndex !== -1 && line.slice(markerIndex + "@effect-expect-leaking".length).includes(leakedServiceName);
|
|
7551
|
+
});
|
|
7552
|
+
});
|
|
7553
|
+
if (isSuppressed) {
|
|
7554
|
+
return true;
|
|
7555
|
+
}
|
|
7556
|
+
return ts.isClassDeclaration(current) || ts.isVariableStatement(current) || ts.isExpressionStatement(current) || ts.isStatement(current) ? "quit" : false;
|
|
7557
|
+
});
|
|
7558
|
+
};
|
|
7393
7559
|
const parseLeakedRequirements = cachedBy(
|
|
7394
7560
|
fn("leakingServices.checkServiceLeaking")(
|
|
7395
7561
|
function* (service2, atLocation) {
|
|
@@ -7471,8 +7637,12 @@ var leakingRequirements = createDiagnostic({
|
|
|
7471
7637
|
(_, service2) => service2
|
|
7472
7638
|
);
|
|
7473
7639
|
function reportLeakingRequirements(node, requirements) {
|
|
7474
|
-
|
|
7475
|
-
|
|
7640
|
+
const filteredRequirements = requirements.filter(
|
|
7641
|
+
(requirement) => !isExpectedLeakingServiceSuppressed(typeChecker.typeToString(requirement), node)
|
|
7642
|
+
);
|
|
7643
|
+
if (filteredRequirements.length === 0) return;
|
|
7644
|
+
const requirementsStr = filteredRequirements.map((_) => typeChecker.typeToString(_)).join(" | ");
|
|
7645
|
+
const firstStr = typeChecker.typeToString(filteredRequirements[0]);
|
|
7476
7646
|
report({
|
|
7477
7647
|
location: node,
|
|
7478
7648
|
messageText: `Methods of this Service require \`${requirementsStr}\` from every caller.
|
|
@@ -7481,7 +7651,7 @@ This leaks implementation details into the service's public type \u2014 callers
|
|
|
7481
7651
|
|
|
7482
7652
|
Resolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.
|
|
7483
7653
|
|
|
7484
|
-
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 \`${
|
|
7654
|
+
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.
|
|
7485
7655
|
|
|
7486
7656
|
More info and examples at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage`,
|
|
7487
7657
|
fixes: []
|
|
@@ -7537,6 +7707,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
7537
7707
|
name: "missedPipeableOpportunity",
|
|
7538
7708
|
code: 26,
|
|
7539
7709
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
7710
|
+
group: "style",
|
|
7540
7711
|
severity: "off",
|
|
7541
7712
|
fixable: true,
|
|
7542
7713
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7719,6 +7890,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
7719
7890
|
name: "missingEffectContext",
|
|
7720
7891
|
code: 1,
|
|
7721
7892
|
description: "Reports missing service requirements in Effect context channel",
|
|
7893
|
+
group: "correctness",
|
|
7722
7894
|
severity: "error",
|
|
7723
7895
|
fixable: false,
|
|
7724
7896
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7770,6 +7942,7 @@ var missingEffectError = createDiagnostic({
|
|
|
7770
7942
|
name: "missingEffectError",
|
|
7771
7943
|
code: 1,
|
|
7772
7944
|
description: "Reports missing error types in Effect error channel",
|
|
7945
|
+
group: "correctness",
|
|
7773
7946
|
severity: "error",
|
|
7774
7947
|
fixable: true,
|
|
7775
7948
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7913,6 +8086,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
7913
8086
|
name: "missingEffectServiceDependency",
|
|
7914
8087
|
code: 22,
|
|
7915
8088
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
8089
|
+
group: "style",
|
|
7916
8090
|
severity: "off",
|
|
7917
8091
|
fixable: false,
|
|
7918
8092
|
supportedEffect: ["v3"],
|
|
@@ -8009,6 +8183,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
8009
8183
|
name: "missingLayerContext",
|
|
8010
8184
|
code: 38,
|
|
8011
8185
|
description: "Reports missing service requirements in Layer context channel",
|
|
8186
|
+
group: "correctness",
|
|
8012
8187
|
severity: "error",
|
|
8013
8188
|
fixable: false,
|
|
8014
8189
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8060,6 +8235,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
8060
8235
|
name: "missingReturnYieldStar",
|
|
8061
8236
|
code: 7,
|
|
8062
8237
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
8238
|
+
group: "correctness",
|
|
8063
8239
|
severity: "error",
|
|
8064
8240
|
fixable: true,
|
|
8065
8241
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8112,6 +8288,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
8112
8288
|
name: "missingStarInYieldEffectGen",
|
|
8113
8289
|
code: 4,
|
|
8114
8290
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
8291
|
+
group: "correctness",
|
|
8115
8292
|
severity: "error",
|
|
8116
8293
|
fixable: true,
|
|
8117
8294
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8189,6 +8366,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
8189
8366
|
name: "multipleEffectProvide",
|
|
8190
8367
|
code: 18,
|
|
8191
8368
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
8369
|
+
group: "antipattern",
|
|
8192
8370
|
severity: "warning",
|
|
8193
8371
|
fixable: true,
|
|
8194
8372
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8291,7 +8469,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
8291
8469
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8292
8470
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8293
8471
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8294
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
8472
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8473
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8474
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8475
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
8476
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
8295
8477
|
]);
|
|
8296
8478
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
8297
8479
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -8305,12 +8487,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
8305
8487
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8306
8488
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8307
8489
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8308
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
8490
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8491
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8492
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8493
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
8494
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
8309
8495
|
]);
|
|
8310
8496
|
var nodeBuiltinImport = createDiagnostic({
|
|
8311
8497
|
name: "nodeBuiltinImport",
|
|
8312
8498
|
code: 52,
|
|
8313
8499
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
8500
|
+
group: "effectNative",
|
|
8314
8501
|
severity: "off",
|
|
8315
8502
|
fixable: false,
|
|
8316
8503
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8354,6 +8541,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
8354
8541
|
name: "nonObjectEffectServiceType",
|
|
8355
8542
|
code: 24,
|
|
8356
8543
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
8544
|
+
group: "correctness",
|
|
8357
8545
|
severity: "error",
|
|
8358
8546
|
fixable: false,
|
|
8359
8547
|
supportedEffect: ["v3"],
|
|
@@ -9138,6 +9326,7 @@ var outdatedApi = createDiagnostic({
|
|
|
9138
9326
|
name: "outdatedApi",
|
|
9139
9327
|
code: 48,
|
|
9140
9328
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
9329
|
+
group: "correctness",
|
|
9141
9330
|
severity: "warning",
|
|
9142
9331
|
fixable: false,
|
|
9143
9332
|
supportedEffect: ["v4"],
|
|
@@ -10276,6 +10465,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
10276
10465
|
name: "outdatedEffectCodegen",
|
|
10277
10466
|
code: 19,
|
|
10278
10467
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
10468
|
+
group: "correctness",
|
|
10279
10469
|
severity: "warning",
|
|
10280
10470
|
fixable: true,
|
|
10281
10471
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10324,6 +10514,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
10324
10514
|
name: "overriddenSchemaConstructor",
|
|
10325
10515
|
code: 30,
|
|
10326
10516
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
10517
|
+
group: "correctness",
|
|
10327
10518
|
severity: "error",
|
|
10328
10519
|
fixable: true,
|
|
10329
10520
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10463,6 +10654,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
10463
10654
|
name: "preferSchemaOverJson",
|
|
10464
10655
|
code: 44,
|
|
10465
10656
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
10657
|
+
group: "effectNative",
|
|
10466
10658
|
severity: "suggestion",
|
|
10467
10659
|
fixable: false,
|
|
10468
10660
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10575,6 +10767,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
10575
10767
|
name: "redundantSchemaTagIdentifier",
|
|
10576
10768
|
code: 42,
|
|
10577
10769
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
10770
|
+
group: "style",
|
|
10578
10771
|
severity: "suggestion",
|
|
10579
10772
|
fixable: true,
|
|
10580
10773
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10627,6 +10820,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
10627
10820
|
name: "returnEffectInGen",
|
|
10628
10821
|
code: 11,
|
|
10629
10822
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
10823
|
+
group: "antipattern",
|
|
10630
10824
|
severity: "suggestion",
|
|
10631
10825
|
fixable: true,
|
|
10632
10826
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10698,6 +10892,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
10698
10892
|
name: "runEffectInsideEffect",
|
|
10699
10893
|
code: 32,
|
|
10700
10894
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
10895
|
+
group: "antipattern",
|
|
10701
10896
|
severity: "suggestion",
|
|
10702
10897
|
fixable: true,
|
|
10703
10898
|
supportedEffect: ["v3"],
|
|
@@ -10824,6 +11019,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
10824
11019
|
name: "schemaStructWithTag",
|
|
10825
11020
|
code: 34,
|
|
10826
11021
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
11022
|
+
group: "style",
|
|
10827
11023
|
severity: "suggestion",
|
|
10828
11024
|
fixable: true,
|
|
10829
11025
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10918,9 +11114,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
10918
11114
|
name: "schemaSyncInEffect",
|
|
10919
11115
|
code: 43,
|
|
10920
11116
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11117
|
+
group: "antipattern",
|
|
10921
11118
|
severity: "suggestion",
|
|
10922
11119
|
fixable: false,
|
|
10923
|
-
supportedEffect: ["v3"
|
|
11120
|
+
supportedEffect: ["v3"],
|
|
10924
11121
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
10925
11122
|
const ts = yield* service(TypeScriptApi);
|
|
10926
11123
|
const typeParser = yield* service(TypeParser);
|
|
@@ -10969,6 +11166,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
10969
11166
|
name: "schemaUnionOfLiterals",
|
|
10970
11167
|
code: 33,
|
|
10971
11168
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11169
|
+
group: "style",
|
|
10972
11170
|
severity: "off",
|
|
10973
11171
|
fixable: true,
|
|
10974
11172
|
supportedEffect: ["v3"],
|
|
@@ -11046,6 +11244,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
11046
11244
|
name: "scopeInLayerEffect",
|
|
11047
11245
|
code: 13,
|
|
11048
11246
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11247
|
+
group: "antipattern",
|
|
11049
11248
|
severity: "warning",
|
|
11050
11249
|
fixable: true,
|
|
11051
11250
|
supportedEffect: ["v3"],
|
|
@@ -11143,6 +11342,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11143
11342
|
name: "serviceNotAsClass",
|
|
11144
11343
|
code: 51,
|
|
11145
11344
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
11345
|
+
group: "style",
|
|
11146
11346
|
severity: "off",
|
|
11147
11347
|
fixable: true,
|
|
11148
11348
|
supportedEffect: ["v4"],
|
|
@@ -11220,6 +11420,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11220
11420
|
name: "strictBooleanExpressions",
|
|
11221
11421
|
code: 17,
|
|
11222
11422
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
11423
|
+
group: "style",
|
|
11223
11424
|
severity: "off",
|
|
11224
11425
|
fixable: false,
|
|
11225
11426
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11293,6 +11494,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
11293
11494
|
name: "strictEffectProvide",
|
|
11294
11495
|
code: 27,
|
|
11295
11496
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
11497
|
+
group: "antipattern",
|
|
11296
11498
|
severity: "off",
|
|
11297
11499
|
fixable: false,
|
|
11298
11500
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11346,6 +11548,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
11346
11548
|
name: "tryCatchInEffectGen",
|
|
11347
11549
|
code: 15,
|
|
11348
11550
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
11551
|
+
group: "antipattern",
|
|
11349
11552
|
severity: "suggestion",
|
|
11350
11553
|
fixable: false,
|
|
11351
11554
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11405,6 +11608,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
11405
11608
|
name: "unknownInEffectCatch",
|
|
11406
11609
|
code: 31,
|
|
11407
11610
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
11611
|
+
group: "antipattern",
|
|
11408
11612
|
severity: "warning",
|
|
11409
11613
|
fixable: false,
|
|
11410
11614
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11468,6 +11672,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
11468
11672
|
name: "unnecessaryEffectGen",
|
|
11469
11673
|
code: 5,
|
|
11470
11674
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
11675
|
+
group: "style",
|
|
11471
11676
|
severity: "suggestion",
|
|
11472
11677
|
fixable: true,
|
|
11473
11678
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11514,6 +11719,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
11514
11719
|
name: "unnecessaryFailYieldableError",
|
|
11515
11720
|
code: 29,
|
|
11516
11721
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
11722
|
+
group: "style",
|
|
11517
11723
|
severity: "suggestion",
|
|
11518
11724
|
fixable: true,
|
|
11519
11725
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11575,6 +11781,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
11575
11781
|
name: "unnecessaryPipe",
|
|
11576
11782
|
code: 9,
|
|
11577
11783
|
description: "Removes pipe calls with no arguments",
|
|
11784
|
+
group: "style",
|
|
11578
11785
|
severity: "suggestion",
|
|
11579
11786
|
fixable: true,
|
|
11580
11787
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11623,6 +11830,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
11623
11830
|
name: "unnecessaryPipeChain",
|
|
11624
11831
|
code: 16,
|
|
11625
11832
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
11833
|
+
group: "style",
|
|
11626
11834
|
severity: "suggestion",
|
|
11627
11835
|
fixable: true,
|
|
11628
11836
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11700,6 +11908,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
11700
11908
|
name: "unsupportedServiceAccessors",
|
|
11701
11909
|
code: 21,
|
|
11702
11910
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
11911
|
+
group: "correctness",
|
|
11703
11912
|
severity: "warning",
|
|
11704
11913
|
fixable: true,
|
|
11705
11914
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11763,6 +11972,7 @@ var diagnostics = [
|
|
|
11763
11972
|
catchUnfailableEffect,
|
|
11764
11973
|
classSelfMismatch,
|
|
11765
11974
|
duplicatePackage,
|
|
11975
|
+
effectFnImplicitAny,
|
|
11766
11976
|
effectGenUsesAdapter,
|
|
11767
11977
|
missingEffectContext,
|
|
11768
11978
|
missingEffectError,
|
|
@@ -11777,6 +11987,7 @@ var diagnostics = [
|
|
|
11777
11987
|
leakingRequirements,
|
|
11778
11988
|
unnecessaryPipe,
|
|
11779
11989
|
genericEffectServices,
|
|
11990
|
+
globalFetch,
|
|
11780
11991
|
returnEffectInGen,
|
|
11781
11992
|
tryCatchInEffectGen,
|
|
11782
11993
|
importFromBarrel,
|