@eslint-react/core 5.21.1 → 5.21.3
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/dist/index.js +6 -5
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -217,7 +217,7 @@ function isPureComponent(node) {
|
|
|
217
217
|
return false;
|
|
218
218
|
}
|
|
219
219
|
function createLifecycleChecker(methodName, isStatic = false) {
|
|
220
|
-
return (node) => Check.isPropertyOrMethod(node) && node.static === isStatic && Check.isIdentifier(node.key
|
|
220
|
+
return (node) => Check.isPropertyOrMethod(node) && node.static === isStatic && Check.isIdentifier(node.key, methodName);
|
|
221
221
|
}
|
|
222
222
|
/** @deprecated Class components are legacy. */
|
|
223
223
|
const isRender = createLifecycleChecker("render");
|
|
@@ -408,7 +408,7 @@ function isCreateElementChildrenArgument(context, node) {
|
|
|
408
408
|
function isInsideCreateElementProps(context, node) {
|
|
409
409
|
const call = Traverse.findParent(node, isCreateElementCall(context));
|
|
410
410
|
if (call == null) return false;
|
|
411
|
-
const prop = Traverse.findParent(node, Check.
|
|
411
|
+
const prop = Traverse.findParent(node, Check.isObjectExpression);
|
|
412
412
|
if (prop == null) return false;
|
|
413
413
|
return prop === call.arguments[1];
|
|
414
414
|
}
|
|
@@ -1446,7 +1446,7 @@ function isUseEffectSetupCallback(node) {
|
|
|
1446
1446
|
function isUseEffectCleanupCallback(node) {
|
|
1447
1447
|
if (node == null) return false;
|
|
1448
1448
|
const expr = Extract.unwrap(node);
|
|
1449
|
-
const returnStatement = Traverse.findParent(expr, Check.
|
|
1449
|
+
const returnStatement = Traverse.findParent(expr, Check.isReturnStatement);
|
|
1450
1450
|
const enclosingFunction = Traverse.findParent(expr, Check.isFunction);
|
|
1451
1451
|
if (enclosingFunction !== Traverse.findParent(returnStatement, Check.isFunction)) return false;
|
|
1452
1452
|
return isUseEffectSetupCallback(enclosingFunction);
|
|
@@ -1565,6 +1565,7 @@ function getHookCollector(context) {
|
|
|
1565
1565
|
const hooks = /* @__PURE__ */ new Map();
|
|
1566
1566
|
const getText = (n) => context.sourceCode.getText(n);
|
|
1567
1567
|
const getCurrentEntry = () => functionEntries.at(-1) ?? null;
|
|
1568
|
+
const getCurrentHookEntry = () => functionEntries.findLast((entry) => entry.isHookDefinition) ?? null;
|
|
1568
1569
|
const onFunctionEnter = (node) => {
|
|
1569
1570
|
const id = getFunctionId(node);
|
|
1570
1571
|
const entry = {
|
|
@@ -1603,7 +1604,7 @@ function getHookCollector(context) {
|
|
|
1603
1604
|
},
|
|
1604
1605
|
CallExpression(node) {
|
|
1605
1606
|
if (!isHookCall(node)) return;
|
|
1606
|
-
const entry =
|
|
1607
|
+
const entry = getCurrentHookEntry();
|
|
1607
1608
|
if (entry == null) return;
|
|
1608
1609
|
entry.hookCalls.push(node);
|
|
1609
1610
|
},
|
|
@@ -1614,7 +1615,7 @@ function getHookCollector(context) {
|
|
|
1614
1615
|
},
|
|
1615
1616
|
TaggedTemplateExpression(node) {
|
|
1616
1617
|
if (!isHookTag(node.tag)) return;
|
|
1617
|
-
const entry =
|
|
1618
|
+
const entry = getCurrentHookEntry();
|
|
1618
1619
|
if (entry == null) return;
|
|
1619
1620
|
entry.hookCalls.push(node);
|
|
1620
1621
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.21.
|
|
3
|
+
"version": "5.21.3",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint-react/ast": "5.21.
|
|
33
|
-
"@eslint-react/eslint": "5.21.
|
|
34
|
-
"@eslint-react/shared": "5.21.
|
|
35
|
-
"@eslint-react/var": "5.21.
|
|
32
|
+
"@eslint-react/ast": "5.21.3",
|
|
33
|
+
"@eslint-react/eslint": "5.21.3",
|
|
34
|
+
"@eslint-react/shared": "5.21.3",
|
|
35
|
+
"@eslint-react/var": "5.21.3",
|
|
36
36
|
"@typescript-eslint/scope-manager": "^8.70.1",
|
|
37
37
|
"@typescript-eslint/types": "^8.70.1",
|
|
38
38
|
"@typescript-eslint/utils": "^8.70.1",
|