@eslint-react/core 1.46.1-next.0 → 1.47.0-beta.2
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.d.mts +179 -82
- package/dist/index.d.ts +179 -82
- package/dist/index.js +340 -94
- package/dist/index.mjs +324 -93
- package/package.json +6 -7
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { flip, dual, constFalse, identity, _ } from '@eslint-react/eff';
|
|
3
|
-
import * as JSX3 from '@eslint-react/jsx';
|
|
1
|
+
import * as AST8 from '@eslint-react/ast';
|
|
2
|
+
import { flip, dual, constFalse, identity, constTrue, _ } from '@eslint-react/eff';
|
|
4
3
|
import { RE, SEL } from '@eslint-react/kit';
|
|
5
4
|
import { DEFAULT_ESLINT_REACT_SETTINGS as DEFAULT_ESLINT_REACT_SETTINGS$1, unsafeDecodeSettings, getId } from '@eslint-react/shared';
|
|
6
5
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
|
-
import * as
|
|
6
|
+
import * as VAR3 from '@eslint-react/var';
|
|
8
7
|
import { isMatching, P, match } from 'ts-pattern';
|
|
9
8
|
import birecord from 'birecord';
|
|
10
9
|
|
|
@@ -1402,7 +1401,7 @@ function getRequireExpressionArguments(node) {
|
|
|
1402
1401
|
}
|
|
1403
1402
|
function isInitializedFromReact(name, importSource, initialScope) {
|
|
1404
1403
|
if (name.toLowerCase() === "react") return true;
|
|
1405
|
-
const latestDef =
|
|
1404
|
+
const latestDef = VAR3.findVariable(name, initialScope)?.defs.at(-1);
|
|
1406
1405
|
if (latestDef == null) return false;
|
|
1407
1406
|
const { node, parent } = latestDef;
|
|
1408
1407
|
if (node.type === AST_NODE_TYPES.VariableDeclarator && node.init != null) {
|
|
@@ -1415,7 +1414,7 @@ function isInitializedFromReact(name, importSource, initialScope) {
|
|
|
1415
1414
|
}
|
|
1416
1415
|
const args = getRequireExpressionArguments(init);
|
|
1417
1416
|
const arg0 = args?.[0];
|
|
1418
|
-
if (arg0 == null || !
|
|
1417
|
+
if (arg0 == null || !AST8.isLiteral(arg0, "string")) {
|
|
1419
1418
|
return false;
|
|
1420
1419
|
}
|
|
1421
1420
|
return arg0.value === importSource || arg0.value.startsWith(`${importSource}/`);
|
|
@@ -1480,7 +1479,7 @@ function isCallFromReactObject(objectName, propertyName) {
|
|
|
1480
1479
|
});
|
|
1481
1480
|
}
|
|
1482
1481
|
function isInstanceIdEqual(context, a, b) {
|
|
1483
|
-
return
|
|
1482
|
+
return AST8.isNodeEqual(a, b) || VAR3.isNodeValueEqual(a, b, [
|
|
1484
1483
|
context.sourceCode.getScope(a),
|
|
1485
1484
|
context.sourceCode.getScope(b)
|
|
1486
1485
|
]);
|
|
@@ -1525,10 +1524,10 @@ function isReactHookName(name) {
|
|
|
1525
1524
|
return name === "use" || /^use[A-Z0-9]/.test(name);
|
|
1526
1525
|
}
|
|
1527
1526
|
|
|
1528
|
-
// src/hook/is.ts
|
|
1527
|
+
// src/hook/hook-is.ts
|
|
1529
1528
|
function isReactHook(node) {
|
|
1530
1529
|
if (node == null) return false;
|
|
1531
|
-
const id =
|
|
1530
|
+
const id = AST8.getFunctionIdentifier(node);
|
|
1532
1531
|
return id?.name != null && isReactHookName(id.name);
|
|
1533
1532
|
}
|
|
1534
1533
|
function isReactHookCall(node) {
|
|
@@ -1626,23 +1625,12 @@ var isUseStateCall = flip(isReactHookCallWithName)("useState");
|
|
|
1626
1625
|
var isUseSyncExternalStoreCall = flip(isReactHookCallWithName)("useSyncExternalStore");
|
|
1627
1626
|
var isUseTransitionCall = flip(isReactHookCallWithName)("useTransition");
|
|
1628
1627
|
|
|
1629
|
-
// src/hook/
|
|
1630
|
-
function isFunctionOfUseEffectSetup(node) {
|
|
1631
|
-
if (node == null) return false;
|
|
1632
|
-
return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1633
|
-
}
|
|
1634
|
-
function isFunctionOfUseEffectCleanup(node) {
|
|
1635
|
-
if (node == null) return false;
|
|
1636
|
-
const returnStatement = AST6.findParentNode(node, AST6.is(AST_NODE_TYPES.ReturnStatement));
|
|
1637
|
-
const enclosingFunction = AST6.findParentNode(node, AST6.isFunction);
|
|
1638
|
-
const functionOfReturnStatement = AST6.findParentNode(returnStatement, AST6.isFunction);
|
|
1639
|
-
return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
|
|
1640
|
-
}
|
|
1628
|
+
// src/hook/hook-collector.ts
|
|
1641
1629
|
function useHookCollector() {
|
|
1642
1630
|
const hooks = /* @__PURE__ */ new Map();
|
|
1643
1631
|
const functionEntries = [];
|
|
1644
1632
|
const onFunctionEnter = (node) => {
|
|
1645
|
-
const id =
|
|
1633
|
+
const id = AST8.getFunctionIdentifier(node);
|
|
1646
1634
|
const key = getId();
|
|
1647
1635
|
const name = id?.name;
|
|
1648
1636
|
if (name != null && isReactHookName(name)) {
|
|
@@ -1690,11 +1678,256 @@ function useHookCollector() {
|
|
|
1690
1678
|
};
|
|
1691
1679
|
return { ctx, listeners };
|
|
1692
1680
|
}
|
|
1681
|
+
function isFunctionOfUseEffectSetup(node) {
|
|
1682
|
+
if (node == null) return false;
|
|
1683
|
+
return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
|
|
1684
|
+
}
|
|
1685
|
+
function isFunctionOfUseEffectCleanup(node) {
|
|
1686
|
+
if (node == null) return false;
|
|
1687
|
+
const returnStatement = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ReturnStatement));
|
|
1688
|
+
const enclosingFunction = AST8.findParentNode(node, AST8.isFunction);
|
|
1689
|
+
const functionOfReturnStatement = AST8.findParentNode(returnStatement, AST8.isFunction);
|
|
1690
|
+
return enclosingFunction === functionOfReturnStatement && isFunctionOfUseEffectSetup(enclosingFunction);
|
|
1691
|
+
}
|
|
1692
|
+
function stringifyJsx(node) {
|
|
1693
|
+
switch (node.type) {
|
|
1694
|
+
case AST_NODE_TYPES.JSXIdentifier:
|
|
1695
|
+
return node.name;
|
|
1696
|
+
case AST_NODE_TYPES.JSXNamespacedName:
|
|
1697
|
+
return `${node.namespace.name}:${node.name.name}`;
|
|
1698
|
+
case AST_NODE_TYPES.JSXMemberExpression:
|
|
1699
|
+
return `${stringifyJsx(node.object)}.${stringifyJsx(node.property)}`;
|
|
1700
|
+
case AST_NODE_TYPES.JSXText:
|
|
1701
|
+
return node.value;
|
|
1702
|
+
case AST_NODE_TYPES.JSXOpeningElement:
|
|
1703
|
+
return `<${stringifyJsx(node.name)}>`;
|
|
1704
|
+
case AST_NODE_TYPES.JSXClosingElement:
|
|
1705
|
+
return `</${stringifyJsx(node.name)}>`;
|
|
1706
|
+
case AST_NODE_TYPES.JSXOpeningFragment:
|
|
1707
|
+
return "<>";
|
|
1708
|
+
case AST_NODE_TYPES.JSXClosingFragment:
|
|
1709
|
+
return "</>";
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// src/jsx/jsx-attribute-name.ts
|
|
1714
|
+
function getAttributeName(context, node) {
|
|
1715
|
+
return stringifyJsx(node.name);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
// src/jsx/jsx-attribute.ts
|
|
1719
|
+
function getAttribute(context, name, attributes, initialScope) {
|
|
1720
|
+
return attributes.findLast((attr) => {
|
|
1721
|
+
if (attr.type === AST_NODE_TYPES.JSXAttribute) {
|
|
1722
|
+
return getAttributeName(context, attr) === name;
|
|
1723
|
+
}
|
|
1724
|
+
if (initialScope == null) return false;
|
|
1725
|
+
switch (attr.argument.type) {
|
|
1726
|
+
case AST_NODE_TYPES.Identifier: {
|
|
1727
|
+
const variable = VAR3.findVariable(attr.argument.name, initialScope);
|
|
1728
|
+
const variableNode = VAR3.getVariableInitNode(variable, 0);
|
|
1729
|
+
if (variableNode?.type === AST_NODE_TYPES.ObjectExpression) {
|
|
1730
|
+
return VAR3.findPropertyInProperties(name, variableNode.properties, initialScope) != null;
|
|
1731
|
+
}
|
|
1732
|
+
return false;
|
|
1733
|
+
}
|
|
1734
|
+
case AST_NODE_TYPES.ObjectExpression:
|
|
1735
|
+
return VAR3.findPropertyInProperties(name, attr.argument.properties, initialScope) != null;
|
|
1736
|
+
}
|
|
1737
|
+
return false;
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
function getAttributeValue(context, node, name) {
|
|
1741
|
+
const initialScope = context.sourceCode.getScope(node);
|
|
1742
|
+
switch (node.type) {
|
|
1743
|
+
case AST_NODE_TYPES.JSXAttribute:
|
|
1744
|
+
if (node.value?.type === AST_NODE_TYPES.Literal) {
|
|
1745
|
+
return {
|
|
1746
|
+
kind: "some",
|
|
1747
|
+
node: node.value,
|
|
1748
|
+
initialScope,
|
|
1749
|
+
value: node.value.value
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
if (node.value?.type === AST_NODE_TYPES.JSXExpressionContainer) {
|
|
1753
|
+
return VAR3.toStaticValue({
|
|
1754
|
+
kind: "lazy",
|
|
1755
|
+
node: node.value.expression,
|
|
1756
|
+
initialScope
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
return { kind: "none", node, initialScope };
|
|
1760
|
+
case AST_NODE_TYPES.JSXSpreadAttribute: {
|
|
1761
|
+
const staticValue = VAR3.toStaticValue({
|
|
1762
|
+
kind: "lazy",
|
|
1763
|
+
node: node.argument,
|
|
1764
|
+
initialScope
|
|
1765
|
+
});
|
|
1766
|
+
if (staticValue.kind === "none") {
|
|
1767
|
+
return staticValue;
|
|
1768
|
+
}
|
|
1769
|
+
return match(staticValue.value).with({ [name]: P.select(P.any) }, (value) => ({
|
|
1770
|
+
kind: "some",
|
|
1771
|
+
node: node.argument,
|
|
1772
|
+
initialScope,
|
|
1773
|
+
value
|
|
1774
|
+
})).otherwise(() => ({ kind: "none", node, initialScope }));
|
|
1775
|
+
}
|
|
1776
|
+
default:
|
|
1777
|
+
return { kind: "none", node, initialScope };
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
// src/jsx/jsx-detection-hint.ts
|
|
1782
|
+
var JSXDetectionHint = {
|
|
1783
|
+
None: 0n,
|
|
1784
|
+
SkipUndefined: 1n << 0n,
|
|
1785
|
+
SkipNullLiteral: 1n << 1n,
|
|
1786
|
+
SkipBooleanLiteral: 1n << 2n,
|
|
1787
|
+
SkipStringLiteral: 1n << 3n,
|
|
1788
|
+
SkipNumberLiteral: 1n << 4n,
|
|
1789
|
+
SkipBigIntLiteral: 1n << 5n,
|
|
1790
|
+
SkipEmptyArray: 1n << 6n,
|
|
1791
|
+
SkipCreateElement: 1n << 7n,
|
|
1792
|
+
StrictArray: 1n << 8n,
|
|
1793
|
+
StrictLogical: 1n << 9n,
|
|
1794
|
+
StrictConditional: 1n << 10n
|
|
1795
|
+
};
|
|
1796
|
+
var DEFAULT_JSX_DETECTION_HINT = 0n | JSXDetectionHint.SkipUndefined | JSXDetectionHint.SkipBooleanLiteral;
|
|
1797
|
+
|
|
1798
|
+
// src/jsx/jsx-detection.ts
|
|
1799
|
+
function isJsxText(node) {
|
|
1800
|
+
if (node == null) return false;
|
|
1801
|
+
return node.type === AST_NODE_TYPES.JSXText || node.type === AST_NODE_TYPES.Literal;
|
|
1802
|
+
}
|
|
1803
|
+
function isJsxLike(code, node, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
1804
|
+
if (node == null) return false;
|
|
1805
|
+
if (AST8.isJSX(node)) return true;
|
|
1806
|
+
switch (node.type) {
|
|
1807
|
+
case AST_NODE_TYPES.Literal: {
|
|
1808
|
+
switch (typeof node.value) {
|
|
1809
|
+
case "boolean":
|
|
1810
|
+
return !(hint & JSXDetectionHint.SkipBooleanLiteral);
|
|
1811
|
+
case "string":
|
|
1812
|
+
return !(hint & JSXDetectionHint.SkipStringLiteral);
|
|
1813
|
+
case "number":
|
|
1814
|
+
return !(hint & JSXDetectionHint.SkipNumberLiteral);
|
|
1815
|
+
case "bigint":
|
|
1816
|
+
return !(hint & JSXDetectionHint.SkipBigIntLiteral);
|
|
1817
|
+
}
|
|
1818
|
+
if (node.value == null) {
|
|
1819
|
+
return !(hint & JSXDetectionHint.SkipNullLiteral);
|
|
1820
|
+
}
|
|
1821
|
+
return false;
|
|
1822
|
+
}
|
|
1823
|
+
case AST_NODE_TYPES.TemplateLiteral: {
|
|
1824
|
+
return !(hint & JSXDetectionHint.SkipStringLiteral);
|
|
1825
|
+
}
|
|
1826
|
+
case AST_NODE_TYPES.ArrayExpression: {
|
|
1827
|
+
if (hint & JSXDetectionHint.StrictArray) {
|
|
1828
|
+
return node.elements.every((n) => isJsxLike(code, n, hint));
|
|
1829
|
+
}
|
|
1830
|
+
return node.elements.some((n) => isJsxLike(code, n, hint));
|
|
1831
|
+
}
|
|
1832
|
+
case AST_NODE_TYPES.LogicalExpression: {
|
|
1833
|
+
if (hint & JSXDetectionHint.StrictLogical) {
|
|
1834
|
+
return isJsxLike(code, node.left, hint) && isJsxLike(code, node.right, hint);
|
|
1835
|
+
}
|
|
1836
|
+
return isJsxLike(code, node.left, hint) || isJsxLike(code, node.right, hint);
|
|
1837
|
+
}
|
|
1838
|
+
case AST_NODE_TYPES.ConditionalExpression: {
|
|
1839
|
+
let leftHasJSX2 = function(node2) {
|
|
1840
|
+
if (Array.isArray(node2.consequent)) {
|
|
1841
|
+
if (node2.consequent.length === 0) {
|
|
1842
|
+
return !(hint & JSXDetectionHint.SkipEmptyArray);
|
|
1843
|
+
}
|
|
1844
|
+
if (hint & JSXDetectionHint.StrictArray) {
|
|
1845
|
+
return node2.consequent.every((n) => isJsxLike(code, n, hint));
|
|
1846
|
+
}
|
|
1847
|
+
return node2.consequent.some((n) => isJsxLike(code, n, hint));
|
|
1848
|
+
}
|
|
1849
|
+
return isJsxLike(code, node2.consequent, hint);
|
|
1850
|
+
}, rightHasJSX2 = function(node2) {
|
|
1851
|
+
return isJsxLike(code, node2.alternate, hint);
|
|
1852
|
+
};
|
|
1853
|
+
if (hint & JSXDetectionHint.StrictConditional) {
|
|
1854
|
+
return leftHasJSX2(node) && rightHasJSX2(node);
|
|
1855
|
+
}
|
|
1856
|
+
return leftHasJSX2(node) || rightHasJSX2(node);
|
|
1857
|
+
}
|
|
1858
|
+
case AST_NODE_TYPES.SequenceExpression: {
|
|
1859
|
+
const exp = node.expressions.at(-1);
|
|
1860
|
+
return isJsxLike(code, exp, hint);
|
|
1861
|
+
}
|
|
1862
|
+
case AST_NODE_TYPES.CallExpression: {
|
|
1863
|
+
if (hint & JSXDetectionHint.SkipCreateElement) {
|
|
1864
|
+
return false;
|
|
1865
|
+
}
|
|
1866
|
+
switch (node.callee.type) {
|
|
1867
|
+
case AST_NODE_TYPES.Identifier:
|
|
1868
|
+
return node.callee.name === "createElement";
|
|
1869
|
+
case AST_NODE_TYPES.MemberExpression:
|
|
1870
|
+
return node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "createElement";
|
|
1871
|
+
}
|
|
1872
|
+
return false;
|
|
1873
|
+
}
|
|
1874
|
+
case AST_NODE_TYPES.Identifier: {
|
|
1875
|
+
const { name } = node;
|
|
1876
|
+
if (name === "undefined") {
|
|
1877
|
+
return !(hint & JSXDetectionHint.SkipUndefined);
|
|
1878
|
+
}
|
|
1879
|
+
if (AST8.isJSXTagNameExpression(node)) {
|
|
1880
|
+
return true;
|
|
1881
|
+
}
|
|
1882
|
+
const variable = VAR3.findVariable(name, code.getScope(node));
|
|
1883
|
+
const variableNode = variable && VAR3.getVariableInitNode(variable, 0);
|
|
1884
|
+
return !!variableNode && isJsxLike(code, variableNode, hint);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
return false;
|
|
1888
|
+
}
|
|
1889
|
+
function getElementType(context, node) {
|
|
1890
|
+
if (node.type === AST_NODE_TYPES.JSXFragment) {
|
|
1891
|
+
return "";
|
|
1892
|
+
}
|
|
1893
|
+
return stringifyJsx(node.openingElement.name);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// src/jsx/jsx-has.ts
|
|
1897
|
+
function hasAttribute(context, name, attributes, initialScope) {
|
|
1898
|
+
return getAttribute(context, name, attributes, initialScope) != null;
|
|
1899
|
+
}
|
|
1900
|
+
function hasAnyAttribute(context, names, attributes, initialScope) {
|
|
1901
|
+
return names.some((n) => hasAttribute(context, n, attributes, initialScope));
|
|
1902
|
+
}
|
|
1903
|
+
function hasEveryAttribute(context, names, attributes, initialScope) {
|
|
1904
|
+
return names.every((n) => hasAttribute(context, n, attributes, initialScope));
|
|
1905
|
+
}
|
|
1906
|
+
function findParentAttribute(node, test = constTrue) {
|
|
1907
|
+
const guard = (node2) => {
|
|
1908
|
+
return node2.type === AST_NODE_TYPES.JSXAttribute && test(node2);
|
|
1909
|
+
};
|
|
1910
|
+
return AST8.findParentNode(node, guard);
|
|
1911
|
+
}
|
|
1912
|
+
function isHostElement(context, node) {
|
|
1913
|
+
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
1914
|
+
}
|
|
1915
|
+
function isKeyedElement(context, node, initialScope) {
|
|
1916
|
+
return node.type === AST_NODE_TYPES.JSXElement && hasAttribute(context, "key", node.openingElement.attributes, initialScope);
|
|
1917
|
+
}
|
|
1918
|
+
function isFragmentElement(context, node, allowJSXFragment = false) {
|
|
1919
|
+
if (node == null) return false;
|
|
1920
|
+
if (node.type !== AST_NODE_TYPES.JSXElement && node.type !== AST_NODE_TYPES.JSXFragment) return false;
|
|
1921
|
+
if (node.type === AST_NODE_TYPES.JSXFragment) return allowJSXFragment;
|
|
1922
|
+
return getElementType(context, node).split(".").at(-1) === "Fragment";
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
// src/component/component-detection-hint.ts
|
|
1693
1926
|
var ComponentDetectionHint = {
|
|
1694
1927
|
/**
|
|
1695
1928
|
* 1n << 0n - 1n << 63n are reserved for JSXDetectionHint
|
|
1696
1929
|
*/
|
|
1697
|
-
...
|
|
1930
|
+
...JSXDetectionHint,
|
|
1698
1931
|
/**
|
|
1699
1932
|
* Skip function component created by React.memo
|
|
1700
1933
|
*/
|
|
@@ -1721,85 +1954,83 @@ var ComponentDetectionHint = {
|
|
|
1721
1954
|
SkipClassProperty: 1n << 69n
|
|
1722
1955
|
};
|
|
1723
1956
|
var DEFAULT_COMPONENT_DETECTION_HINT = 0n | ComponentDetectionHint.SkipBooleanLiteral | ComponentDetectionHint.SkipEmptyArray | ComponentDetectionHint.SkipArrayMapArgument | ComponentDetectionHint.SkipNumberLiteral | ComponentDetectionHint.SkipStringLiteral | ComponentDetectionHint.SkipUndefined | ComponentDetectionHint.StrictArray | ComponentDetectionHint.StrictConditional | ComponentDetectionHint.StrictLogical;
|
|
1957
|
+
function isClassComponent(node) {
|
|
1958
|
+
if ("superClass" in node && node.superClass != null) {
|
|
1959
|
+
const re = /^(?:Pure)?Component$/u;
|
|
1960
|
+
switch (true) {
|
|
1961
|
+
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
1962
|
+
return re.test(node.superClass.name);
|
|
1963
|
+
case (node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier):
|
|
1964
|
+
return re.test(node.superClass.property.name);
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
function isPureComponent(node) {
|
|
1970
|
+
if ("superClass" in node && node.superClass != null) {
|
|
1971
|
+
const re = /^PureComponent$/u;
|
|
1972
|
+
switch (true) {
|
|
1973
|
+
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
1974
|
+
return re.test(node.superClass.name);
|
|
1975
|
+
case (node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier):
|
|
1976
|
+
return re.test(node.superClass.property.name);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
return false;
|
|
1980
|
+
}
|
|
1724
1981
|
function isComponentDidCatch(node) {
|
|
1725
|
-
return
|
|
1982
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
|
|
1726
1983
|
}
|
|
1727
1984
|
function isComponentDidMount(node) {
|
|
1728
|
-
return
|
|
1985
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1729
1986
|
}
|
|
1730
1987
|
function isComponentDidUpdate(node) {
|
|
1731
|
-
return
|
|
1988
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1732
1989
|
}
|
|
1733
1990
|
function isComponentWillMount(node) {
|
|
1734
|
-
return
|
|
1991
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
1735
1992
|
}
|
|
1736
1993
|
function isComponentWillReceiveProps(node) {
|
|
1737
|
-
return
|
|
1994
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
1738
1995
|
}
|
|
1739
1996
|
function isComponentWillUnmount(node) {
|
|
1740
|
-
return
|
|
1997
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUnmount";
|
|
1741
1998
|
}
|
|
1742
1999
|
function isComponentWillUpdate(node) {
|
|
1743
|
-
return
|
|
2000
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1744
2001
|
}
|
|
1745
2002
|
function isGetChildContext(node) {
|
|
1746
|
-
return
|
|
2003
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getChildContext";
|
|
1747
2004
|
}
|
|
1748
2005
|
function isGetDefaultProps(node) {
|
|
1749
|
-
return
|
|
2006
|
+
return AST8.isMethodOrProperty(node) && node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getDefaultProps";
|
|
1750
2007
|
}
|
|
1751
2008
|
function isGetInitialState(node) {
|
|
1752
|
-
return
|
|
2009
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getInitialState";
|
|
1753
2010
|
}
|
|
1754
2011
|
function isGetSnapshotBeforeUpdate(node) {
|
|
1755
|
-
return
|
|
2012
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getSnapshotBeforeUpdate";
|
|
1756
2013
|
}
|
|
1757
2014
|
function isShouldComponentUpdate(node) {
|
|
1758
|
-
return
|
|
2015
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1759
2016
|
}
|
|
1760
2017
|
function isUnsafeComponentWillMount(node) {
|
|
1761
|
-
return
|
|
2018
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
|
|
1762
2019
|
}
|
|
1763
2020
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
1764
|
-
return
|
|
2021
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
|
|
1765
2022
|
}
|
|
1766
2023
|
function isUnsafeComponentWillUpdate(node) {
|
|
1767
|
-
return
|
|
2024
|
+
return AST8.isMethodOrProperty(node) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
|
|
1768
2025
|
}
|
|
1769
2026
|
function isGetDerivedStateFromProps(node) {
|
|
1770
|
-
return
|
|
2027
|
+
return AST8.isMethodOrProperty(node) && node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromProps";
|
|
1771
2028
|
}
|
|
1772
2029
|
function isGetDerivedStateFromError(node) {
|
|
1773
|
-
return
|
|
2030
|
+
return AST8.isMethodOrProperty(node) && node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
|
|
1774
2031
|
}
|
|
1775
|
-
function isClassComponent(node) {
|
|
1776
|
-
if ("superClass" in node && node.superClass != null) {
|
|
1777
|
-
const re = /^(?:Pure)?Component$/u;
|
|
1778
|
-
switch (true) {
|
|
1779
|
-
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
1780
|
-
return re.test(node.superClass.name);
|
|
1781
|
-
case (node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier):
|
|
1782
|
-
return re.test(node.superClass.property.name);
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
return false;
|
|
1786
|
-
}
|
|
1787
|
-
function isPureComponent(node) {
|
|
1788
|
-
if ("superClass" in node && node.superClass != null) {
|
|
1789
|
-
const re = /^PureComponent$/u;
|
|
1790
|
-
switch (true) {
|
|
1791
|
-
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
1792
|
-
return re.test(node.superClass.name);
|
|
1793
|
-
case (node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier):
|
|
1794
|
-
return re.test(node.superClass.property.name);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return false;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
// src/component/component-render.ts
|
|
1801
2032
|
function isRenderLike(node) {
|
|
1802
|
-
return
|
|
2033
|
+
return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "render" && node.parent.parent.type === AST_NODE_TYPES.ClassDeclaration;
|
|
1803
2034
|
}
|
|
1804
2035
|
function isFunctionOfRender(node) {
|
|
1805
2036
|
if (!isRenderLike(node.parent)) {
|
|
@@ -1808,10 +2039,10 @@ function isFunctionOfRender(node) {
|
|
|
1808
2039
|
return isClassComponent(node.parent.parent.parent);
|
|
1809
2040
|
}
|
|
1810
2041
|
function isRenderMethodLike(node) {
|
|
1811
|
-
return
|
|
2042
|
+
return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name.startsWith("render") && node.parent.parent.type === AST_NODE_TYPES.ClassDeclaration;
|
|
1812
2043
|
}
|
|
1813
2044
|
|
|
1814
|
-
// src/component/hierarchy.ts
|
|
2045
|
+
// src/component/component-hierarchy.ts
|
|
1815
2046
|
function isChildrenOfCreateElement(context, node) {
|
|
1816
2047
|
const parent = node.parent;
|
|
1817
2048
|
if (parent == null || parent.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
@@ -1819,13 +2050,13 @@ function isChildrenOfCreateElement(context, node) {
|
|
|
1819
2050
|
return parent.arguments.slice(2).some((arg) => arg === node);
|
|
1820
2051
|
}
|
|
1821
2052
|
function isInsideRenderMethod(node) {
|
|
1822
|
-
return
|
|
2053
|
+
return AST8.findParentNode(node, (n) => isRenderLike(n) && isClassComponent(n.parent.parent)) != null;
|
|
1823
2054
|
}
|
|
1824
2055
|
function isFunctionOfComponentDidMount(node) {
|
|
1825
|
-
return
|
|
2056
|
+
return AST8.isFunction(node) && isComponentDidMount(node.parent) && node.parent.value === node;
|
|
1826
2057
|
}
|
|
1827
2058
|
function isFunctionOfComponentWillUnmount(node) {
|
|
1828
|
-
return
|
|
2059
|
+
return AST8.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
|
|
1829
2060
|
}
|
|
1830
2061
|
function isFunctionOfRenderMethod(node) {
|
|
1831
2062
|
if (!isRenderMethodLike(node.parent)) {
|
|
@@ -1865,12 +2096,12 @@ function isValidComponentDefinition(context, node, hint) {
|
|
|
1865
2096
|
if (hint & ComponentDetectionHint.SkipClassProperty && isFunctionOfClassProperty(node.parent)) {
|
|
1866
2097
|
return false;
|
|
1867
2098
|
}
|
|
1868
|
-
if (hint & ComponentDetectionHint.SkipArrayMapArgument &&
|
|
2099
|
+
if (hint & ComponentDetectionHint.SkipArrayMapArgument && AST8.isArrayMapCall(node.parent)) {
|
|
1869
2100
|
return false;
|
|
1870
2101
|
}
|
|
1871
|
-
const significantParent =
|
|
2102
|
+
const significantParent = AST8.findParentNode(
|
|
1872
2103
|
node,
|
|
1873
|
-
|
|
2104
|
+
AST8.isOneOf([
|
|
1874
2105
|
AST_NODE_TYPES.JSXExpressionContainer,
|
|
1875
2106
|
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
1876
2107
|
AST_NODE_TYPES.FunctionExpression,
|
|
@@ -1891,7 +2122,7 @@ function isComponentWrapperCallLoose(context, node) {
|
|
|
1891
2122
|
|
|
1892
2123
|
// src/component/component-id.ts
|
|
1893
2124
|
function getFunctionComponentId(context, node) {
|
|
1894
|
-
const functionId =
|
|
2125
|
+
const functionId = AST8.getFunctionIdentifier(node);
|
|
1895
2126
|
if (functionId != null) {
|
|
1896
2127
|
return functionId;
|
|
1897
2128
|
}
|
|
@@ -1918,10 +2149,10 @@ var ComponentFlag = {
|
|
|
1918
2149
|
// src/component/component-init-path.ts
|
|
1919
2150
|
function getComponentFlagFromInitPath(initPath) {
|
|
1920
2151
|
let flag = ComponentFlag.None;
|
|
1921
|
-
if (initPath != null &&
|
|
2152
|
+
if (initPath != null && AST8.hasCallInFunctionInitPath("memo", initPath)) {
|
|
1922
2153
|
flag |= ComponentFlag.Memo;
|
|
1923
2154
|
}
|
|
1924
|
-
if (initPath != null &&
|
|
2155
|
+
if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef", initPath)) {
|
|
1925
2156
|
flag |= ComponentFlag.ForwardRef;
|
|
1926
2157
|
}
|
|
1927
2158
|
return flag;
|
|
@@ -1961,8 +2192,8 @@ function useComponentCollector(context, options = {}) {
|
|
|
1961
2192
|
const entry = functionEntries.at(-1);
|
|
1962
2193
|
if (entry == null) return;
|
|
1963
2194
|
if (!entry.isComponent) return functionEntries.pop();
|
|
1964
|
-
const shouldDrop =
|
|
1965
|
-
return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !
|
|
2195
|
+
const shouldDrop = AST8.getNestedReturnStatements(entry.node.body).slice().reverse().some((r) => {
|
|
2196
|
+
return context.sourceCode.getScope(r).block === entry.node && r.argument != null && !isJsxLike(context.sourceCode, r.argument, hint);
|
|
1966
2197
|
});
|
|
1967
2198
|
if (shouldDrop) {
|
|
1968
2199
|
components.delete(entry.key);
|
|
@@ -1986,9 +2217,9 @@ function useComponentCollector(context, options = {}) {
|
|
|
1986
2217
|
const entry = getCurrentEntry();
|
|
1987
2218
|
if (entry == null) return;
|
|
1988
2219
|
const { body } = entry.node;
|
|
1989
|
-
const isComponent = hasNoneOrLooseComponentName(context, entry.node) &&
|
|
2220
|
+
const isComponent = hasNoneOrLooseComponentName(context, entry.node) && isJsxLike(context.sourceCode, body, hint) && isValidComponentDefinition(context, entry.node, hint);
|
|
1990
2221
|
if (!isComponent) return;
|
|
1991
|
-
const initPath =
|
|
2222
|
+
const initPath = AST8.getFunctionInitPath(entry.node);
|
|
1992
2223
|
const id = getFunctionComponentId(context, entry.node);
|
|
1993
2224
|
const name = getComponentNameFromId(id);
|
|
1994
2225
|
const key = getId();
|
|
@@ -2026,10 +2257,10 @@ function useComponentCollector(context, options = {}) {
|
|
|
2026
2257
|
"ReturnStatement[type]"(node) {
|
|
2027
2258
|
const entry = getCurrentEntry();
|
|
2028
2259
|
if (entry == null) return;
|
|
2029
|
-
const isComponent = hasNoneOrLooseComponentName(context, entry.node) &&
|
|
2260
|
+
const isComponent = hasNoneOrLooseComponentName(context, entry.node) && isJsxLike(context.sourceCode, node.argument, hint) && isValidComponentDefinition(context, entry.node, hint);
|
|
2030
2261
|
if (!isComponent) return;
|
|
2031
2262
|
entry.isComponent = true;
|
|
2032
|
-
const initPath =
|
|
2263
|
+
const initPath = AST8.getFunctionInitPath(entry.node);
|
|
2033
2264
|
const id = getFunctionComponentId(context, entry.node);
|
|
2034
2265
|
const name = getComponentNameFromId(id);
|
|
2035
2266
|
components.set(entry.key, {
|
|
@@ -2060,7 +2291,7 @@ function useComponentCollectorLegacy() {
|
|
|
2060
2291
|
if (!isClassComponent(node)) {
|
|
2061
2292
|
return;
|
|
2062
2293
|
}
|
|
2063
|
-
const id =
|
|
2294
|
+
const id = AST8.getClassIdentifier(node);
|
|
2064
2295
|
const key = getId();
|
|
2065
2296
|
const flag = isPureComponent(node) ? ComponentFlag.PureComponent : ComponentFlag.None;
|
|
2066
2297
|
components.set(
|
|
@@ -2093,20 +2324,20 @@ var ComponentPhaseRelevance = birecord({
|
|
|
2093
2324
|
var isInversePhase = dual(2, (a, b) => ComponentPhaseRelevance.get(a) === b);
|
|
2094
2325
|
function isRenderFunctionLoose(context, node) {
|
|
2095
2326
|
const { body, parent } = node;
|
|
2096
|
-
if (
|
|
2327
|
+
if (AST8.getFunctionIdentifier(node)?.name.startsWith("render")) {
|
|
2097
2328
|
return parent.type === AST_NODE_TYPES.JSXExpressionContainer && parent.parent.type === AST_NODE_TYPES.JSXAttribute && parent.parent.name.type === AST_NODE_TYPES.JSXIdentifier && parent.parent.name.name.startsWith("render");
|
|
2098
2329
|
}
|
|
2099
|
-
return
|
|
2330
|
+
return isJsxLike(
|
|
2100
2331
|
context.sourceCode,
|
|
2101
2332
|
body,
|
|
2102
|
-
|
|
2333
|
+
JSXDetectionHint.SkipNullLiteral | JSXDetectionHint.SkipUndefined | JSXDetectionHint.StrictLogical | JSXDetectionHint.StrictConditional
|
|
2103
2334
|
);
|
|
2104
2335
|
}
|
|
2105
2336
|
function isRenderPropLoose(context, node) {
|
|
2106
2337
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier) {
|
|
2107
2338
|
return false;
|
|
2108
2339
|
}
|
|
2109
|
-
return node.name.name.startsWith("render") && node.value?.type === AST_NODE_TYPES.JSXExpressionContainer &&
|
|
2340
|
+
return node.name.name.startsWith("render") && node.value?.type === AST_NODE_TYPES.JSXExpressionContainer && AST8.isFunction(node.value.expression) && isRenderFunctionLoose(context, node.value.expression);
|
|
2110
2341
|
}
|
|
2111
2342
|
function isDirectValueOfRenderPropertyLoose(node) {
|
|
2112
2343
|
const matching = (node2) => {
|
|
@@ -2118,7 +2349,7 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
2118
2349
|
if (isDirectValueOfRenderPropertyLoose(node)) {
|
|
2119
2350
|
return true;
|
|
2120
2351
|
}
|
|
2121
|
-
const parent =
|
|
2352
|
+
const parent = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.JSXExpressionContainer))?.parent;
|
|
2122
2353
|
if (parent?.type !== AST_NODE_TYPES.JSXAttribute) {
|
|
2123
2354
|
return false;
|
|
2124
2355
|
}
|
|
@@ -2126,11 +2357,11 @@ function isDeclaredInRenderPropLoose(node) {
|
|
|
2126
2357
|
}
|
|
2127
2358
|
function isThisSetState(node) {
|
|
2128
2359
|
const { callee } = node;
|
|
2129
|
-
return callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
2360
|
+
return callee.type === AST_NODE_TYPES.MemberExpression && AST8.isThisExpression(callee.object) && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "setState";
|
|
2130
2361
|
}
|
|
2131
2362
|
function isAssignmentToThisState(node) {
|
|
2132
2363
|
const { left } = node;
|
|
2133
|
-
return left.type === AST_NODE_TYPES.MemberExpression &&
|
|
2364
|
+
return left.type === AST_NODE_TYPES.MemberExpression && AST8.isThisExpression(left.object) && AST8.getPropertyName(left.property) === "state";
|
|
2134
2365
|
}
|
|
2135
2366
|
|
|
2136
|
-
export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, getComponentFlagFromInitPath, getComponentNameFromId, getFunctionComponentId, getInstanceId, hasNoneOrLooseComponentName, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRender, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
|
2367
|
+
export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getComponentFlagFromInitPath, getComponentNameFromId, getElementType, getFunctionComponentId, getInstanceId, hasAnyAttribute, hasAttribute, hasEveryAttribute, hasNoneOrLooseComponentName, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFragmentElement, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRender, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHostElement, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isJsxLike, isJsxText, isKeyedElement, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderLike, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, isValidComponentDefinition, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0-beta.2",
|
|
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": {
|
|
@@ -41,12 +41,11 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.29.1",
|
|
42
42
|
"birecord": "^0.1.1",
|
|
43
43
|
"ts-pattern": "^5.7.0",
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/var": "1.46.1-next.0"
|
|
44
|
+
"@eslint-react/kit": "1.47.0-beta.2",
|
|
45
|
+
"@eslint-react/shared": "1.47.0-beta.2",
|
|
46
|
+
"@eslint-react/ast": "1.47.0-beta.2",
|
|
47
|
+
"@eslint-react/eff": "1.47.0-beta.2",
|
|
48
|
+
"@eslint-react/var": "1.47.0-beta.2"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"tsup": "^8.4.0",
|