eslint-plugin-react-hooks 6.1.0-canary-2f0e7e57-20250715 → 6.1.0-canary-dffacc7b-20250717
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.
|
@@ -20852,6 +20852,7 @@ const BuiltInFireId = 'BuiltInFire';
|
|
|
20852
20852
|
const BuiltInFireFunctionId = 'BuiltInFireFunction';
|
|
20853
20853
|
const BuiltInUseEffectEventId = 'BuiltInUseEffectEvent';
|
|
20854
20854
|
const BuiltinEffectEventId = 'BuiltInEffectEventFunction';
|
|
20855
|
+
const BuiltInAutodepsId = 'BuiltInAutoDepsId';
|
|
20855
20856
|
const ReanimatedSharedValueId = 'ReanimatedSharedValueId';
|
|
20856
20857
|
const BUILTIN_SHAPES = new Map();
|
|
20857
20858
|
addObject(BUILTIN_SHAPES, BuiltInPropsId, [
|
|
@@ -24213,6 +24214,8 @@ function isReorderableExpression(builder, expr, allowLocalIdentifiers) {
|
|
|
24213
24214
|
}
|
|
24214
24215
|
}
|
|
24215
24216
|
}
|
|
24217
|
+
case 'TSAsExpression':
|
|
24218
|
+
case 'TSNonNullExpression':
|
|
24216
24219
|
case 'TypeCastExpression': {
|
|
24217
24220
|
return isReorderableExpression(builder, expr.get('expression'), allowLocalIdentifiers);
|
|
24218
24221
|
}
|
|
@@ -29676,6 +29679,7 @@ const REACT_APIS = [
|
|
|
29676
29679
|
returnValueKind: ValueKind.Frozen,
|
|
29677
29680
|
}, BuiltInUseEffectEventId),
|
|
29678
29681
|
],
|
|
29682
|
+
['AUTODEPS', addObject(DEFAULT_SHAPES, BuiltInAutodepsId, [])],
|
|
29679
29683
|
];
|
|
29680
29684
|
TYPED_GLOBALS.push([
|
|
29681
29685
|
'React',
|
|
@@ -45183,7 +45187,12 @@ function inferEffectDependencies(fn) {
|
|
|
45183
45187
|
else if (value.kind === 'CallExpression' ||
|
|
45184
45188
|
value.kind === 'MethodCall') {
|
|
45185
45189
|
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
45186
|
-
|
|
45190
|
+
const autodepsArgIndex = value.args.findIndex(arg => arg.kind === 'Identifier' &&
|
|
45191
|
+
arg.identifier.type.kind === 'Object' &&
|
|
45192
|
+
arg.identifier.type.shapeId === BuiltInAutodepsId);
|
|
45193
|
+
if (value.args.length > 1 &&
|
|
45194
|
+
autodepsArgIndex > 0 &&
|
|
45195
|
+
autodepFnLoads.has(callee.identifier.id) &&
|
|
45187
45196
|
value.args[0].kind === 'Identifier') {
|
|
45188
45197
|
const effectDeps = [];
|
|
45189
45198
|
const deps = {
|
|
@@ -45250,7 +45259,7 @@ function inferEffectDependencies(fn) {
|
|
|
45250
45259
|
effects: null,
|
|
45251
45260
|
},
|
|
45252
45261
|
});
|
|
45253
|
-
value.args
|
|
45262
|
+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
|
|
45254
45263
|
fn.env.inferredEffectLocations.add(callee.loc);
|
|
45255
45264
|
}
|
|
45256
45265
|
else if (loadGlobals.has(value.args[0].identifier.id)) {
|
|
@@ -45265,7 +45274,7 @@ function inferEffectDependencies(fn) {
|
|
|
45265
45274
|
effects: null,
|
|
45266
45275
|
},
|
|
45267
45276
|
});
|
|
45268
|
-
value.args
|
|
45277
|
+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
|
|
45269
45278
|
fn.env.inferredEffectLocations.add(callee.loc);
|
|
45270
45279
|
}
|
|
45271
45280
|
}
|
|
@@ -45299,6 +45308,7 @@ function inferEffectDependencies(fn) {
|
|
|
45299
45308
|
markPredecessors(fn.body);
|
|
45300
45309
|
markInstructionIds(fn.body);
|
|
45301
45310
|
fixScopeAndIdentifierRanges(fn.body);
|
|
45311
|
+
deadCodeElimination(fn);
|
|
45302
45312
|
fn.env.hasInferredEffect = true;
|
|
45303
45313
|
}
|
|
45304
45314
|
}
|
|
@@ -45335,7 +45345,7 @@ function rewriteSplices(originalBlock, splices, rewriteBlocks) {
|
|
|
45335
45345
|
if (rewrite.kind === 'instr') {
|
|
45336
45346
|
currBlock.instructions.push(rewrite.value);
|
|
45337
45347
|
}
|
|
45338
|
-
else {
|
|
45348
|
+
else if (rewrite.kind === 'block') {
|
|
45339
45349
|
const { entry, blocks } = rewrite.value;
|
|
45340
45350
|
const entryBlock = blocks.get(entry);
|
|
45341
45351
|
currBlock.instructions.push(...entryBlock.instructions);
|
|
@@ -20843,6 +20843,7 @@ const BuiltInFireId = 'BuiltInFire';
|
|
|
20843
20843
|
const BuiltInFireFunctionId = 'BuiltInFireFunction';
|
|
20844
20844
|
const BuiltInUseEffectEventId = 'BuiltInUseEffectEvent';
|
|
20845
20845
|
const BuiltinEffectEventId = 'BuiltInEffectEventFunction';
|
|
20846
|
+
const BuiltInAutodepsId = 'BuiltInAutoDepsId';
|
|
20846
20847
|
const ReanimatedSharedValueId = 'ReanimatedSharedValueId';
|
|
20847
20848
|
const BUILTIN_SHAPES = new Map();
|
|
20848
20849
|
addObject(BUILTIN_SHAPES, BuiltInPropsId, [
|
|
@@ -24204,6 +24205,8 @@ function isReorderableExpression(builder, expr, allowLocalIdentifiers) {
|
|
|
24204
24205
|
}
|
|
24205
24206
|
}
|
|
24206
24207
|
}
|
|
24208
|
+
case 'TSAsExpression':
|
|
24209
|
+
case 'TSNonNullExpression':
|
|
24207
24210
|
case 'TypeCastExpression': {
|
|
24208
24211
|
return isReorderableExpression(builder, expr.get('expression'), allowLocalIdentifiers);
|
|
24209
24212
|
}
|
|
@@ -29503,6 +29506,7 @@ const REACT_APIS = [
|
|
|
29503
29506
|
returnValueKind: ValueKind.Frozen,
|
|
29504
29507
|
}, BuiltInUseEffectEventId),
|
|
29505
29508
|
],
|
|
29509
|
+
['AUTODEPS', addObject(DEFAULT_SHAPES, BuiltInAutodepsId, [])],
|
|
29506
29510
|
];
|
|
29507
29511
|
TYPED_GLOBALS.push([
|
|
29508
29512
|
'React',
|
|
@@ -45010,7 +45014,12 @@ function inferEffectDependencies(fn) {
|
|
|
45010
45014
|
else if (value.kind === 'CallExpression' ||
|
|
45011
45015
|
value.kind === 'MethodCall') {
|
|
45012
45016
|
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
45013
|
-
|
|
45017
|
+
const autodepsArgIndex = value.args.findIndex(arg => arg.kind === 'Identifier' &&
|
|
45018
|
+
arg.identifier.type.kind === 'Object' &&
|
|
45019
|
+
arg.identifier.type.shapeId === BuiltInAutodepsId);
|
|
45020
|
+
if (value.args.length > 1 &&
|
|
45021
|
+
autodepsArgIndex > 0 &&
|
|
45022
|
+
autodepFnLoads.has(callee.identifier.id) &&
|
|
45014
45023
|
value.args[0].kind === 'Identifier') {
|
|
45015
45024
|
const effectDeps = [];
|
|
45016
45025
|
const deps = {
|
|
@@ -45077,7 +45086,7 @@ function inferEffectDependencies(fn) {
|
|
|
45077
45086
|
effects: null,
|
|
45078
45087
|
},
|
|
45079
45088
|
});
|
|
45080
|
-
value.args
|
|
45089
|
+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
|
|
45081
45090
|
fn.env.inferredEffectLocations.add(callee.loc);
|
|
45082
45091
|
}
|
|
45083
45092
|
else if (loadGlobals.has(value.args[0].identifier.id)) {
|
|
@@ -45092,7 +45101,7 @@ function inferEffectDependencies(fn) {
|
|
|
45092
45101
|
effects: null,
|
|
45093
45102
|
},
|
|
45094
45103
|
});
|
|
45095
|
-
value.args
|
|
45104
|
+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
|
|
45096
45105
|
fn.env.inferredEffectLocations.add(callee.loc);
|
|
45097
45106
|
}
|
|
45098
45107
|
}
|
|
@@ -45126,6 +45135,7 @@ function inferEffectDependencies(fn) {
|
|
|
45126
45135
|
markPredecessors(fn.body);
|
|
45127
45136
|
markInstructionIds(fn.body);
|
|
45128
45137
|
fixScopeAndIdentifierRanges(fn.body);
|
|
45138
|
+
deadCodeElimination(fn);
|
|
45129
45139
|
fn.env.hasInferredEffect = true;
|
|
45130
45140
|
}
|
|
45131
45141
|
}
|
|
@@ -45162,7 +45172,7 @@ function rewriteSplices(originalBlock, splices, rewriteBlocks) {
|
|
|
45162
45172
|
if (rewrite.kind === 'instr') {
|
|
45163
45173
|
currBlock.instructions.push(rewrite.value);
|
|
45164
45174
|
}
|
|
45165
|
-
else {
|
|
45175
|
+
else if (rewrite.kind === 'block') {
|
|
45166
45176
|
const { entry, blocks } = rewrite.value;
|
|
45167
45177
|
const entryBlock = blocks.get(entry);
|
|
45168
45178
|
currBlock.instructions.push(...entryBlock.instructions);
|
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": "6.1.0-canary-
|
|
4
|
+
"version": "6.1.0-canary-dffacc7b-20250717",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/facebook/react.git",
|