@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
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -1645,6 +1645,145 @@ var defaults = {
|
|
|
1645
1645
|
mermaidProvider: "mermaid.live",
|
|
1646
1646
|
skipDisabledOptimization: false
|
|
1647
1647
|
};
|
|
1648
|
+
var booleanSchema = (description, defaultValue) => ({
|
|
1649
|
+
type: "boolean",
|
|
1650
|
+
description,
|
|
1651
|
+
default: defaultValue
|
|
1652
|
+
});
|
|
1653
|
+
var stringArraySchema = (description, defaultValue) => ({
|
|
1654
|
+
type: "array",
|
|
1655
|
+
description,
|
|
1656
|
+
default: defaultValue,
|
|
1657
|
+
items: { type: "string" }
|
|
1658
|
+
});
|
|
1659
|
+
var stringEnumSchema = (description, values, defaultValue) => ({
|
|
1660
|
+
type: "string",
|
|
1661
|
+
description,
|
|
1662
|
+
enum: values,
|
|
1663
|
+
default: defaultValue
|
|
1664
|
+
});
|
|
1665
|
+
var languageServicePluginAdditionalPropertiesJsonSchema = {
|
|
1666
|
+
refactors: booleanSchema("Controls Effect refactors.", defaults.refactors),
|
|
1667
|
+
diagnostics: booleanSchema("Controls Effect diagnostics.", defaults.diagnostics),
|
|
1668
|
+
diagnosticsName: booleanSchema(
|
|
1669
|
+
"Controls whether to include the rule name in diagnostic messages.",
|
|
1670
|
+
defaults.diagnosticsName
|
|
1671
|
+
),
|
|
1672
|
+
missingDiagnosticNextLine: stringEnumSchema(
|
|
1673
|
+
"Controls the severity of warnings for unused @effect-diagnostics-next-line comments.",
|
|
1674
|
+
["off", "error", "warning", "message", "suggestion"],
|
|
1675
|
+
defaults.missingDiagnosticNextLine
|
|
1676
|
+
),
|
|
1677
|
+
includeSuggestionsInTsc: booleanSchema(
|
|
1678
|
+
"When patch mode is enabled, reports suggestion diagnostics as messages in TSC with a [suggestion] prefix.",
|
|
1679
|
+
defaults.includeSuggestionsInTsc
|
|
1680
|
+
),
|
|
1681
|
+
ignoreEffectWarningsInTscExitCode: booleanSchema(
|
|
1682
|
+
"When enabled, Effect warnings do not affect the patched tsc exit code.",
|
|
1683
|
+
defaults.ignoreEffectWarningsInTscExitCode
|
|
1684
|
+
),
|
|
1685
|
+
ignoreEffectErrorsInTscExitCode: booleanSchema(
|
|
1686
|
+
"When enabled, Effect errors do not affect the patched tsc exit code.",
|
|
1687
|
+
defaults.ignoreEffectErrorsInTscExitCode
|
|
1688
|
+
),
|
|
1689
|
+
ignoreEffectSuggestionsInTscExitCode: booleanSchema(
|
|
1690
|
+
"When enabled, Effect suggestions do not affect the patched tsc exit code.",
|
|
1691
|
+
defaults.ignoreEffectSuggestionsInTscExitCode
|
|
1692
|
+
),
|
|
1693
|
+
quickinfoEffectParameters: stringEnumSchema(
|
|
1694
|
+
"Controls when Effect quickinfo should include full type parameters.",
|
|
1695
|
+
["always", "never", "whentruncated"],
|
|
1696
|
+
defaults.quickinfoEffectParameters
|
|
1697
|
+
),
|
|
1698
|
+
quickinfo: booleanSchema("Controls Effect quickinfo.", defaults.quickinfo),
|
|
1699
|
+
quickinfoMaximumLength: {
|
|
1700
|
+
type: "number",
|
|
1701
|
+
description: "Controls the maximum quickinfo length. Use -1 to disable truncation.",
|
|
1702
|
+
default: defaults.quickinfoMaximumLength
|
|
1703
|
+
},
|
|
1704
|
+
keyPatterns: {
|
|
1705
|
+
type: "array",
|
|
1706
|
+
description: "Configures key patterns used for generated Effect service and error keys.",
|
|
1707
|
+
default: defaults.keyPatterns,
|
|
1708
|
+
items: {
|
|
1709
|
+
type: "object",
|
|
1710
|
+
properties: {
|
|
1711
|
+
target: stringEnumSchema("The key builder target.", ["service", "error", "custom"], "service"),
|
|
1712
|
+
pattern: stringEnumSchema(
|
|
1713
|
+
"The key generation pattern.",
|
|
1714
|
+
["package-identifier", "default", "default-hashed"],
|
|
1715
|
+
"default"
|
|
1716
|
+
),
|
|
1717
|
+
skipLeadingPath: stringArraySchema("Path prefixes to strip before generating keys.", ["src/"])
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
extendedKeyDetection: booleanSchema(
|
|
1722
|
+
"Enables extended heuristics when detecting key sources.",
|
|
1723
|
+
defaults.extendedKeyDetection
|
|
1724
|
+
),
|
|
1725
|
+
completions: booleanSchema("Controls Effect completions.", defaults.completions),
|
|
1726
|
+
goto: booleanSchema("Controls Effect goto references support.", defaults.goto),
|
|
1727
|
+
inlays: booleanSchema("Controls Effect inlay hints.", defaults.inlays),
|
|
1728
|
+
allowedDuplicatedPackages: stringArraySchema(
|
|
1729
|
+
"Package names that are allowed to duplicate Effect as a peer dependency.",
|
|
1730
|
+
defaults.allowedDuplicatedPackages
|
|
1731
|
+
),
|
|
1732
|
+
namespaceImportPackages: stringArraySchema(
|
|
1733
|
+
"Package names that should prefer namespace imports.",
|
|
1734
|
+
defaults.namespaceImportPackages
|
|
1735
|
+
),
|
|
1736
|
+
topLevelNamedReexports: stringEnumSchema(
|
|
1737
|
+
"For namespaceImportPackages, controls how top-level named re-exports are handled.",
|
|
1738
|
+
["ignore", "follow"],
|
|
1739
|
+
defaults.topLevelNamedReexports
|
|
1740
|
+
),
|
|
1741
|
+
barrelImportPackages: stringArraySchema(
|
|
1742
|
+
"Package names that should prefer imports from their top-level barrel file.",
|
|
1743
|
+
defaults.barrelImportPackages
|
|
1744
|
+
),
|
|
1745
|
+
importAliases: {
|
|
1746
|
+
type: "object",
|
|
1747
|
+
description: "Custom aliases to use for imported identifiers.",
|
|
1748
|
+
default: defaults.importAliases,
|
|
1749
|
+
additionalProperties: {
|
|
1750
|
+
type: "string"
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
renames: booleanSchema("Controls Effect rename helpers.", defaults.renames),
|
|
1754
|
+
noExternal: booleanSchema(
|
|
1755
|
+
"Disables features that link to external websites.",
|
|
1756
|
+
defaults.noExternal
|
|
1757
|
+
),
|
|
1758
|
+
pipeableMinArgCount: {
|
|
1759
|
+
type: "number",
|
|
1760
|
+
description: "Minimum argument count required before pipeable suggestions are emitted.",
|
|
1761
|
+
default: defaults.pipeableMinArgCount
|
|
1762
|
+
},
|
|
1763
|
+
effectFn: {
|
|
1764
|
+
type: "array",
|
|
1765
|
+
description: "Configures which Effect.fn variants should be suggested.",
|
|
1766
|
+
default: defaults.effectFn,
|
|
1767
|
+
items: {
|
|
1768
|
+
type: "string",
|
|
1769
|
+
enum: ["untraced", "span", "suggested-span", "inferred-span", "no-span"]
|
|
1770
|
+
}
|
|
1771
|
+
},
|
|
1772
|
+
layerGraphFollowDepth: {
|
|
1773
|
+
type: "number",
|
|
1774
|
+
description: "Controls how deeply layer graph analysis follows dependencies.",
|
|
1775
|
+
default: defaults.layerGraphFollowDepth
|
|
1776
|
+
},
|
|
1777
|
+
mermaidProvider: {
|
|
1778
|
+
type: "string",
|
|
1779
|
+
description: "Controls which Mermaid renderer is used for layer graphs.",
|
|
1780
|
+
default: defaults.mermaidProvider
|
|
1781
|
+
},
|
|
1782
|
+
skipDisabledOptimization: booleanSchema(
|
|
1783
|
+
"When enabled, disabled diagnostics are still processed so comment-based overrides can be honored.",
|
|
1784
|
+
defaults.skipDisabledOptimization
|
|
1785
|
+
)
|
|
1786
|
+
};
|
|
1648
1787
|
function parseKeyPatterns(patterns) {
|
|
1649
1788
|
const result = [];
|
|
1650
1789
|
for (const entry of patterns) {
|
|
@@ -5130,6 +5269,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
5130
5269
|
name: "anyUnknownInErrorContext",
|
|
5131
5270
|
code: 28,
|
|
5132
5271
|
description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
|
|
5272
|
+
group: "correctness",
|
|
5133
5273
|
severity: "off",
|
|
5134
5274
|
fixable: false,
|
|
5135
5275
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5235,6 +5375,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
5235
5375
|
name: "catchAllToMapError",
|
|
5236
5376
|
code: 39,
|
|
5237
5377
|
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
5378
|
+
group: "style",
|
|
5238
5379
|
severity: "suggestion",
|
|
5239
5380
|
fixable: true,
|
|
5240
5381
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5334,6 +5475,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
5334
5475
|
name: "catchUnfailableEffect",
|
|
5335
5476
|
code: 2,
|
|
5336
5477
|
description: "Warns when using error handling on Effects that never fail (error type is 'never')",
|
|
5478
|
+
group: "antipattern",
|
|
5337
5479
|
severity: "suggestion",
|
|
5338
5480
|
fixable: false,
|
|
5339
5481
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5385,6 +5527,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
5385
5527
|
name: "classSelfMismatch",
|
|
5386
5528
|
code: 20,
|
|
5387
5529
|
description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
|
|
5530
|
+
group: "correctness",
|
|
5388
5531
|
severity: "error",
|
|
5389
5532
|
fixable: true,
|
|
5390
5533
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5525,6 +5668,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
5525
5668
|
name: "deterministicKeys",
|
|
5526
5669
|
code: 25,
|
|
5527
5670
|
description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
|
|
5671
|
+
group: "style",
|
|
5528
5672
|
severity: "off",
|
|
5529
5673
|
fixable: true,
|
|
5530
5674
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5644,6 +5788,7 @@ var duplicatePackage = createDiagnostic({
|
|
|
5644
5788
|
name: "duplicatePackage",
|
|
5645
5789
|
code: 6,
|
|
5646
5790
|
description: "Detects when multiple versions of the same Effect package are loaded",
|
|
5791
|
+
group: "correctness",
|
|
5647
5792
|
severity: "warning",
|
|
5648
5793
|
fixable: false,
|
|
5649
5794
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5675,6 +5820,7 @@ var effectFnIife = createDiagnostic({
|
|
|
5675
5820
|
name: "effectFnIife",
|
|
5676
5821
|
code: 46,
|
|
5677
5822
|
description: "Effect.fn or Effect.fnUntraced is called as an IIFE (Immediately Invoked Function Expression). Use Effect.gen instead.",
|
|
5823
|
+
group: "antipattern",
|
|
5678
5824
|
severity: "warning",
|
|
5679
5825
|
fixable: true,
|
|
5680
5826
|
supportedEffect: ["v3", "v4"],
|
|
@@ -5779,6 +5925,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
5779
5925
|
name: "effectFnOpportunity",
|
|
5780
5926
|
code: 41,
|
|
5781
5927
|
description: "Suggests using Effect.fn for functions that returns an Effect",
|
|
5928
|
+
group: "style",
|
|
5782
5929
|
severity: "suggestion",
|
|
5783
5930
|
fixable: true,
|
|
5784
5931
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6373,6 +6520,7 @@ var effectGenUsesAdapter = createDiagnostic({
|
|
|
6373
6520
|
name: "effectGenUsesAdapter",
|
|
6374
6521
|
code: 23,
|
|
6375
6522
|
description: "Warns when using the deprecated adapter parameter in Effect.gen",
|
|
6523
|
+
group: "antipattern",
|
|
6376
6524
|
severity: "warning",
|
|
6377
6525
|
fixable: false,
|
|
6378
6526
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6413,6 +6561,7 @@ var effectInFailure = createDiagnostic({
|
|
|
6413
6561
|
name: "effectInFailure",
|
|
6414
6562
|
code: 49,
|
|
6415
6563
|
description: "Warns when an Effect is used inside an Effect failure channel",
|
|
6564
|
+
group: "antipattern",
|
|
6416
6565
|
severity: "warning",
|
|
6417
6566
|
fixable: false,
|
|
6418
6567
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6479,6 +6628,7 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
6479
6628
|
name: "effectInVoidSuccess",
|
|
6480
6629
|
code: 14,
|
|
6481
6630
|
description: "Detects nested Effects in void success channels that may cause unexecuted effects",
|
|
6631
|
+
group: "antipattern",
|
|
6482
6632
|
severity: "warning",
|
|
6483
6633
|
fixable: false,
|
|
6484
6634
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6530,6 +6680,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
6530
6680
|
name: "effectMapVoid",
|
|
6531
6681
|
code: 40,
|
|
6532
6682
|
description: "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
|
|
6683
|
+
group: "style",
|
|
6533
6684
|
severity: "suggestion",
|
|
6534
6685
|
fixable: true,
|
|
6535
6686
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6596,6 +6747,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
6596
6747
|
name: "effectSucceedWithVoid",
|
|
6597
6748
|
code: 47,
|
|
6598
6749
|
description: "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
|
|
6750
|
+
group: "style",
|
|
6599
6751
|
severity: "suggestion",
|
|
6600
6752
|
fixable: true,
|
|
6601
6753
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6649,6 +6801,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
6649
6801
|
name: "extendsNativeError",
|
|
6650
6802
|
code: 50,
|
|
6651
6803
|
description: "Warns when a class directly extends the native Error class",
|
|
6804
|
+
group: "effectNative",
|
|
6652
6805
|
severity: "off",
|
|
6653
6806
|
fixable: false,
|
|
6654
6807
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6701,6 +6854,7 @@ var floatingEffect = createDiagnostic({
|
|
|
6701
6854
|
name: "floatingEffect",
|
|
6702
6855
|
code: 3,
|
|
6703
6856
|
description: "Ensures Effects are yielded or assigned to variables, not left floating",
|
|
6857
|
+
group: "correctness",
|
|
6704
6858
|
severity: "error",
|
|
6705
6859
|
fixable: false,
|
|
6706
6860
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6754,6 +6908,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
6754
6908
|
name: "genericEffectServices",
|
|
6755
6909
|
code: 10,
|
|
6756
6910
|
description: "Prevents services with type parameters that cannot be discriminated at runtime",
|
|
6911
|
+
group: "correctness",
|
|
6757
6912
|
severity: "warning",
|
|
6758
6913
|
fixable: false,
|
|
6759
6914
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6803,6 +6958,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
6803
6958
|
name: "globalErrorInEffectCatch",
|
|
6804
6959
|
code: 36,
|
|
6805
6960
|
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
6961
|
+
group: "antipattern",
|
|
6806
6962
|
severity: "warning",
|
|
6807
6963
|
fixable: false,
|
|
6808
6964
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6865,6 +7021,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
6865
7021
|
name: "globalErrorInEffectFailure",
|
|
6866
7022
|
code: 35,
|
|
6867
7023
|
description: "Warns when the global Error type is used in an Effect failure channel",
|
|
7024
|
+
group: "antipattern",
|
|
6868
7025
|
severity: "warning",
|
|
6869
7026
|
fixable: false,
|
|
6870
7027
|
supportedEffect: ["v3", "v4"],
|
|
@@ -6915,11 +7072,54 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
6915
7072
|
})
|
|
6916
7073
|
});
|
|
6917
7074
|
|
|
7075
|
+
// src/diagnostics/globalFetch.ts
|
|
7076
|
+
var globalFetch = createDiagnostic({
|
|
7077
|
+
name: "globalFetch",
|
|
7078
|
+
code: 53,
|
|
7079
|
+
description: "Warns when using the global fetch function instead of the Effect HTTP client",
|
|
7080
|
+
group: "effectNative",
|
|
7081
|
+
severity: "off",
|
|
7082
|
+
fixable: false,
|
|
7083
|
+
supportedEffect: ["v3", "v4"],
|
|
7084
|
+
apply: fn("globalFetch.apply")(function* (sourceFile, report) {
|
|
7085
|
+
const ts = yield* service(TypeScriptApi);
|
|
7086
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
7087
|
+
const typeParser = yield* service(TypeParser);
|
|
7088
|
+
const fetchSymbol = typeChecker.resolveName("fetch", void 0, ts.SymbolFlags.Value, false);
|
|
7089
|
+
if (!fetchSymbol) return;
|
|
7090
|
+
const effectVersion = typeParser.supportedEffect();
|
|
7091
|
+
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
7092
|
+
const messageText = `Prefer using HttpClient from ${packageName} instead of the global 'fetch' function.`;
|
|
7093
|
+
const nodeToVisit = [];
|
|
7094
|
+
const appendNodeToVisit = (node) => {
|
|
7095
|
+
nodeToVisit.push(node);
|
|
7096
|
+
return void 0;
|
|
7097
|
+
};
|
|
7098
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
7099
|
+
while (nodeToVisit.length > 0) {
|
|
7100
|
+
const node = nodeToVisit.shift();
|
|
7101
|
+
if (ts.isCallExpression(node)) {
|
|
7102
|
+
const symbol3 = typeChecker.getSymbolAtLocation(node.expression);
|
|
7103
|
+
const resolvedSymbol = symbol3 && symbol3.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol3) : symbol3;
|
|
7104
|
+
if (resolvedSymbol === fetchSymbol) {
|
|
7105
|
+
report({
|
|
7106
|
+
location: node.expression,
|
|
7107
|
+
messageText,
|
|
7108
|
+
fixes: []
|
|
7109
|
+
});
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
7113
|
+
}
|
|
7114
|
+
})
|
|
7115
|
+
});
|
|
7116
|
+
|
|
6918
7117
|
// src/diagnostics/importFromBarrel.ts
|
|
6919
7118
|
var importFromBarrel = createDiagnostic({
|
|
6920
7119
|
name: "importFromBarrel",
|
|
6921
7120
|
code: 12,
|
|
6922
7121
|
description: "Suggests importing from specific module paths instead of barrel exports",
|
|
7122
|
+
group: "style",
|
|
6923
7123
|
severity: "off",
|
|
6924
7124
|
fixable: true,
|
|
6925
7125
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7062,6 +7262,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
7062
7262
|
name: "instanceOfSchema",
|
|
7063
7263
|
code: 45,
|
|
7064
7264
|
description: "Suggests using Schema.is instead of instanceof for Effect Schema types",
|
|
7265
|
+
group: "effectNative",
|
|
7065
7266
|
severity: "off",
|
|
7066
7267
|
fixable: true,
|
|
7067
7268
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7127,6 +7328,7 @@ var layerMergeAllWithDependencies = createDiagnostic({
|
|
|
7127
7328
|
name: "layerMergeAllWithDependencies",
|
|
7128
7329
|
code: 37,
|
|
7129
7330
|
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
7331
|
+
group: "antipattern",
|
|
7130
7332
|
severity: "warning",
|
|
7131
7333
|
fixable: true,
|
|
7132
7334
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7242,6 +7444,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
7242
7444
|
name: "leakingRequirements",
|
|
7243
7445
|
code: 8,
|
|
7244
7446
|
description: "Detects implementation services leaked in service methods",
|
|
7447
|
+
group: "antipattern",
|
|
7245
7448
|
severity: "suggestion",
|
|
7246
7449
|
fixable: false,
|
|
7247
7450
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7398,6 +7601,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
7398
7601
|
name: "missedPipeableOpportunity",
|
|
7399
7602
|
code: 26,
|
|
7400
7603
|
description: "Enforces the use of pipeable style for nested function calls",
|
|
7604
|
+
group: "style",
|
|
7401
7605
|
severity: "off",
|
|
7402
7606
|
fixable: true,
|
|
7403
7607
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7580,6 +7784,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
7580
7784
|
name: "missingEffectContext",
|
|
7581
7785
|
code: 1,
|
|
7582
7786
|
description: "Reports missing service requirements in Effect context channel",
|
|
7787
|
+
group: "correctness",
|
|
7583
7788
|
severity: "error",
|
|
7584
7789
|
fixable: false,
|
|
7585
7790
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7631,6 +7836,7 @@ var missingEffectError = createDiagnostic({
|
|
|
7631
7836
|
name: "missingEffectError",
|
|
7632
7837
|
code: 1,
|
|
7633
7838
|
description: "Reports missing error types in Effect error channel",
|
|
7839
|
+
group: "correctness",
|
|
7634
7840
|
severity: "error",
|
|
7635
7841
|
fixable: true,
|
|
7636
7842
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7774,6 +7980,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
7774
7980
|
name: "missingEffectServiceDependency",
|
|
7775
7981
|
code: 22,
|
|
7776
7982
|
description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
|
|
7983
|
+
group: "style",
|
|
7777
7984
|
severity: "off",
|
|
7778
7985
|
fixable: false,
|
|
7779
7986
|
supportedEffect: ["v3"],
|
|
@@ -7870,6 +8077,7 @@ var missingLayerContext = createDiagnostic({
|
|
|
7870
8077
|
name: "missingLayerContext",
|
|
7871
8078
|
code: 38,
|
|
7872
8079
|
description: "Reports missing service requirements in Layer context channel",
|
|
8080
|
+
group: "correctness",
|
|
7873
8081
|
severity: "error",
|
|
7874
8082
|
fixable: false,
|
|
7875
8083
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7921,6 +8129,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
7921
8129
|
name: "missingReturnYieldStar",
|
|
7922
8130
|
code: 7,
|
|
7923
8131
|
description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
|
|
8132
|
+
group: "correctness",
|
|
7924
8133
|
severity: "error",
|
|
7925
8134
|
fixable: true,
|
|
7926
8135
|
supportedEffect: ["v3", "v4"],
|
|
@@ -7973,6 +8182,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
7973
8182
|
name: "missingStarInYieldEffectGen",
|
|
7974
8183
|
code: 4,
|
|
7975
8184
|
description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
|
|
8185
|
+
group: "correctness",
|
|
7976
8186
|
severity: "error",
|
|
7977
8187
|
fixable: true,
|
|
7978
8188
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8050,6 +8260,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
8050
8260
|
name: "multipleEffectProvide",
|
|
8051
8261
|
code: 18,
|
|
8052
8262
|
description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
|
|
8263
|
+
group: "antipattern",
|
|
8053
8264
|
severity: "warning",
|
|
8054
8265
|
fixable: true,
|
|
8055
8266
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8152,7 +8363,11 @@ var moduleAlternativesV3 = /* @__PURE__ */ new Map([
|
|
|
8152
8363
|
["path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8153
8364
|
["node:path/win32", { alternative: "Path", module: "path", package: "@effect/platform" }],
|
|
8154
8365
|
["child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8155
|
-
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }]
|
|
8366
|
+
["node:child_process", { alternative: "CommandExecutor", module: "child_process", package: "@effect/platform" }],
|
|
8367
|
+
["http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8368
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "@effect/platform" }],
|
|
8369
|
+
["https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }],
|
|
8370
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "@effect/platform" }]
|
|
8156
8371
|
]);
|
|
8157
8372
|
var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
8158
8373
|
["fs", { alternative: "FileSystem", module: "fs", package: "effect" }],
|
|
@@ -8166,12 +8381,17 @@ var moduleAlternativesV4 = /* @__PURE__ */ new Map([
|
|
|
8166
8381
|
["path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8167
8382
|
["node:path/win32", { alternative: "Path", module: "path", package: "effect" }],
|
|
8168
8383
|
["child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8169
|
-
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }]
|
|
8384
|
+
["node:child_process", { alternative: "ChildProcess", module: "child_process", package: "effect" }],
|
|
8385
|
+
["http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8386
|
+
["node:http", { alternative: "HttpClient", module: "http", package: "effect/unstable/http" }],
|
|
8387
|
+
["https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }],
|
|
8388
|
+
["node:https", { alternative: "HttpClient", module: "https", package: "effect/unstable/http" }]
|
|
8170
8389
|
]);
|
|
8171
8390
|
var nodeBuiltinImport = createDiagnostic({
|
|
8172
8391
|
name: "nodeBuiltinImport",
|
|
8173
8392
|
code: 52,
|
|
8174
8393
|
description: "Warns when importing Node.js built-in modules that have Effect-native counterparts",
|
|
8394
|
+
group: "effectNative",
|
|
8175
8395
|
severity: "off",
|
|
8176
8396
|
fixable: false,
|
|
8177
8397
|
supportedEffect: ["v3", "v4"],
|
|
@@ -8215,6 +8435,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
8215
8435
|
name: "nonObjectEffectServiceType",
|
|
8216
8436
|
code: 24,
|
|
8217
8437
|
description: "Ensures Effect.Service types are objects, not primitives",
|
|
8438
|
+
group: "correctness",
|
|
8218
8439
|
severity: "error",
|
|
8219
8440
|
fixable: false,
|
|
8220
8441
|
supportedEffect: ["v3"],
|
|
@@ -8999,6 +9220,7 @@ var outdatedApi = createDiagnostic({
|
|
|
8999
9220
|
name: "outdatedApi",
|
|
9000
9221
|
code: 48,
|
|
9001
9222
|
description: "Detects usage of APIs that have been removed or renamed in Effect v4",
|
|
9223
|
+
group: "correctness",
|
|
9002
9224
|
severity: "warning",
|
|
9003
9225
|
fixable: false,
|
|
9004
9226
|
supportedEffect: ["v4"],
|
|
@@ -10137,6 +10359,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
10137
10359
|
name: "outdatedEffectCodegen",
|
|
10138
10360
|
code: 19,
|
|
10139
10361
|
description: "Detects when generated code is outdated and needs to be regenerated",
|
|
10362
|
+
group: "correctness",
|
|
10140
10363
|
severity: "warning",
|
|
10141
10364
|
fixable: true,
|
|
10142
10365
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10185,6 +10408,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
10185
10408
|
name: "overriddenSchemaConstructor",
|
|
10186
10409
|
code: 30,
|
|
10187
10410
|
description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
|
|
10411
|
+
group: "correctness",
|
|
10188
10412
|
severity: "error",
|
|
10189
10413
|
fixable: true,
|
|
10190
10414
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10324,6 +10548,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
10324
10548
|
name: "preferSchemaOverJson",
|
|
10325
10549
|
code: 44,
|
|
10326
10550
|
description: "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify which may throw",
|
|
10551
|
+
group: "effectNative",
|
|
10327
10552
|
severity: "suggestion",
|
|
10328
10553
|
fixable: false,
|
|
10329
10554
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10436,6 +10661,7 @@ var redundantSchemaTagIdentifier = createDiagnostic({
|
|
|
10436
10661
|
name: "redundantSchemaTagIdentifier",
|
|
10437
10662
|
code: 42,
|
|
10438
10663
|
description: "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
|
|
10664
|
+
group: "style",
|
|
10439
10665
|
severity: "suggestion",
|
|
10440
10666
|
fixable: true,
|
|
10441
10667
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10488,6 +10714,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
10488
10714
|
name: "returnEffectInGen",
|
|
10489
10715
|
code: 11,
|
|
10490
10716
|
description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
|
|
10717
|
+
group: "antipattern",
|
|
10491
10718
|
severity: "suggestion",
|
|
10492
10719
|
fixable: true,
|
|
10493
10720
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10559,6 +10786,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
10559
10786
|
name: "runEffectInsideEffect",
|
|
10560
10787
|
code: 32,
|
|
10561
10788
|
description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
|
|
10789
|
+
group: "antipattern",
|
|
10562
10790
|
severity: "suggestion",
|
|
10563
10791
|
fixable: true,
|
|
10564
10792
|
supportedEffect: ["v3"],
|
|
@@ -10685,6 +10913,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
10685
10913
|
name: "schemaStructWithTag",
|
|
10686
10914
|
code: 34,
|
|
10687
10915
|
description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
|
|
10916
|
+
group: "style",
|
|
10688
10917
|
severity: "suggestion",
|
|
10689
10918
|
fixable: true,
|
|
10690
10919
|
supportedEffect: ["v3", "v4"],
|
|
@@ -10779,9 +11008,10 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
10779
11008
|
name: "schemaSyncInEffect",
|
|
10780
11009
|
code: 43,
|
|
10781
11010
|
description: "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
|
|
11011
|
+
group: "antipattern",
|
|
10782
11012
|
severity: "suggestion",
|
|
10783
11013
|
fixable: false,
|
|
10784
|
-
supportedEffect: ["v3"
|
|
11014
|
+
supportedEffect: ["v3"],
|
|
10785
11015
|
apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
|
|
10786
11016
|
const ts = yield* service(TypeScriptApi);
|
|
10787
11017
|
const typeParser = yield* service(TypeParser);
|
|
@@ -10830,6 +11060,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
10830
11060
|
name: "schemaUnionOfLiterals",
|
|
10831
11061
|
code: 33,
|
|
10832
11062
|
description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
|
|
11063
|
+
group: "style",
|
|
10833
11064
|
severity: "off",
|
|
10834
11065
|
fixable: true,
|
|
10835
11066
|
supportedEffect: ["v3"],
|
|
@@ -10907,6 +11138,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
10907
11138
|
name: "scopeInLayerEffect",
|
|
10908
11139
|
code: 13,
|
|
10909
11140
|
description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
|
|
11141
|
+
group: "antipattern",
|
|
10910
11142
|
severity: "warning",
|
|
10911
11143
|
fixable: true,
|
|
10912
11144
|
supportedEffect: ["v3"],
|
|
@@ -11004,6 +11236,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
11004
11236
|
name: "serviceNotAsClass",
|
|
11005
11237
|
code: 51,
|
|
11006
11238
|
description: "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
|
|
11239
|
+
group: "style",
|
|
11007
11240
|
severity: "off",
|
|
11008
11241
|
fixable: true,
|
|
11009
11242
|
supportedEffect: ["v4"],
|
|
@@ -11081,6 +11314,7 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
11081
11314
|
name: "strictBooleanExpressions",
|
|
11082
11315
|
code: 17,
|
|
11083
11316
|
description: "Enforces boolean types in conditional expressions for type safety",
|
|
11317
|
+
group: "style",
|
|
11084
11318
|
severity: "off",
|
|
11085
11319
|
fixable: false,
|
|
11086
11320
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11154,6 +11388,7 @@ var strictEffectProvide = createDiagnostic({
|
|
|
11154
11388
|
name: "strictEffectProvide",
|
|
11155
11389
|
code: 27,
|
|
11156
11390
|
description: "Warns when using Effect.provide with layers outside of application entry points",
|
|
11391
|
+
group: "antipattern",
|
|
11157
11392
|
severity: "off",
|
|
11158
11393
|
fixable: false,
|
|
11159
11394
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11207,6 +11442,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
11207
11442
|
name: "tryCatchInEffectGen",
|
|
11208
11443
|
code: 15,
|
|
11209
11444
|
description: "Discourages try/catch in Effect generators in favor of Effect error handling",
|
|
11445
|
+
group: "antipattern",
|
|
11210
11446
|
severity: "suggestion",
|
|
11211
11447
|
fixable: false,
|
|
11212
11448
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11266,6 +11502,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
11266
11502
|
name: "unknownInEffectCatch",
|
|
11267
11503
|
code: 31,
|
|
11268
11504
|
description: "Warns when catch callbacks return unknown instead of typed errors",
|
|
11505
|
+
group: "antipattern",
|
|
11269
11506
|
severity: "warning",
|
|
11270
11507
|
fixable: false,
|
|
11271
11508
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11329,6 +11566,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
11329
11566
|
name: "unnecessaryEffectGen",
|
|
11330
11567
|
code: 5,
|
|
11331
11568
|
description: "Suggests removing Effect.gen when it contains only a single return statement",
|
|
11569
|
+
group: "style",
|
|
11332
11570
|
severity: "suggestion",
|
|
11333
11571
|
fixable: true,
|
|
11334
11572
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11375,6 +11613,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
11375
11613
|
name: "unnecessaryFailYieldableError",
|
|
11376
11614
|
code: 29,
|
|
11377
11615
|
description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
|
|
11616
|
+
group: "style",
|
|
11378
11617
|
severity: "suggestion",
|
|
11379
11618
|
fixable: true,
|
|
11380
11619
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11436,6 +11675,7 @@ var unnecessaryPipe = createDiagnostic({
|
|
|
11436
11675
|
name: "unnecessaryPipe",
|
|
11437
11676
|
code: 9,
|
|
11438
11677
|
description: "Removes pipe calls with no arguments",
|
|
11678
|
+
group: "style",
|
|
11439
11679
|
severity: "suggestion",
|
|
11440
11680
|
fixable: true,
|
|
11441
11681
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11484,6 +11724,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
11484
11724
|
name: "unnecessaryPipeChain",
|
|
11485
11725
|
code: 16,
|
|
11486
11726
|
description: "Simplifies chained pipe calls into a single pipe call",
|
|
11727
|
+
group: "style",
|
|
11487
11728
|
severity: "suggestion",
|
|
11488
11729
|
fixable: true,
|
|
11489
11730
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11561,6 +11802,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
11561
11802
|
name: "unsupportedServiceAccessors",
|
|
11562
11803
|
code: 21,
|
|
11563
11804
|
description: "Warns about service accessors that need codegen due to generic/complex signatures",
|
|
11805
|
+
group: "correctness",
|
|
11564
11806
|
severity: "warning",
|
|
11565
11807
|
fixable: true,
|
|
11566
11808
|
supportedEffect: ["v3", "v4"],
|
|
@@ -11638,6 +11880,7 @@ var diagnostics = [
|
|
|
11638
11880
|
leakingRequirements,
|
|
11639
11881
|
unnecessaryPipe,
|
|
11640
11882
|
genericEffectServices,
|
|
11883
|
+
globalFetch,
|
|
11641
11884
|
returnEffectInGen,
|
|
11642
11885
|
tryCatchInEffectGen,
|
|
11643
11886
|
importFromBarrel,
|