eslint-plugin-react-hooks 7.1.0-canary-b061b597-20251212 → 7.1.0-canary-88ee1f59-20251215
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.
|
@@ -32221,7 +32221,9 @@ const EnvironmentConfigSchema = v4.z.object({
|
|
|
32221
32221
|
enablePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
32222
32222
|
validatePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
32223
32223
|
validateExhaustiveMemoizationDependencies: v4.z.boolean().default(true),
|
|
32224
|
-
validateExhaustiveEffectDependencies: v4.z
|
|
32224
|
+
validateExhaustiveEffectDependencies: v4.z
|
|
32225
|
+
.enum(['off', 'all', 'missing-only', 'extra-only'])
|
|
32226
|
+
.default('off'),
|
|
32225
32227
|
enablePreserveExistingManualUseMemo: v4.z.boolean().default(false),
|
|
32226
32228
|
enableForest: v4.z.boolean().default(false),
|
|
32227
32229
|
enableUseTypeAnnotations: v4.z.boolean().default(false),
|
|
@@ -53621,7 +53623,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53621
53623
|
if (env.config.validateExhaustiveMemoizationDependencies) {
|
|
53622
53624
|
visitCandidateDependency(value.decl, temporaries, dependencies, locals);
|
|
53623
53625
|
const inferred = Array.from(dependencies);
|
|
53624
|
-
const diagnostic = validateDependencies(inferred, (_a = startMemo.deps) !== null && _a !== void 0 ? _a : [], reactive, startMemo.depsLoc, ErrorCategory.MemoDependencies);
|
|
53626
|
+
const diagnostic = validateDependencies(inferred, (_a = startMemo.deps) !== null && _a !== void 0 ? _a : [], reactive, startMemo.depsLoc, ErrorCategory.MemoDependencies, 'all');
|
|
53625
53627
|
if (diagnostic != null) {
|
|
53626
53628
|
error.pushDiagnostic(diagnostic);
|
|
53627
53629
|
}
|
|
@@ -53634,7 +53636,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53634
53636
|
onStartMemoize,
|
|
53635
53637
|
onFinishMemoize,
|
|
53636
53638
|
onEffect: (inferred, manual, manualMemoLoc) => {
|
|
53637
|
-
if (env.config.validateExhaustiveEffectDependencies ===
|
|
53639
|
+
if (env.config.validateExhaustiveEffectDependencies === 'off') {
|
|
53638
53640
|
return;
|
|
53639
53641
|
}
|
|
53640
53642
|
const manualDeps = [];
|
|
@@ -53667,7 +53669,10 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53667
53669
|
});
|
|
53668
53670
|
}
|
|
53669
53671
|
}
|
|
53670
|
-
const
|
|
53672
|
+
const effectReportMode = typeof env.config.validateExhaustiveEffectDependencies === 'string'
|
|
53673
|
+
? env.config.validateExhaustiveEffectDependencies
|
|
53674
|
+
: 'all';
|
|
53675
|
+
const diagnostic = validateDependencies(Array.from(inferred), manualDeps, reactive, manualMemoLoc, ErrorCategory.EffectExhaustiveDependencies, effectReportMode);
|
|
53671
53676
|
if (diagnostic != null) {
|
|
53672
53677
|
error.pushDiagnostic(diagnostic);
|
|
53673
53678
|
}
|
|
@@ -53675,7 +53680,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53675
53680
|
}, false);
|
|
53676
53681
|
return error.asResult();
|
|
53677
53682
|
}
|
|
53678
|
-
function validateDependencies(inferred, manualDependencies, reactive, manualMemoLoc, category) {
|
|
53683
|
+
function validateDependencies(inferred, manualDependencies, reactive, manualMemoLoc, category, exhaustiveDepsReportMode) {
|
|
53679
53684
|
var _a, _b, _c, _d;
|
|
53680
53685
|
inferred.sort((a, b) => {
|
|
53681
53686
|
var _a, _b;
|
|
@@ -53781,9 +53786,14 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53781
53786
|
}
|
|
53782
53787
|
extra.push(dep);
|
|
53783
53788
|
}
|
|
53784
|
-
|
|
53789
|
+
const filteredMissing = exhaustiveDepsReportMode === 'extra-only' ? [] : missing;
|
|
53790
|
+
const filteredExtra = exhaustiveDepsReportMode === 'missing-only' ? [] : extra;
|
|
53791
|
+
if (filteredMissing.length !== 0 || filteredExtra.length !== 0) {
|
|
53785
53792
|
let suggestion = null;
|
|
53786
|
-
if (manualMemoLoc != null &&
|
|
53793
|
+
if (manualMemoLoc != null &&
|
|
53794
|
+
typeof manualMemoLoc !== 'symbol' &&
|
|
53795
|
+
manualMemoLoc.start.index != null &&
|
|
53796
|
+
manualMemoLoc.end.index != null) {
|
|
53787
53797
|
suggestion = {
|
|
53788
53798
|
description: 'Update dependencies',
|
|
53789
53799
|
range: [manualMemoLoc.start.index, manualMemoLoc.end.index],
|
|
@@ -53796,8 +53806,8 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53796
53806
|
.join(', ')}]`,
|
|
53797
53807
|
};
|
|
53798
53808
|
}
|
|
53799
|
-
const diagnostic = createDiagnostic(category,
|
|
53800
|
-
for (const dep of
|
|
53809
|
+
const diagnostic = createDiagnostic(category, filteredMissing, filteredExtra, suggestion);
|
|
53810
|
+
for (const dep of filteredMissing) {
|
|
53801
53811
|
let reactiveStableValueHint = '';
|
|
53802
53812
|
if (isStableType(dep.identifier)) {
|
|
53803
53813
|
reactiveStableValueHint =
|
|
@@ -53810,7 +53820,7 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53810
53820
|
loc: dep.loc,
|
|
53811
53821
|
});
|
|
53812
53822
|
}
|
|
53813
|
-
for (const dep of
|
|
53823
|
+
for (const dep of filteredExtra) {
|
|
53814
53824
|
if (dep.root.kind === 'Global') {
|
|
53815
53825
|
diagnostic.withDetails({
|
|
53816
53826
|
kind: 'error',
|
|
@@ -56382,6 +56392,7 @@ const COMPILER_OPTIONS = {
|
|
|
56382
56392
|
validateNoDerivedComputationsInEffects: true,
|
|
56383
56393
|
enableUseKeyedState: true,
|
|
56384
56394
|
enableVerboseNoSetStateInEffect: true,
|
|
56395
|
+
validateExhaustiveEffectDependencies: 'extra-only',
|
|
56385
56396
|
},
|
|
56386
56397
|
};
|
|
56387
56398
|
const FLOW_SUPPRESSION_REGEX = /\$FlowFixMe\[([^\]]*)\]/g;
|
|
@@ -32048,7 +32048,9 @@ const EnvironmentConfigSchema = v4.z.object({
|
|
|
32048
32048
|
enablePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
32049
32049
|
validatePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
32050
32050
|
validateExhaustiveMemoizationDependencies: v4.z.boolean().default(true),
|
|
32051
|
-
validateExhaustiveEffectDependencies: v4.z
|
|
32051
|
+
validateExhaustiveEffectDependencies: v4.z
|
|
32052
|
+
.enum(['off', 'all', 'missing-only', 'extra-only'])
|
|
32053
|
+
.default('off'),
|
|
32052
32054
|
enablePreserveExistingManualUseMemo: v4.z.boolean().default(false),
|
|
32053
32055
|
enableForest: v4.z.boolean().default(false),
|
|
32054
32056
|
enableUseTypeAnnotations: v4.z.boolean().default(false),
|
|
@@ -53448,7 +53450,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53448
53450
|
if (env.config.validateExhaustiveMemoizationDependencies) {
|
|
53449
53451
|
visitCandidateDependency(value.decl, temporaries, dependencies, locals);
|
|
53450
53452
|
const inferred = Array.from(dependencies);
|
|
53451
|
-
const diagnostic = validateDependencies(inferred, (_a = startMemo.deps) !== null && _a !== void 0 ? _a : [], reactive, startMemo.depsLoc, ErrorCategory.MemoDependencies);
|
|
53453
|
+
const diagnostic = validateDependencies(inferred, (_a = startMemo.deps) !== null && _a !== void 0 ? _a : [], reactive, startMemo.depsLoc, ErrorCategory.MemoDependencies, 'all');
|
|
53452
53454
|
if (diagnostic != null) {
|
|
53453
53455
|
error.pushDiagnostic(diagnostic);
|
|
53454
53456
|
}
|
|
@@ -53461,7 +53463,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53461
53463
|
onStartMemoize,
|
|
53462
53464
|
onFinishMemoize,
|
|
53463
53465
|
onEffect: (inferred, manual, manualMemoLoc) => {
|
|
53464
|
-
if (env.config.validateExhaustiveEffectDependencies ===
|
|
53466
|
+
if (env.config.validateExhaustiveEffectDependencies === 'off') {
|
|
53465
53467
|
return;
|
|
53466
53468
|
}
|
|
53467
53469
|
const manualDeps = [];
|
|
@@ -53494,7 +53496,10 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53494
53496
|
});
|
|
53495
53497
|
}
|
|
53496
53498
|
}
|
|
53497
|
-
const
|
|
53499
|
+
const effectReportMode = typeof env.config.validateExhaustiveEffectDependencies === 'string'
|
|
53500
|
+
? env.config.validateExhaustiveEffectDependencies
|
|
53501
|
+
: 'all';
|
|
53502
|
+
const diagnostic = validateDependencies(Array.from(inferred), manualDeps, reactive, manualMemoLoc, ErrorCategory.EffectExhaustiveDependencies, effectReportMode);
|
|
53498
53503
|
if (diagnostic != null) {
|
|
53499
53504
|
error.pushDiagnostic(diagnostic);
|
|
53500
53505
|
}
|
|
@@ -53502,7 +53507,7 @@ function validateExhaustiveDependencies(fn) {
|
|
|
53502
53507
|
}, false);
|
|
53503
53508
|
return error.asResult();
|
|
53504
53509
|
}
|
|
53505
|
-
function validateDependencies(inferred, manualDependencies, reactive, manualMemoLoc, category) {
|
|
53510
|
+
function validateDependencies(inferred, manualDependencies, reactive, manualMemoLoc, category, exhaustiveDepsReportMode) {
|
|
53506
53511
|
var _a, _b, _c, _d;
|
|
53507
53512
|
inferred.sort((a, b) => {
|
|
53508
53513
|
var _a, _b;
|
|
@@ -53608,9 +53613,14 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53608
53613
|
}
|
|
53609
53614
|
extra.push(dep);
|
|
53610
53615
|
}
|
|
53611
|
-
|
|
53616
|
+
const filteredMissing = exhaustiveDepsReportMode === 'extra-only' ? [] : missing;
|
|
53617
|
+
const filteredExtra = exhaustiveDepsReportMode === 'missing-only' ? [] : extra;
|
|
53618
|
+
if (filteredMissing.length !== 0 || filteredExtra.length !== 0) {
|
|
53612
53619
|
let suggestion = null;
|
|
53613
|
-
if (manualMemoLoc != null &&
|
|
53620
|
+
if (manualMemoLoc != null &&
|
|
53621
|
+
typeof manualMemoLoc !== 'symbol' &&
|
|
53622
|
+
manualMemoLoc.start.index != null &&
|
|
53623
|
+
manualMemoLoc.end.index != null) {
|
|
53614
53624
|
suggestion = {
|
|
53615
53625
|
description: 'Update dependencies',
|
|
53616
53626
|
range: [manualMemoLoc.start.index, manualMemoLoc.end.index],
|
|
@@ -53623,8 +53633,8 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53623
53633
|
.join(', ')}]`,
|
|
53624
53634
|
};
|
|
53625
53635
|
}
|
|
53626
|
-
const diagnostic = createDiagnostic(category,
|
|
53627
|
-
for (const dep of
|
|
53636
|
+
const diagnostic = createDiagnostic(category, filteredMissing, filteredExtra, suggestion);
|
|
53637
|
+
for (const dep of filteredMissing) {
|
|
53628
53638
|
let reactiveStableValueHint = '';
|
|
53629
53639
|
if (isStableType(dep.identifier)) {
|
|
53630
53640
|
reactiveStableValueHint =
|
|
@@ -53637,7 +53647,7 @@ function validateDependencies(inferred, manualDependencies, reactive, manualMemo
|
|
|
53637
53647
|
loc: dep.loc,
|
|
53638
53648
|
});
|
|
53639
53649
|
}
|
|
53640
|
-
for (const dep of
|
|
53650
|
+
for (const dep of filteredExtra) {
|
|
53641
53651
|
if (dep.root.kind === 'Global') {
|
|
53642
53652
|
diagnostic.withDetails({
|
|
53643
53653
|
kind: 'error',
|
|
@@ -56209,6 +56219,7 @@ const COMPILER_OPTIONS = {
|
|
|
56209
56219
|
validateNoDerivedComputationsInEffects: true,
|
|
56210
56220
|
enableUseKeyedState: true,
|
|
56211
56221
|
enableVerboseNoSetStateInEffect: true,
|
|
56222
|
+
validateExhaustiveEffectDependencies: 'extra-only',
|
|
56212
56223
|
},
|
|
56213
56224
|
};
|
|
56214
56225
|
const FLOW_SUPPRESSION_REGEX = /\$FlowFixMe\[([^\]]*)\]/g;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks",
|
|
3
3
|
"description": "ESLint rules for React Hooks",
|
|
4
|
-
"version": "7.1.0-canary-
|
|
4
|
+
"version": "7.1.0-canary-88ee1f59-20251215",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/facebook/react.git",
|