@eslint-react/core 5.2.3-next.2 → 5.2.4-next.0
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 +8 -8
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ function isAPI(api) {
|
|
|
145
145
|
const func = (context, node) => {
|
|
146
146
|
if (node == null) return false;
|
|
147
147
|
const getText = (n) => context.sourceCode.getText(n);
|
|
148
|
-
const name = Extract.
|
|
148
|
+
const name = Extract.getFullyQualifiedName(node, getText);
|
|
149
149
|
if (name === api) return true;
|
|
150
150
|
if (name.endsWith(`.${api}`)) return true;
|
|
151
151
|
return false;
|
|
@@ -161,7 +161,7 @@ function isAPICall(api) {
|
|
|
161
161
|
const func = (context, node) => {
|
|
162
162
|
if (node == null) return false;
|
|
163
163
|
if (node.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
164
|
-
return isAPI(api)(context, Extract.
|
|
164
|
+
return isAPI(api)(context, Extract.unwrap(node.callee));
|
|
165
165
|
};
|
|
166
166
|
return dual(2, func);
|
|
167
167
|
}
|
|
@@ -375,7 +375,7 @@ function isThisSetStateCall(node) {
|
|
|
375
375
|
*/
|
|
376
376
|
function isAssignmentToThisState(node) {
|
|
377
377
|
const { left } = node;
|
|
378
|
-
return left.type === AST_NODE_TYPES.MemberExpression && left.object.type === AST_NODE_TYPES.ThisExpression && Extract.
|
|
378
|
+
return left.type === AST_NODE_TYPES.MemberExpression && left.object.type === AST_NODE_TYPES.ThisExpression && Extract.getPropertyName(left.property) === "state";
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
//#endregion
|
|
@@ -394,7 +394,7 @@ function getClassComponentCollector(context) {
|
|
|
394
394
|
if (!isClassComponent(node)) return;
|
|
395
395
|
const id = getClassId(node);
|
|
396
396
|
const key = ulid();
|
|
397
|
-
const name = id == null ? null : Extract.
|
|
397
|
+
const name = id == null ? null : Extract.getFullyQualifiedName(id, getText);
|
|
398
398
|
components.set(key, {
|
|
399
399
|
id,
|
|
400
400
|
key,
|
|
@@ -811,7 +811,7 @@ function isUseStateLikeCall(node, additionalStateHooks = { test: constFalse }) {
|
|
|
811
811
|
if (node.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
812
812
|
switch (true) {
|
|
813
813
|
case node.callee.type === AST_NODE_TYPES.Identifier: return node.callee.name === "useState" || additionalStateHooks.test(node.callee.name);
|
|
814
|
-
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier: return Extract.
|
|
814
|
+
case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier: return Extract.getPropertyName(node.callee.property) === "useState" || additionalStateHooks.test(node.callee.property.name);
|
|
815
815
|
}
|
|
816
816
|
return false;
|
|
817
817
|
}
|
|
@@ -853,9 +853,9 @@ function getFunctionComponentCollector(context, options = {}) {
|
|
|
853
853
|
const key = ulid();
|
|
854
854
|
const exp = Traverse.findParent(node, (n) => n.type === AST_NODE_TYPES.ExportDefaultDeclaration);
|
|
855
855
|
const isExportDefault = exp != null;
|
|
856
|
-
const isExportDefaultDeclaration = exp != null && Extract.
|
|
856
|
+
const isExportDefaultDeclaration = exp != null && Extract.unwrap(exp.declaration) === node;
|
|
857
857
|
const id = getFunctionComponentId(context, node);
|
|
858
|
-
const name = id == null ? null : Extract.
|
|
858
|
+
const name = id == null ? null : Extract.getFullyQualifiedName(id, getText);
|
|
859
859
|
const initPath = getFunctionInitPath(node);
|
|
860
860
|
const directives = getFunctionDirectives(node);
|
|
861
861
|
const entry = {
|
|
@@ -947,7 +947,7 @@ function getHookCollector(context) {
|
|
|
947
947
|
id,
|
|
948
948
|
key,
|
|
949
949
|
kind: "hook",
|
|
950
|
-
name: id == null ? null : Extract.
|
|
950
|
+
name: id == null ? null : Extract.getFullyQualifiedName(id, getText),
|
|
951
951
|
directives: [],
|
|
952
952
|
flag: 0n,
|
|
953
953
|
hint: 0n,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.4-next.0",
|
|
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": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.58.2",
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
37
|
"ulid": "^3.0.2",
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/jsx": "5.2.
|
|
41
|
-
"@eslint-react/shared": "5.2.
|
|
42
|
-
"@eslint-react/var": "5.2.
|
|
38
|
+
"@eslint-react/ast": "5.2.4-next.0",
|
|
39
|
+
"@eslint-react/eslint": "5.2.4-next.0",
|
|
40
|
+
"@eslint-react/jsx": "5.2.4-next.0",
|
|
41
|
+
"@eslint-react/shared": "5.2.4-next.0",
|
|
42
|
+
"@eslint-react/var": "5.2.4-next.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@typescript-eslint/typescript-estree": "^8.58.2",
|