@effect/language-service 0.79.0 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -57
- package/cli.js +2022 -274
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +246 -3
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +246 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +246 -3
- package/transform.js.map +1 -1
|
@@ -1644,6 +1644,145 @@ var defaults = {
|
|
|
1644
1644
|
mermaidProvider: "mermaid.live",
|
|
1645
1645
|
skipDisabledOptimization: false
|
|
1646
1646
|
};
|
|
1647
|
+
var booleanSchema = (description, defaultValue) => ({
|
|
1648
|
+
type: "boolean",
|
|
1649
|
+
description,
|
|
1650
|
+
default: defaultValue
|
|
1651
|
+
});
|
|
1652
|
+
var stringArraySchema = (description, defaultValue) => ({
|
|
1653
|
+
type: "array",
|
|
1654
|
+
description,
|
|
1655
|
+
default: defaultValue,
|
|
1656
|
+
items: { type: "string" }
|
|
1657
|
+
});
|
|
1658
|
+
var stringEnumSchema = (description, values, defaultValue) => ({
|
|
1659
|
+
type: "string",
|
|
1660
|
+
description,
|
|
1661
|
+
enum: values,
|
|
1662
|
+
default: defaultValue
|
|
1663
|
+
});
|
|
1664
|
+
var languageServicePluginAdditionalPropertiesJsonSchema = {
|
|
1665
|
+
refactors: booleanSchema("Controls Effect refactors.", defaults.refactors),
|
|
1666
|
+
diagnostics: booleanSchema("Controls Effect diagnostics.", defaults.diagnostics),
|
|
1667
|
+
diagnosticsName: booleanSchema(
|
|
1668
|
+
"Controls whether to include the rule name in diagnostic messages.",
|
|
1669
|
+
defaults.diagnosticsName
|
|
1670
|
+
),
|
|
1671
|
+
missingDiagnosticNextLine: stringEnumSchema(
|
|
1672
|
+
"Controls the severity of warnings for unused @effect-diagnostics-next-line comments.",
|
|
1673
|
+
["off", "error", "warning", "message", "suggestion"],
|
|
1674
|
+
defaults.missingDiagnosticNextLine
|
|
1675
|
+
),
|
|
1676
|
+
includeSuggestionsInTsc: booleanSchema(
|
|
1677
|
+
"When patch mode is enabled, reports suggestion diagnostics as messages in TSC with a [suggestion] prefix.",
|
|
1678
|
+
defaults.includeSuggestionsInTsc
|
|
1679
|
+
),
|
|
1680
|
+
ignoreEffectWarningsInTscExitCode: booleanSchema(
|
|
1681
|
+
"When enabled, Effect warnings do not affect the patched tsc exit code.",
|
|
1682
|
+
defaults.ignoreEffectWarningsInTscExitCode
|
|
1683
|
+
),
|
|
1684
|
+
ignoreEffectErrorsInTscExitCode: booleanSchema(
|
|
1685
|
+
"When enabled, Effect errors do not affect the patched tsc exit code.",
|
|
1686
|
+
defaults.ignoreEffectErrorsInTscExitCode
|
|
1687
|
+
),
|
|
1688
|
+
ignoreEffectSuggestionsInTscExitCode: booleanSchema(
|
|
1689
|
+
"When enabled, Effect suggestions do not affect the patched tsc exit code.",
|
|
1690
|
+
defaults.ignoreEffectSuggestionsInTscExitCode
|
|
1691
|
+
),
|
|
1692
|
+
quickinfoEffectParameters: stringEnumSchema(
|
|
1693
|
+
"Controls when Effect quickinfo should include full type parameters.",
|
|
1694
|
+
["always", "never", "whentruncated"],
|
|
1695
|
+
defaults.quickinfoEffectParameters
|
|
1696
|
+
),
|
|
1697
|
+
quickinfo: booleanSchema("Controls Effect quickinfo.", defaults.quickinfo),
|
|
1698
|
+
quickinfoMaximumLength: {
|
|
1699
|
+
type: "number",
|
|
1700
|
+
description: "Controls the maximum quickinfo length. Use -1 to disable truncation.",
|
|
1701
|
+
default: defaults.quickinfoMaximumLength
|
|
1702
|
+
},
|
|
1703
|
+
keyPatterns: {
|
|
1704
|
+
type: "array",
|
|
1705
|
+
description: "Configures key patterns used for generated Effect service and error keys.",
|
|
1706
|
+
default: defaults.keyPatterns,
|
|
1707
|
+
items: {
|
|
1708
|
+
type: "object",
|
|
1709
|
+
properties: {
|
|
1710
|
+
target: stringEnumSchema("The key builder target.", ["service", "error", "custom"], "service"),
|
|
1711
|
+
pattern: stringEnumSchema(
|
|
1712
|
+
"The key generation pattern.",
|
|
1713
|
+
["package-identifier", "default", "default-hashed"],
|
|
1714
|
+
"default"
|
|
1715
|
+
),
|
|
1716
|
+
skipLeadingPath: stringArraySchema("Path prefixes to strip before generating keys.", ["src/"])
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
},
|
|
1720
|
+
extendedKeyDetection: booleanSchema(
|
|
1721
|
+
"Enables extended heuristics when detecting key sources.",
|
|
1722
|
+
defaults.extendedKeyDetection
|
|
1723
|
+
),
|
|
1724
|
+
completions: booleanSchema("Controls Effect completions.", defaults.completions),
|
|
1725
|
+
goto: booleanSchema("Controls Effect goto references support.", defaults.goto),
|
|
1726
|
+
inlays: booleanSchema("Controls Effect inlay hints.", defaults.inlays),
|
|
1727
|
+
allowedDuplicatedPackages: stringArraySchema(
|
|
1728
|
+
"Package names that are allowed to duplicate Effect as a peer dependency.",
|
|
1729
|
+
defaults.allowedDuplicatedPackages
|
|
1730
|
+
),
|
|
1731
|
+
namespaceImportPackages: stringArraySchema(
|
|
1732
|
+
"Package names that should prefer namespace imports.",
|
|
1733
|
+
defaults.namespaceImportPackages
|
|
1734
|
+
),
|
|
1735
|
+
topLevelNamedReexports: stringEnumSchema(
|
|
1736
|
+
"For namespaceImportPackages, controls how top-level named re-exports are handled.",
|
|
1737
|
+
["ignore", "follow"],
|
|
1738
|
+
defaults.topLevelNamedReexports
|
|
1739
|
+
),
|
|
1740
|
+
barrelImportPackages: stringArraySchema(
|
|
1741
|
+
"Package names that should prefer imports from their top-level barrel file.",
|
|
1742
|
+
defaults.barrelImportPackages
|
|
1743
|
+
),
|
|
1744
|
+
importAliases: {
|
|
1745
|
+
type: "object",
|
|
1746
|
+
description: "Custom aliases to use for imported identifiers.",
|
|
1747
|
+
default: defaults.importAliases,
|
|
1748
|
+
additionalProperties: {
|
|
1749
|
+
type: "string"
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
renames: booleanSchema("Controls Effect rename helpers.", defaults.renames),
|
|
1753
|
+
noExternal: booleanSchema(
|
|
1754
|
+
"Disables features that link to external websites.",
|
|
1755
|
+
defaults.noExternal
|
|
1756
|
+
),
|
|
1757
|
+
pipeableMinArgCount: {
|
|
1758
|
+
type: "number",
|
|
1759
|
+
description: "Minimum argument count required before pipeable suggestions are emitted.",
|
|
1760
|
+
default: defaults.pipeableMinArgCount
|
|
1761
|
+
},
|
|
1762
|
+
effectFn: {
|
|
1763
|
+
type: "array",
|
|
1764
|
+
description: "Configures which Effect.fn variants should be suggested.",
|
|
1765
|
+
default: defaults.effectFn,
|
|
1766
|
+
items: {
|
|
1767
|
+
type: "string",
|
|
1768
|
+
enum: ["untraced", "span", "suggested-span", "inferred-span", "no-span"]
|
|
1769
|
+
}
|
|
1770
|
+
},
|
|
1771
|
+
layerGraphFollowDepth: {
|
|
1772
|
+
type: "number",
|
|
1773
|
+
description: "Controls how deeply layer graph analysis follows dependencies.",
|
|
1774
|
+
default: defaults.layerGraphFollowDepth
|
|
1775
|
+
},
|
|
1776
|
+
mermaidProvider: {
|
|
1777
|
+
type: "string",
|
|
1778
|
+
description: "Controls which Mermaid renderer is used for layer graphs.",
|
|
1779
|
+
default: defaults.mermaidProvider
|
|
1780
|
+
},
|
|
1781
|
+
skipDisabledOptimization: booleanSchema(
|
|
1782
|
+
"When enabled, disabled diagnostics are still processed so comment-based overrides can be honored.",
|
|
1783
|
+
defaults.skipDisabledOptimization
|
|
1784
|
+
)
|
|
1785
|
+
};
|
|
1647
1786
|
function parseKeyPatterns(patterns) {
|
|
1648
1787
|
const result = [];
|
|
1649
1788
|
for (const entry of patterns) {
|
|
@@ -5134,6 +5273,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
5134
5273
|
name: "anyUnknownInErrorContext",
|
|
5135
5274
|
code: 28,
|
|
5136
5275
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
5276
|
+
group: "correctness",
|
|
5137
5277
|
severity: "off",
|
|
5138
5278
|
fixable: false,
|
|
5139
5279
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5239,6 +5379,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
5239
5379
|
name: "catchAllToMapError",
|
|
5240
5380
|
code: 39,
|
|
5241
5381
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
5382
|
+
group: "style",
|
|
5242
5383
|
severity: "suggestion",
|
|
5243
5384
|
fixable: true,
|
|
5244
5385
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5338,6 +5479,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
5338
5479
|
name: "catchUnfailableEffect",
|
|
5339
5480
|
code: 2,
|
|
5340
5481
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
5482
|
+
group: "antipattern",
|
|
5341
5483
|
severity: "suggestion",
|
|
5342
5484
|
fixable: false,
|
|
5343
5485
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5389,6 +5531,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5389
5531
|
name: "classSelfMismatch",
|
|
5390
5532
|
code: 20,
|
|
5391
5533
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
5534
|
+
group: "correctness",
|
|
5392
5535
|
severity: "error",
|
|
5393
5536
|
fixable: true,
|
|
5394
5537
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5529,6 +5672,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5529
5672
|
name: "deterministicKeys",
|
|
5530
5673
|
code: 25,
|
|
5531
5674
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
5675
|
+
group: "style",
|
|
5532
5676
|
severity: "off",
|
|
5533
5677
|
fixable: true,
|
|
5534
5678
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5648,6 +5792,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
5648
5792
|
name: "duplicatePackage",
|
|
5649
5793
|
code: 6,
|
|
5650
5794
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
5795
|
+
group: "correctness",
|
|
5651
5796
|
severity: "warning",
|
|
5652
5797
|
fixable: false,
|
|
5653
5798
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5679,6 +5824,7 @@ var effectFnIife = createDiagnostic({
|
|
|
5679
5824
|
name: "effectFnIife",
|
|
5680
5825
|
code: 46,
|
|
5681
5826
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
5827
|
+
group: "antipattern",
|
|
5682
5828
|
severity: "warning",
|
|
5683
5829
|
fixable: true,
|
|
5684
5830
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5783,6 +5929,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5783
5929
|
name: "effectFnOpportunity",
|
|
5784
5930
|
code: 41,
|
|
5785
5931
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
5932
|
+
group: "style",
|
|
5786
5933
|
severity: "suggestion",
|
|
5787
5934
|
fixable: true,
|
|
5788
5935
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6377,6 +6524,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
6377
6524
|
name: "effectGenUsesAdapter",
|
|
6378
6525
|
code: 23,
|
|
6379
6526
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
6527
|
+
group: "antipattern",
|
|
6380
6528
|
severity: "warning",
|
|
6381
6529
|
fixable: false,
|
|
6382
6530
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6417,6 +6565,7 @@ var effectInFailure = createDiagnostic({
|
|
|
6417
6565
|
name: "effectInFailure",
|
|
6418
6566
|
code: 49,
|
|
6419
6567
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
6568
|
+
group: "antipattern",
|
|
6420
6569
|
severity: "warning",
|
|
6421
6570
|
fixable: false,
|
|
6422
6571
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6483,6 +6632,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
6483
6632
|
name: "effectInVoidSuccess",
|
|
6484
6633
|
code: 14,
|
|
6485
6634
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
6635
|
+
group: "antipattern",
|
|
6486
6636
|
severity: "warning",
|
|
6487
6637
|
fixable: false,
|
|
6488
6638
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6534,6 +6684,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
6534
6684
|
name: "effectMapVoid",
|
|
6535
6685
|
code: 40,
|
|
6536
6686
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
6687
|
+
group: "style",
|
|
6537
6688
|
severity: "suggestion",
|
|
6538
6689
|
fixable: true,
|
|
6539
6690
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6600,6 +6751,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
6600
6751
|
name: "effectSucceedWithVoid",
|
|
6601
6752
|
code: 47,
|
|
6602
6753
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
6754
|
+
group: "style",
|
|
6603
6755
|
severity: "suggestion",
|
|
6604
6756
|
fixable: true,
|
|
6605
6757
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6653,6 +6805,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
6653
6805
|
name: "extendsNativeError",
|
|
6654
6806
|
code: 50,
|
|
6655
6807
|
description: "Warns when a class directly extends the native Error class",
|
|
6808
|
+
group: "effectNative",
|
|
6656
6809
|
severity: "off",
|
|
6657
6810
|
fixable: false,
|
|
6658
6811
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6705,6 +6858,7 @@ var floatingEffect = createDiagnostic({
|
|
|
6705
6858
|
name: "floatingEffect",
|
|
6706
6859
|
code: 3,
|
|
6707
6860
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
6861
|
+
group: "correctness",
|
|
6708
6862
|
severity: "error",
|
|
6709
6863
|
fixable: false,
|
|
6710
6864
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6758,6 +6912,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
6758
6912
|
name: "genericEffectServices",
|
|
6759
6913
|
code: 10,
|
|
6760
6914
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
6915
|
+
group: "correctness",
|
|
6761
6916
|
severity: "warning",
|
|
6762
6917
|
fixable: false,
|
|
6763
6918
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6807,6 +6962,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
6807
6962
|
name: "globalErrorInEffectCatch",
|
|
6808
6963
|
code: 36,
|
|
6809
6964
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
6965
|
+
group: "antipattern",
|
|
6810
6966
|
severity: "warning",
|
|
6811
6967
|
fixable: false,
|
|
6812
6968
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6869,6 +7025,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
6869
7025
|
name: "globalErrorInEffectFailure",
|
|
6870
7026
|
code: 35,
|
|
6871
7027
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
7028
|
+
group: "antipattern",
|
|
6872
7029
|
severity: "warning",
|
|
6873
7030
|
fixable: false,
|
|
6874
7031
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6919,11 +7076,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
6919
7076
|
})
|
|
6920
7077
|
});
|
|
6921
7078
|
|
|
7079
|
+
// src/diagnostics/globalFetch.ts
|
|
7080
|
+
var globalFetch = createDiagnostic({
|
|
7081
|
+
name: "globalFetch",
|
|
7082
|
+
code: 53,
|
|
7083
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
7084
|
+
group: "effectNative",
|
|
7085
|
+
severity: "off",
|
|
7086
|
+
fixable: false,
|
|
7087
|
+
supportedEffect: ["v3", "v4"],
|
|
7088
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
7089
|
+
const ts = yield* service(TypeScriptApi);
|
|
7090
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
7091
|
+
const typeParser = yield* service(TypeParser);
|
|
7092
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
7093
|
+
if (!fetchSymbol) return;
|
|
7094
|
+
const effectVersion = typeParser.supportedEffect();
|
|
7095
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
7096
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
7097
|
+
const nodeToVisit = [];
|
|
7098
|
+
const appendNodeToVisit = (node) => {
|
|
7099
|
+
nodeToVisit.push(node);
|
|
7100
|
+
return void 0;
|
|
7101
|
+
};
|
|
7102
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
7103
|
+
while (nodeToVisit.length > 0) {
|
|
7104
|
+
const node = nodeToVisit.shift();
|
|
7105
|
+
if (ts.isCallExpression(node)) {
|
|
7106
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
7107
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
7108
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
7109
|
+
report({
|
|
7110
|
+
location: node.expression,
|
|
7111
|
+
messageText,
|
|
7112
|
+
fixes: []
|
|
7113
|
+
});
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
7117
|
+
}
|
|
7118
|
+
})
|
|
7119
|
+
});
|
|
7120
|
+
|
|
6922
7121
|
// src/diagnostics/importFromBarrel.ts
|
|
6923
7122
|
var importFromBarrel = createDiagnostic({
|
|
6924
7123
|
name: "importFromBarrel",
|
|
6925
7124
|
code: 12,
|
|
6926
7125
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
7126
|
+
group: "style",
|
|
6927
7127
|
severity: "off",
|
|
6928
7128
|
fixable: true,
|
|
6929
7129
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7066,6 +7266,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
7066
7266
|
name: "instanceOfSchema",
|
|
7067
7267
|
code: 45,
|
|
7068
7268
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
7269
|
+
group: "effectNative",
|
|
7069
7270
|
severity: "off",
|
|
7070
7271
|
fixable: true,
|
|
7071
7272
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7131,6 +7332,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
7131
7332
|
name: "layerMergeAllWithDependencies",
|
|
7132
7333
|
code: 37,
|
|
7133
7334
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
7335
|
+
group: "antipattern",
|
|
7134
7336
|
severity: "warning",
|
|
7135
7337
|
fixable: true,
|
|
7136
7338
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7246,6 +7448,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
7246
7448
|
name: "leakingRequirements",
|
|
7247
7449
|
code: 8,
|
|
7248
7450
|
description: "Detects implementation services leaked in service methods",
|
|
7451
|
+
group: "antipattern",
|
|
7249
7452
|
severity: "suggestion",
|
|
7250
7453
|
fixable: false,
|
|
7251
7454
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7402,6 +7605,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
7402
7605
|
name: "missedPipeableOpportunity",
|
|
7403
7606
|
code: 26,
|
|
7404
7607
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
7608
|
+
group: "style",
|
|
7405
7609
|
severity: "off",
|
|
7406
7610
|
fixable: true,
|
|
7407
7611
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7584,6 +7788,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
7584
7788
|
name: "missingEffectContext",
|
|
7585
7789
|
code: 1,
|
|
7586
7790
|
description: "Reports missing service requirements in Effect context channel",
|
|
7791
|
+
group: "correctness",
|
|
7587
7792
|
severity: "error",
|
|
7588
7793
|
fixable: false,
|
|
7589
7794
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7635,6 +7840,7 @@ var missingEffectError = createDiagnostic({
|
|
|
7635
7840
|
name: "missingEffectError",
|
|
7636
7841
|
code: 1,
|
|
7637
7842
|
description: "Reports missing error types in Effect error channel",
|
|
7843
|
+
group: "correctness",
|
|
7638
7844
|
severity: "error",
|
|
7639
7845
|
fixable: true,
|
|
7640
7846
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7778,6 +7984,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
7778
7984
|
name: "missingEffectServiceDependency",
|
|
7779
7985
|
code: 22,
|
|
7780
7986
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
7987
|
+
group: "style",
|
|
7781
7988
|
severity: "off",
|
|
7782
7989
|
fixable: false,
|
|
7783
7990
|
supportedEffect: ["v3"],
|
|
@@ -7874,6 +8081,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
7874
8081
|
name: "missingLayerContext",
|
|
7875
8082
|
code: 38,
|
|
7876
8083
|
description: "Reports missing service requirements in Layer context channel",
|
|
8084
|
+
group: "correctness",
|
|
7877
8085
|
severity: "error",
|
|
7878
8086
|
fixable: false,
|
|
7879
8087
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7925,6 +8133,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
7925
8133
|
name: "missingReturnYieldStar",
|
|
7926
8134
|
code: 7,
|
|
7927
8135
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
8136
|
+
group: "correctness",
|
|
7928
8137
|
severity: "error",
|
|
7929
8138
|
fixable: true,
|
|
7930
8139
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7977,6 +8186,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
7977
8186
|
name: "missingStarInYieldEffectGen",
|
|
7978
8187
|
code: 4,
|
|
7979
8188
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
8189
|
+
group: "correctness",
|
|
7980
8190
|
severity: "error",
|
|
7981
8191
|
fixable: true,
|
|
7982
8192
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8054,6 +8264,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
8054
8264
|
name: "multipleEffectProvide",
|
|
8055
8265
|
code: 18,
|
|
8056
8266
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
8267
|
+
group: "antipattern",
|
|
8057
8268
|
severity: "warning",
|
|
8058
8269
|
fixable: true,
|
|
8059
8270
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8156,7 +8367,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
8156
8367
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8157
8368
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8158
8369
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8159
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
8370
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8371
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8372
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8373
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
8374
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
8160
8375
|
]);
|
|
8161
8376
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
8162
8377
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -8170,12 +8385,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
8170
8385
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8171
8386
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8172
8387
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8173
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
8388
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8389
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8390
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8391
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
8392
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
8174
8393
|
]);
|
|
8175
8394
|
var nodeBuiltinImport = createDiagnostic({
|
|
8176
8395
|
name: "nodeBuiltinImport",
|
|
8177
8396
|
code: 52,
|
|
8178
8397
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
8398
|
+
group: "effectNative",
|
|
8179
8399
|
severity: "off",
|
|
8180
8400
|
fixable: false,
|
|
8181
8401
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8219,6 +8439,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
8219
8439
|
name: "nonObjectEffectServiceType",
|
|
8220
8440
|
code: 24,
|
|
8221
8441
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
8442
|
+
group: "correctness",
|
|
8222
8443
|
severity: "error",
|
|
8223
8444
|
fixable: false,
|
|
8224
8445
|
supportedEffect: ["v3"],
|
|
@@ -9003,6 +9224,7 @@ var outdatedApi = createDiagnostic({
|
|
|
9003
9224
|
name: "outdatedApi",
|
|
9004
9225
|
code: 48,
|
|
9005
9226
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
9227
|
+
group: "correctness",
|
|
9006
9228
|
severity: "warning",
|
|
9007
9229
|
fixable: false,
|
|
9008
9230
|
supportedEffect: ["v4"],
|
|
@@ -10141,6 +10363,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
10141
10363
|
name: "outdatedEffectCodegen",
|
|
10142
10364
|
code: 19,
|
|
10143
10365
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
10366
|
+
group: "correctness",
|
|
10144
10367
|
severity: "warning",
|
|
10145
10368
|
fixable: true,
|
|
10146
10369
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10189,6 +10412,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
10189
10412
|
name: "overriddenSchemaConstructor",
|
|
10190
10413
|
code: 30,
|
|
10191
10414
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
10415
|
+
group: "correctness",
|
|
10192
10416
|
severity: "error",
|
|
10193
10417
|
fixable: true,
|
|
10194
10418
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10328,6 +10552,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
10328
10552
|
name: "preferSchemaOverJson",
|
|
10329
10553
|
code: 44,
|
|
10330
10554
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
10555
|
+
group: "effectNative",
|
|
10331
10556
|
severity: "suggestion",
|
|
10332
10557
|
fixable: false,
|
|
10333
10558
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10440,6 +10665,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
10440
10665
|
name: "redundantSchemaTagIdentifier",
|
|
10441
10666
|
code: 42,
|
|
10442
10667
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
10668
|
+
group: "style",
|
|
10443
10669
|
severity: "suggestion",
|
|
10444
10670
|
fixable: true,
|
|
10445
10671
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10492,6 +10718,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
10492
10718
|
name: "returnEffectInGen",
|
|
10493
10719
|
code: 11,
|
|
10494
10720
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
10721
|
+
group: "antipattern",
|
|
10495
10722
|
severity: "suggestion",
|
|
10496
10723
|
fixable: true,
|
|
10497
10724
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10563,6 +10790,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
10563
10790
|
name: "runEffectInsideEffect",
|
|
10564
10791
|
code: 32,
|
|
10565
10792
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
10793
|
+
group: "antipattern",
|
|
10566
10794
|
severity: "suggestion",
|
|
10567
10795
|
fixable: true,
|
|
10568
10796
|
supportedEffect: ["v3"],
|
|
@@ -10689,6 +10917,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
10689
10917
|
name: "schemaStructWithTag",
|
|
10690
10918
|
code: 34,
|
|
10691
10919
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
10920
|
+
group: "style",
|
|
10692
10921
|
severity: "suggestion",
|
|
10693
10922
|
fixable: true,
|
|
10694
10923
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10783,9 +11012,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
10783
11012
|
name: "schemaSyncInEffect",
|
|
10784
11013
|
code: 43,
|
|
10785
11014
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11015
|
+
group: "antipattern",
|
|
10786
11016
|
severity: "suggestion",
|
|
10787
11017
|
fixable: false,
|
|
10788
|
-
supportedEffect: ["v3"
|
|
11018
|
+
supportedEffect: ["v3"],
|
|
10789
11019
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
10790
11020
|
const ts = yield* service(TypeScriptApi);
|
|
10791
11021
|
const typeParser = yield* service(TypeParser);
|
|
@@ -10834,6 +11064,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
10834
11064
|
name: "schemaUnionOfLiterals",
|
|
10835
11065
|
code: 33,
|
|
10836
11066
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11067
|
+
group: "style",
|
|
10837
11068
|
severity: "off",
|
|
10838
11069
|
fixable: true,
|
|
10839
11070
|
supportedEffect: ["v3"],
|
|
@@ -10911,6 +11142,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
10911
11142
|
name: "scopeInLayerEffect",
|
|
10912
11143
|
code: 13,
|
|
10913
11144
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11145
|
+
group: "antipattern",
|
|
10914
11146
|
severity: "warning",
|
|
10915
11147
|
fixable: true,
|
|
10916
11148
|
supportedEffect: ["v3"],
|
|
@@ -11008,6 +11240,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11008
11240
|
name: "serviceNotAsClass",
|
|
11009
11241
|
code: 51,
|
|
11010
11242
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
11243
|
+
group: "style",
|
|
11011
11244
|
severity: "off",
|
|
11012
11245
|
fixable: true,
|
|
11013
11246
|
supportedEffect: ["v4"],
|
|
@@ -11085,6 +11318,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11085
11318
|
name: "strictBooleanExpressions",
|
|
11086
11319
|
code: 17,
|
|
11087
11320
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
11321
|
+
group: "style",
|
|
11088
11322
|
severity: "off",
|
|
11089
11323
|
fixable: false,
|
|
11090
11324
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11158,6 +11392,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
11158
11392
|
name: "strictEffectProvide",
|
|
11159
11393
|
code: 27,
|
|
11160
11394
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
11395
|
+
group: "antipattern",
|
|
11161
11396
|
severity: "off",
|
|
11162
11397
|
fixable: false,
|
|
11163
11398
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11211,6 +11446,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
11211
11446
|
name: "tryCatchInEffectGen",
|
|
11212
11447
|
code: 15,
|
|
11213
11448
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
11449
|
+
group: "antipattern",
|
|
11214
11450
|
severity: "suggestion",
|
|
11215
11451
|
fixable: false,
|
|
11216
11452
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11270,6 +11506,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
11270
11506
|
name: "unknownInEffectCatch",
|
|
11271
11507
|
code: 31,
|
|
11272
11508
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
11509
|
+
group: "antipattern",
|
|
11273
11510
|
severity: "warning",
|
|
11274
11511
|
fixable: false,
|
|
11275
11512
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11333,6 +11570,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
11333
11570
|
name: "unnecessaryEffectGen",
|
|
11334
11571
|
code: 5,
|
|
11335
11572
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
11573
|
+
group: "style",
|
|
11336
11574
|
severity: "suggestion",
|
|
11337
11575
|
fixable: true,
|
|
11338
11576
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11379,6 +11617,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
11379
11617
|
name: "unnecessaryFailYieldableError",
|
|
11380
11618
|
code: 29,
|
|
11381
11619
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
11620
|
+
group: "style",
|
|
11382
11621
|
severity: "suggestion",
|
|
11383
11622
|
fixable: true,
|
|
11384
11623
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11440,6 +11679,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
11440
11679
|
name: "unnecessaryPipe",
|
|
11441
11680
|
code: 9,
|
|
11442
11681
|
description: "Removes pipe calls with no arguments",
|
|
11682
|
+
group: "style",
|
|
11443
11683
|
severity: "suggestion",
|
|
11444
11684
|
fixable: true,
|
|
11445
11685
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11488,6 +11728,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
11488
11728
|
name: "unnecessaryPipeChain",
|
|
11489
11729
|
code: 16,
|
|
11490
11730
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
11731
|
+
group: "style",
|
|
11491
11732
|
severity: "suggestion",
|
|
11492
11733
|
fixable: true,
|
|
11493
11734
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11565,6 +11806,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
11565
11806
|
name: "unsupportedServiceAccessors",
|
|
11566
11807
|
code: 21,
|
|
11567
11808
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
11809
|
+
group: "correctness",
|
|
11568
11810
|
severity: "warning",
|
|
11569
11811
|
fixable: true,
|
|
11570
11812
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11642,6 +11884,7 @@ var diagnostics = [
|
|
|
11642
11884
|
leakingRequirements,
|
|
11643
11885
|
unnecessaryPipe,
|
|
11644
11886
|
genericEffectServices,
|
|
11887
|
+
globalFetch,
|
|
11645
11888
|
returnEffectInGen,
|
|
11646
11889
|
tryCatchInEffectGen,
|
|
11647
11890
|
importFromBarrel,
|