141
reactive,
142
startMemo.depsLoc,
143
ErrorCategory.MemoDependencies,
144
+ 'all',
145
);
146
if (diagnostic != null) {
147
error.pushDiagnostic(diagnostic);
160
onStartMemoize,
161
onFinishMemoize,
162
onEffect: (inferred, manual, manualMemoLoc) => {
162
- if (env.config.validateExhaustiveEffectDependencies === false) {
163
+ if (env.config.validateExhaustiveEffectDependencies === 'off') {
164
return;
165
}
166
if (DEBUG) {
196
});
197
}
198
}
199
+ const effectReportMode =
200
+ typeof env.config.validateExhaustiveEffectDependencies === 'string'
201
+ ? env.config.validateExhaustiveEffectDependencies
202
+ : 'all';
203
const diagnostic = validateDependencies(
204
Array.from(inferred),
205
manualDeps,
206
reactive,
207
manualMemoLoc,
208
ErrorCategory.EffectExhaustiveDependencies,
209
+ effectReportMode,
210
);
211
if (diagnostic != null) {
212
error.pushDiagnostic(diagnostic);
226
category:
227
| ErrorCategory.MemoDependencies
228
| ErrorCategory.EffectExhaustiveDependencies,
229
+ exhaustiveDepsReportMode: 'all' | 'missing-only' | 'extra-only',
230
): CompilerDiagnostic | null {
231
// Sort dependencies by name and path, with shorter/non-optional paths first
232
inferred.sort((a, b) => {
377
extra.push(dep);
378
}
379
373
- if (missing.length !== 0 || extra.length !== 0) {
380
+ // Filter based on report mode
381
+ const filteredMissing =
382
+ exhaustiveDepsReportMode === 'extra-only' ? [] : missing;
383
+ const filteredExtra =
384
+ exhaustiveDepsReportMode === 'missing-only' ? [] : extra;
385
+
386
+ if (filteredMissing.length !== 0 || filteredExtra.length !== 0) {
387
let suggestion: CompilerSuggestion | null = null;
375
- if (manualMemoLoc != null && typeof manualMemoLoc !== 'symbol') {
388
+ if (
389
+ manualMemoLoc != null &&
390
+ typeof manualMemoLoc !== 'symbol' &&
391
+ manualMemoLoc.start.index != null &&
392
+ manualMemoLoc.end.index != null
393
+ ) {
394
suggestion = {
395
description: 'Update dependencies',
396
range: [manualMemoLoc.start.index, manualMemoLoc.end.index],
406
.join(', ')}]`,
407
};
408
}
391
- const diagnostic = createDiagnostic(category, missing, extra, suggestion);
392
- for (const dep of missing) {
409
+ const diagnostic = createDiagnostic(
410
+ category,
411
+ filteredMissing,
412
+ filteredExtra,
413
+ suggestion,
414
+ );
415
+ for (const dep of filteredMissing) {
416
let reactiveStableValueHint = '';
417
if (isStableType(dep.identifier)) {
418
reactiveStableValueHint =
425
loc: dep.loc,
426
});
427
}
405
- for (const dep of extra) {
428
+ for (const dep of filteredExtra) {
429
if (dep.root.kind === 'Global') {
430
diagnostic.withDetails({
431
kind: 'error',