@effect/language-service 0.45.0 → 0.46.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 +2 -0
- package/cli.js +613 -558
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +113 -29
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +131 -38
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +113 -29
- package/transform.js.map +1 -1
|
@@ -26,7 +26,7 @@ __export(effect_lsp_patch_utils_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(effect_lsp_patch_utils_exports);
|
|
28
28
|
|
|
29
|
-
// node_modules/.pnpm/effect@3.
|
|
29
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Function.js
|
|
30
30
|
var isFunction = (input) => typeof input === "function";
|
|
31
31
|
var dual = function(arity, body) {
|
|
32
32
|
if (typeof arity === "function") {
|
|
@@ -120,7 +120,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// node_modules/.pnpm/effect@3.
|
|
123
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/GlobalValue.js
|
|
124
124
|
var globalStoreId = `effect/GlobalValue`;
|
|
125
125
|
var globalStore;
|
|
126
126
|
var globalValue = (id, compute) => {
|
|
@@ -134,7 +134,7 @@ var globalValue = (id, compute) => {
|
|
|
134
134
|
return globalStore.get(id);
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
// node_modules/.pnpm/effect@3.
|
|
137
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Predicate.js
|
|
138
138
|
var isString = (input) => typeof input === "string";
|
|
139
139
|
var isNumber = (input) => typeof input === "number";
|
|
140
140
|
var isBoolean = (input) => typeof input === "boolean";
|
|
@@ -144,7 +144,7 @@ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
|
144
144
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
145
145
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
146
146
|
|
|
147
|
-
// node_modules/.pnpm/effect@3.
|
|
147
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Utils.js
|
|
148
148
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
149
149
|
var GenKindImpl = class {
|
|
150
150
|
value;
|
|
@@ -266,7 +266,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
266
266
|
var genConstructor = function* () {
|
|
267
267
|
}.constructor;
|
|
268
268
|
|
|
269
|
-
// node_modules/.pnpm/effect@3.
|
|
269
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Hash.js
|
|
270
270
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
271
271
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
272
272
|
var hash = (self) => {
|
|
@@ -365,7 +365,7 @@ var cached = function() {
|
|
|
365
365
|
return hash2;
|
|
366
366
|
};
|
|
367
367
|
|
|
368
|
-
// node_modules/.pnpm/effect@3.
|
|
368
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Equal.js
|
|
369
369
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
370
370
|
function equals() {
|
|
371
371
|
if (arguments.length === 1) {
|
|
@@ -419,7 +419,7 @@ function compareBoth(self, that) {
|
|
|
419
419
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
420
420
|
var equivalence = () => equals;
|
|
421
421
|
|
|
422
|
-
// node_modules/.pnpm/effect@3.
|
|
422
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Inspectable.js
|
|
423
423
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
424
424
|
var toJSON = (x) => {
|
|
425
425
|
try {
|
|
@@ -471,7 +471,7 @@ var redact = (u) => {
|
|
|
471
471
|
return u;
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
-
// node_modules/.pnpm/effect@3.
|
|
474
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Pipeable.js
|
|
475
475
|
var pipeArguments = (self, args2) => {
|
|
476
476
|
switch (args2.length) {
|
|
477
477
|
case 0:
|
|
@@ -504,14 +504,14 @@ var pipeArguments = (self, args2) => {
|
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
|
|
507
|
-
// node_modules/.pnpm/effect@3.
|
|
507
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
508
508
|
var OP_COMMIT = "Commit";
|
|
509
509
|
|
|
510
|
-
// node_modules/.pnpm/effect@3.
|
|
511
|
-
var moduleVersion = "3.
|
|
510
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/version.js
|
|
511
|
+
var moduleVersion = "3.18.4";
|
|
512
512
|
var getCurrentVersion = () => moduleVersion;
|
|
513
513
|
|
|
514
|
-
// node_modules/.pnpm/effect@3.
|
|
514
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/effectable.js
|
|
515
515
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
516
516
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
517
517
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -598,7 +598,7 @@ var StructuralCommitPrototype = {
|
|
|
598
598
|
...StructuralPrototype
|
|
599
599
|
};
|
|
600
600
|
|
|
601
|
-
// node_modules/.pnpm/effect@3.
|
|
601
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/option.js
|
|
602
602
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
603
603
|
var CommonProto = {
|
|
604
604
|
...EffectPrototype,
|
|
@@ -656,7 +656,7 @@ var some = (value) => {
|
|
|
656
656
|
return a;
|
|
657
657
|
};
|
|
658
658
|
|
|
659
|
-
// node_modules/.pnpm/effect@3.
|
|
659
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/either.js
|
|
660
660
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
661
661
|
var CommonProto2 = {
|
|
662
662
|
...EffectPrototype,
|
|
@@ -718,7 +718,7 @@ var right = (right3) => {
|
|
|
718
718
|
return a;
|
|
719
719
|
};
|
|
720
720
|
|
|
721
|
-
// node_modules/.pnpm/effect@3.
|
|
721
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Either.js
|
|
722
722
|
var right2 = right;
|
|
723
723
|
var left2 = left;
|
|
724
724
|
var isLeft2 = isLeft;
|
|
@@ -726,14 +726,14 @@ var isRight2 = isRight;
|
|
|
726
726
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
727
727
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
728
728
|
|
|
729
|
-
// node_modules/.pnpm/effect@3.
|
|
729
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/array.js
|
|
730
730
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
731
731
|
|
|
732
|
-
// node_modules/.pnpm/effect@3.
|
|
732
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Order.js
|
|
733
733
|
var make = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
734
734
|
var string2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
|
|
735
735
|
|
|
736
|
-
// node_modules/.pnpm/effect@3.
|
|
736
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Option.js
|
|
737
737
|
var none2 = () => none;
|
|
738
738
|
var some2 = some;
|
|
739
739
|
var isNone2 = isNone;
|
|
@@ -741,7 +741,7 @@ var isSome2 = isSome;
|
|
|
741
741
|
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
742
742
|
var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
|
|
743
743
|
|
|
744
|
-
// node_modules/.pnpm/effect@3.
|
|
744
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Record.js
|
|
745
745
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
746
746
|
const out = {
|
|
747
747
|
...self
|
|
@@ -753,7 +753,7 @@ var map2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
753
753
|
});
|
|
754
754
|
var keys = (self) => Object.keys(self);
|
|
755
755
|
|
|
756
|
-
// node_modules/.pnpm/effect@3.
|
|
756
|
+
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Array.js
|
|
757
757
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
758
758
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
759
759
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -1155,6 +1155,9 @@ var all = fn("all")(
|
|
|
1155
1155
|
|
|
1156
1156
|
// src/core/LanguageServicePluginOptions.ts
|
|
1157
1157
|
var LanguageServicePluginOptions = Tag("PluginOptions");
|
|
1158
|
+
function isValidSeverityLevel(value) {
|
|
1159
|
+
return value === "off" || value === "error" || value === "warning" || value === "message" || value === "suggestion";
|
|
1160
|
+
}
|
|
1158
1161
|
function parseDiagnosticSeverity(config) {
|
|
1159
1162
|
if (!isRecord(config)) return {};
|
|
1160
1163
|
return Object.fromEntries(
|
|
@@ -1162,9 +1165,7 @@ function parseDiagnosticSeverity(config) {
|
|
|
1162
1165
|
Object.entries(config),
|
|
1163
1166
|
filter(([key, value]) => isString(key) && isString(value)),
|
|
1164
1167
|
map3(([key, value]) => [String(key).toLowerCase(), String(value).toLowerCase()]),
|
|
1165
|
-
filter(
|
|
1166
|
-
([_, value]) => value === "off" || value === "error" || value === "warning" || value === "message" || value === "suggestion"
|
|
1167
|
-
)
|
|
1168
|
+
filter(([_, value]) => isValidSeverityLevel(value))
|
|
1168
1169
|
)
|
|
1169
1170
|
);
|
|
1170
1171
|
}
|
|
@@ -1173,6 +1174,7 @@ var defaults = {
|
|
|
1173
1174
|
diagnostics: true,
|
|
1174
1175
|
diagnosticSeverity: {},
|
|
1175
1176
|
diagnosticsName: true,
|
|
1177
|
+
missingDiagnosticNextLine: "warning",
|
|
1176
1178
|
quickinfo: true,
|
|
1177
1179
|
quickinfoEffectParameters: "whentruncated",
|
|
1178
1180
|
quickinfoMaximumLength: -1,
|
|
@@ -1215,6 +1217,7 @@ function parse(config) {
|
|
|
1215
1217
|
diagnostics: isObject(config) && hasProperty(config, "diagnostics") && isBoolean(config.diagnostics) ? config.diagnostics : defaults.diagnostics,
|
|
1216
1218
|
diagnosticSeverity: isObject(config) && hasProperty(config, "diagnosticSeverity") && isRecord(config.diagnosticSeverity) ? parseDiagnosticSeverity(config.diagnosticSeverity) : defaults.diagnosticSeverity,
|
|
1217
1219
|
diagnosticsName: isObject(config) && hasProperty(config, "diagnosticsName") && isBoolean(config.diagnosticsName) ? config.diagnosticsName : defaults.diagnosticsName,
|
|
1220
|
+
missingDiagnosticNextLine: isObject(config) && hasProperty(config, "missingDiagnosticNextLine") && isString(config.missingDiagnosticNextLine) && isValidSeverityLevel(config.missingDiagnosticNextLine) ? config.missingDiagnosticNextLine : defaults.missingDiagnosticNextLine,
|
|
1218
1221
|
quickinfo: isObject(config) && hasProperty(config, "quickinfo") && isBoolean(config.quickinfo) ? config.quickinfo : defaults.quickinfo,
|
|
1219
1222
|
quickinfoEffectParameters: isObject(config) && hasProperty(config, "quickinfoEffectParameters") && isString(config.quickinfoEffectParameters) && ["always", "never", "whentruncated"].includes(config.quickinfoEffectParameters.toLowerCase()) ? config.quickinfoEffectParameters.toLowerCase() : defaults.quickinfoEffectParameters,
|
|
1220
1223
|
quickinfoMaximumLength: isObject(config) && hasProperty(config, "quickinfoMaximumLength") && isNumber(config.quickinfoMaximumLength) ? config.quickinfoMaximumLength : defaults.quickinfoMaximumLength,
|
|
@@ -1888,7 +1891,8 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1888
1891
|
lineOverrides[ruleName].unshift({
|
|
1889
1892
|
pos: foundNode.node.pos,
|
|
1890
1893
|
end: foundNode.node.end,
|
|
1891
|
-
level: ruleLevel
|
|
1894
|
+
level: ruleLevel,
|
|
1895
|
+
commentRange: foundNode.commentRange
|
|
1892
1896
|
});
|
|
1893
1897
|
}
|
|
1894
1898
|
} else {
|
|
@@ -1961,6 +1965,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1961
1965
|
fixes: entry.fixes.concat(node ? [fixByDisableNextLine(node)] : []).concat([fixByDisableEntireFile])
|
|
1962
1966
|
});
|
|
1963
1967
|
});
|
|
1968
|
+
const unusedLineOverrides = new Set(lineOverrides[ruleNameLowered] || []);
|
|
1964
1969
|
for (const emitted of applicableDiagnostics.slice(0)) {
|
|
1965
1970
|
let newLevel = defaultLevel;
|
|
1966
1971
|
const lineOverride = (lineOverrides[ruleNameLowered] || []).find(
|
|
@@ -1968,6 +1973,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1968
1973
|
);
|
|
1969
1974
|
if (lineOverride) {
|
|
1970
1975
|
newLevel = lineOverride.level;
|
|
1976
|
+
unusedLineOverrides.delete(lineOverride);
|
|
1971
1977
|
} else {
|
|
1972
1978
|
const sectionOverride = (sectionOverrides[ruleNameLowered] || []).find((_) => _.pos < emitted.range.pos);
|
|
1973
1979
|
if (sectionOverride) newLevel = sectionOverride.level;
|
|
@@ -1991,6 +1997,19 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1991
1997
|
});
|
|
1992
1998
|
}
|
|
1993
1999
|
}
|
|
2000
|
+
if (pluginOptions.missingDiagnosticNextLine !== "off" && unusedLineOverrides.size > 0) {
|
|
2001
|
+
for (const unusedLineOverride of unusedLineOverrides) {
|
|
2002
|
+
diagnostics2.push({
|
|
2003
|
+
file: sourceFile,
|
|
2004
|
+
start: unusedLineOverride.commentRange.pos,
|
|
2005
|
+
length: unusedLineOverride.commentRange.end - unusedLineOverride.commentRange.pos,
|
|
2006
|
+
messageText: `@effect-diagnostics-next-line ${rule.name}:${unusedLineOverride.level} has no effect, make sure you are suppressing the right rule.`,
|
|
2007
|
+
category: levelToDiagnosticCategory[pluginOptions.missingDiagnosticNextLine],
|
|
2008
|
+
code: -1,
|
|
2009
|
+
source: "effect"
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
1994
2013
|
return { diagnostics: diagnostics2, codeFixes };
|
|
1995
2014
|
});
|
|
1996
2015
|
return { execute };
|
|
@@ -4044,6 +4063,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
4044
4063
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
4045
4064
|
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
4046
4065
|
const typeParser = yield* service(TypeParser);
|
|
4066
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
4047
4067
|
const parseLeakedRequirements = cachedBy(
|
|
4048
4068
|
fn("leakingServices.checkServiceLeaking")(
|
|
4049
4069
|
function* (service2, atLocation) {
|
|
@@ -4101,7 +4121,21 @@ var leakingRequirements = createDiagnostic({
|
|
|
4101
4121
|
}
|
|
4102
4122
|
}
|
|
4103
4123
|
if (sharedRequirementsKeys && sharedRequirementsKeys.length > 0 && effectMembers >= 2) {
|
|
4104
|
-
return sharedRequirementsKeys.map((key) => memory.get(key))
|
|
4124
|
+
return sharedRequirementsKeys.map((key) => memory.get(key)).filter(
|
|
4125
|
+
(type) => {
|
|
4126
|
+
let symbol3 = type.symbol;
|
|
4127
|
+
if (symbol3 && symbol3.flags & ts.SymbolFlags.Alias) {
|
|
4128
|
+
symbol3 = typeChecker.getAliasedSymbol(symbol3);
|
|
4129
|
+
}
|
|
4130
|
+
return !(symbol3.declarations || []).some((declaration) => {
|
|
4131
|
+
const declarationSource = tsUtils.getSourceFileOfNode(declaration);
|
|
4132
|
+
if (!declarationSource) return false;
|
|
4133
|
+
return declarationSource.text.substring(declaration.pos, declaration.end).toLowerCase().indexOf(
|
|
4134
|
+
"@effect-leakable-service"
|
|
4135
|
+
) > -1;
|
|
4136
|
+
});
|
|
4137
|
+
}
|
|
4138
|
+
);
|
|
4105
4139
|
}
|
|
4106
4140
|
return [];
|
|
4107
4141
|
}
|
|
@@ -4114,7 +4148,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
4114
4148
|
report({
|
|
4115
4149
|
location: node,
|
|
4116
4150
|
messageText: `This Service is leaking the ${requirements.map((_) => typeChecker.typeToString(_)).join(" | ")} requirement.
|
|
4117
|
-
If these requirements cannot be cached and are expected to be provided per method invocation (e.g. HttpServerRequest), you can safely disable this diagnostic for this line through quickfixes.
|
|
4151
|
+
If these requirements cannot be cached and are expected to be provided per method invocation (e.g. HttpServerRequest), you can either safely disable this diagnostic for this line through quickfixes or mark the service declaration with a JSDoc @effect-leakable-service.
|
|
4118
4152
|
More info at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage`,
|
|
4119
4153
|
fixes: []
|
|
4120
4154
|
});
|
|
@@ -5140,17 +5174,67 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
5140
5174
|
const members = node.members;
|
|
5141
5175
|
for (const member of members) {
|
|
5142
5176
|
if (ts.isConstructorDeclaration(member)) {
|
|
5177
|
+
const fixAsStaticNew = {
|
|
5178
|
+
fixName: "overriddenSchemaConstructor_static",
|
|
5179
|
+
description: "Rewrite using the static 'new' pattern",
|
|
5180
|
+
apply: gen(function* () {
|
|
5181
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
5182
|
+
const visitor = (node2) => {
|
|
5183
|
+
if (ts.isExpressionStatement(node2) && ts.isCallExpression(node2.expression) && ts.isToken(node2.expression.expression) && node2.expression.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
5184
|
+
const constructThis = ts.factory.createNewExpression(
|
|
5185
|
+
ts.factory.createIdentifier("this"),
|
|
5186
|
+
void 0,
|
|
5187
|
+
node2.expression.arguments
|
|
5188
|
+
);
|
|
5189
|
+
return ts.factory.createVariableStatement(
|
|
5190
|
+
void 0,
|
|
5191
|
+
ts.factory.createVariableDeclarationList(
|
|
5192
|
+
[ts.factory.createVariableDeclaration(
|
|
5193
|
+
"_this",
|
|
5194
|
+
void 0,
|
|
5195
|
+
void 0,
|
|
5196
|
+
constructThis
|
|
5197
|
+
)],
|
|
5198
|
+
ts.NodeFlags.Const
|
|
5199
|
+
)
|
|
5200
|
+
);
|
|
5201
|
+
}
|
|
5202
|
+
if (ts.isToken(node2) && node2.kind === ts.SyntaxKind.ThisKeyword) {
|
|
5203
|
+
return ts.factory.createIdentifier("_this");
|
|
5204
|
+
}
|
|
5205
|
+
return ts.visitEachChild(node2, visitor, ts.nullTransformationContext);
|
|
5206
|
+
};
|
|
5207
|
+
const newBody = visitor(member.body);
|
|
5208
|
+
const bodyWithReturn = ts.factory.updateBlock(
|
|
5209
|
+
newBody,
|
|
5210
|
+
newBody.statements.concat([
|
|
5211
|
+
ts.factory.createReturnStatement(ts.factory.createIdentifier("_this"))
|
|
5212
|
+
])
|
|
5213
|
+
);
|
|
5214
|
+
const newMethod = ts.factory.createMethodDeclaration(
|
|
5215
|
+
ts.factory.createModifiersFromModifierFlags(ts.ModifierFlags.Public | ts.ModifierFlags.Static),
|
|
5216
|
+
void 0,
|
|
5217
|
+
"new",
|
|
5218
|
+
void 0,
|
|
5219
|
+
member.typeParameters,
|
|
5220
|
+
member.parameters,
|
|
5221
|
+
member.type,
|
|
5222
|
+
bodyWithReturn
|
|
5223
|
+
);
|
|
5224
|
+
changeTracker.replaceNode(sourceFile, member, newMethod);
|
|
5225
|
+
})
|
|
5226
|
+
};
|
|
5143
5227
|
report({
|
|
5144
5228
|
location: member,
|
|
5145
|
-
messageText: "Classes extending Schema must not override the constructor",
|
|
5146
|
-
fixes: [{
|
|
5229
|
+
messageText: "Classes extending Schema must not override the constructor; this is because it silently breaks the schema decoding behaviour. If that's needed, we recommend instead to use a static 'new' method that constructs the instance.",
|
|
5230
|
+
fixes: (member.body ? [fixAsStaticNew] : []).concat([{
|
|
5147
5231
|
fixName: "overriddenSchemaConstructor_fix",
|
|
5148
5232
|
description: "Remove the constructor override",
|
|
5149
5233
|
apply: gen(function* () {
|
|
5150
5234
|
const changeTracker = yield* service(ChangeTracker);
|
|
5151
5235
|
changeTracker.delete(sourceFile, member);
|
|
5152
5236
|
})
|
|
5153
|
-
}]
|
|
5237
|
+
}])
|
|
5154
5238
|
});
|
|
5155
5239
|
break;
|
|
5156
5240
|
}
|