eslint-plugin-react-hooks-extra 2.0.0-beta.175 → 2.0.0-beta.176
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 +3 -5
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const rules = { "react-hooks-extra/no-direct-set-state-in-use-effect": "warn" };
|
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region package.json
|
|
32
32
|
var name = "eslint-plugin-react-hooks-extra";
|
|
33
|
-
var version = "2.0.0-beta.
|
|
33
|
+
var version = "2.0.0-beta.176";
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/utils/create-rule.ts
|
|
@@ -127,16 +127,14 @@ function create(context) {
|
|
|
127
127
|
const [index] = node.callee.arguments;
|
|
128
128
|
if (!isAt || index == null) return false;
|
|
129
129
|
const indexScope = context.sourceCode.getScope(node);
|
|
130
|
-
|
|
131
|
-
return indexValue === 1 && isIdFromUseStateCall(callee.object);
|
|
130
|
+
return getStaticValue(index, indexScope)?.value === 1 && isIdFromUseStateCall(callee.object);
|
|
132
131
|
}
|
|
133
132
|
case AST_NODE_TYPES.Identifier: return isIdFromUseStateCall(node.callee, 1);
|
|
134
133
|
case AST_NODE_TYPES.MemberExpression: {
|
|
135
134
|
if (!("name" in node.callee.object)) return false;
|
|
136
135
|
const property = node.callee.property;
|
|
137
136
|
const propertyScope = context.sourceCode.getScope(node);
|
|
138
|
-
|
|
139
|
-
return propertyValue === 1 && isIdFromUseStateCall(node.callee.object, 1);
|
|
137
|
+
return getStaticValue(property, propertyScope)?.value === 1 && isIdFromUseStateCall(node.callee.object, 1);
|
|
140
138
|
}
|
|
141
139
|
default: return false;
|
|
142
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.176",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"./package.json"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
40
|
-
"@typescript-eslint/type-utils": "^8.
|
|
41
|
-
"@typescript-eslint/types": "^8.
|
|
42
|
-
"@typescript-eslint/utils": "^8.
|
|
39
|
+
"@typescript-eslint/scope-manager": "^8.43.0",
|
|
40
|
+
"@typescript-eslint/type-utils": "^8.43.0",
|
|
41
|
+
"@typescript-eslint/types": "^8.43.0",
|
|
42
|
+
"@typescript-eslint/utils": "^8.43.0",
|
|
43
43
|
"string-ts": "^2.2.1",
|
|
44
44
|
"ts-pattern": "^5.8.0",
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/eff": "2.0.0-beta.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/var": "2.0.0-beta.
|
|
45
|
+
"@eslint-react/ast": "2.0.0-beta.176",
|
|
46
|
+
"@eslint-react/core": "2.0.0-beta.176",
|
|
47
|
+
"@eslint-react/eff": "2.0.0-beta.176",
|
|
48
|
+
"@eslint-react/kit": "2.0.0-beta.176",
|
|
49
|
+
"@eslint-react/shared": "2.0.0-beta.176",
|
|
50
|
+
"@eslint-react/var": "2.0.0-beta.176"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.1.12",
|