@eslint-react/core 1.48.1 → 1.48.2-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.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -986,7 +986,7 @@ function isReactAPI(api) {
|
|
|
986
986
|
const func = (context, node) => {
|
|
987
987
|
if (node == null) return false;
|
|
988
988
|
const getText = (n) => context.sourceCode.getText(n);
|
|
989
|
-
const name = AST9__namespace.
|
|
989
|
+
const name = AST9__namespace.toString(node, getText);
|
|
990
990
|
if (name === api) return true;
|
|
991
991
|
if (name.substring(name.indexOf(".") + 1) === api) return true;
|
|
992
992
|
return false;
|
|
@@ -1036,7 +1036,7 @@ function isReactHookName(name) {
|
|
|
1036
1036
|
// src/hook/hook-is.ts
|
|
1037
1037
|
function isReactHook(node) {
|
|
1038
1038
|
if (node == null) return false;
|
|
1039
|
-
const id = AST9__namespace.
|
|
1039
|
+
const id = AST9__namespace.getFunctionId(node);
|
|
1040
1040
|
return id?.name != null && isReactHookName(id.name);
|
|
1041
1041
|
}
|
|
1042
1042
|
function isReactHookCall(node) {
|
|
@@ -1139,7 +1139,7 @@ function useHookCollector() {
|
|
|
1139
1139
|
const hooks = /* @__PURE__ */ new Map();
|
|
1140
1140
|
const functionEntries = [];
|
|
1141
1141
|
const onFunctionEnter = (node) => {
|
|
1142
|
-
const id = AST9__namespace.
|
|
1142
|
+
const id = AST9__namespace.getFunctionId(node);
|
|
1143
1143
|
const key = shared.getId();
|
|
1144
1144
|
const name = id?.name;
|
|
1145
1145
|
if (name != null && isReactHookName(name)) {
|
|
@@ -1632,7 +1632,7 @@ function isComponentWrapperCallLoose(context, node) {
|
|
|
1632
1632
|
|
|
1633
1633
|
// src/component/component-id.ts
|
|
1634
1634
|
function getFunctionComponentId(context, node) {
|
|
1635
|
-
const functionId = AST9__namespace.
|
|
1635
|
+
const functionId = AST9__namespace.getFunctionId(node);
|
|
1636
1636
|
if (functionId != null) {
|
|
1637
1637
|
return functionId;
|
|
1638
1638
|
}
|
|
@@ -1801,7 +1801,7 @@ function useComponentCollectorLegacy() {
|
|
|
1801
1801
|
if (!isClassComponent(node)) {
|
|
1802
1802
|
return;
|
|
1803
1803
|
}
|
|
1804
|
-
const id = AST9__namespace.
|
|
1804
|
+
const id = AST9__namespace.getClassId(node);
|
|
1805
1805
|
const key = shared.getId();
|
|
1806
1806
|
const flag = isPureComponent(node) ? ComponentFlag.PureComponent : ComponentFlag.None;
|
|
1807
1807
|
components.set(
|
|
@@ -1834,7 +1834,7 @@ var ComponentPhaseRelevance = birecord__default.default({
|
|
|
1834
1834
|
var isInversePhase = eff.dual(2, (a, b) => ComponentPhaseRelevance.get(a) === b);
|
|
1835
1835
|
function isRenderFunctionLoose(context, node) {
|
|
1836
1836
|
const { body, parent } = node;
|
|
1837
|
-
if (AST9__namespace.
|
|
1837
|
+
if (AST9__namespace.getFunctionId(node)?.name.startsWith("render")) {
|
|
1838
1838
|
return parent.type === types.AST_NODE_TYPES.JSXExpressionContainer && parent.parent.type === types.AST_NODE_TYPES.JSXAttribute && parent.parent.name.type === types.AST_NODE_TYPES.JSXIdentifier && parent.parent.name.name.startsWith("render");
|
|
1839
1839
|
}
|
|
1840
1840
|
return isJsxLike(
|
package/dist/index.mjs
CHANGED
|
@@ -960,7 +960,7 @@ function isReactAPI(api) {
|
|
|
960
960
|
const func = (context, node) => {
|
|
961
961
|
if (node == null) return false;
|
|
962
962
|
const getText = (n) => context.sourceCode.getText(n);
|
|
963
|
-
const name = AST9.
|
|
963
|
+
const name = AST9.toString(node, getText);
|
|
964
964
|
if (name === api) return true;
|
|
965
965
|
if (name.substring(name.indexOf(".") + 1) === api) return true;
|
|
966
966
|
return false;
|
|
@@ -1010,7 +1010,7 @@ function isReactHookName(name) {
|
|
|
1010
1010
|
// src/hook/hook-is.ts
|
|
1011
1011
|
function isReactHook(node) {
|
|
1012
1012
|
if (node == null) return false;
|
|
1013
|
-
const id = AST9.
|
|
1013
|
+
const id = AST9.getFunctionId(node);
|
|
1014
1014
|
return id?.name != null && isReactHookName(id.name);
|
|
1015
1015
|
}
|
|
1016
1016
|
function isReactHookCall(node) {
|
|
@@ -1113,7 +1113,7 @@ function useHookCollector() {
|
|
|
1113
1113
|
const hooks = /* @__PURE__ */ new Map();
|
|
1114
1114
|
const functionEntries = [];
|
|
1115
1115
|
const onFunctionEnter = (node) => {
|
|
1116
|
-
const id = AST9.
|
|
1116
|
+
const id = AST9.getFunctionId(node);
|
|
1117
1117
|
const key = getId();
|
|
1118
1118
|
const name = id?.name;
|
|
1119
1119
|
if (name != null && isReactHookName(name)) {
|
|
@@ -1606,7 +1606,7 @@ function isComponentWrapperCallLoose(context, node) {
|
|
|
1606
1606
|
|
|
1607
1607
|
// src/component/component-id.ts
|
|
1608
1608
|
function getFunctionComponentId(context, node) {
|
|
1609
|
-
const functionId = AST9.
|
|
1609
|
+
const functionId = AST9.getFunctionId(node);
|
|
1610
1610
|
if (functionId != null) {
|
|
1611
1611
|
return functionId;
|
|
1612
1612
|
}
|
|
@@ -1775,7 +1775,7 @@ function useComponentCollectorLegacy() {
|
|
|
1775
1775
|
if (!isClassComponent(node)) {
|
|
1776
1776
|
return;
|
|
1777
1777
|
}
|
|
1778
|
-
const id = AST9.
|
|
1778
|
+
const id = AST9.getClassId(node);
|
|
1779
1779
|
const key = getId();
|
|
1780
1780
|
const flag = isPureComponent(node) ? ComponentFlag.PureComponent : ComponentFlag.None;
|
|
1781
1781
|
components.set(
|
|
@@ -1808,7 +1808,7 @@ var ComponentPhaseRelevance = birecord({
|
|
|
1808
1808
|
var isInversePhase = dual(2, (a, b) => ComponentPhaseRelevance.get(a) === b);
|
|
1809
1809
|
function isRenderFunctionLoose(context, node) {
|
|
1810
1810
|
const { body, parent } = node;
|
|
1811
|
-
if (AST9.
|
|
1811
|
+
if (AST9.getFunctionId(node)?.name.startsWith("render")) {
|
|
1812
1812
|
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");
|
|
1813
1813
|
}
|
|
1814
1814
|
return isJsxLike(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.2-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,11 +41,11 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.30.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/
|
|
44
|
+
"@eslint-react/eff": "1.48.2-beta.2",
|
|
45
|
+
"@eslint-react/var": "1.48.2-beta.2",
|
|
46
|
+
"@eslint-react/shared": "1.48.2-beta.2",
|
|
47
|
+
"@eslint-react/kit": "1.48.2-beta.2",
|
|
48
|
+
"@eslint-react/ast": "1.48.2-beta.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"tsup": "^8.4.0",
|