Skip to content

Commit 6308d51

Browse files
authored
release: 1.48.3-next.0
1 parent 2f896c9 commit 6308d51

File tree

23 files changed

+314
-166
lines changed

23 files changed

+314
-166
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.48.2
1+
1.48.3-next.0

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/monorepo",
3-
"version": "1.48.2",
3+
"version": "1.48.3-next.0",
44
"private": true,
55
"description": "Monorepo for eslint-plugin-react-[x, dom, web-api, hooks-extra, naming-convention].",
66
"keywords": [
@@ -66,7 +66,7 @@
6666
"@typescript-eslint/rule-tester": "^8.30.1",
6767
"@typescript-eslint/types": "^8.30.1",
6868
"ansis": "^3.17.0",
69-
"cspell": "^8.18.1",
69+
"cspell": "^8.19.0",
7070
"dedent": "^1.5.3",
7171
"dprint": "^0.49.1",
7272
"esbuild": "^0.25.2",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/core",
3-
"version": "1.48.2",
3+
"version": "1.48.3-next.0",
44
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
55
"homepage": "https://github.com/Rel1cx/eslint-react",
66
"bugs": {

packages/core/src/hook/hook-hierarchy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function isFunctionOfUseEffectSetup(node: TSESTree.Node | _) {
1616
export function isFunctionOfUseEffectCleanup(node: TSESTree.Node | _) {
1717
if (node == null) return false;
1818
const pReturn = AST.findParentNode(node, AST.is(T.ReturnStatement));
19-
const pFaunction = AST.findParentNode(node, AST.isFunction);
19+
const pFunction = AST.findParentNode(node, AST.isFunction); // Correctly named variable
2020
const pFunctionOfReturn = AST.findParentNode(pReturn, AST.isFunction);
21-
if (pFaunction !== pFunctionOfReturn) return false;
22-
return isFunctionOfUseEffectSetup(pFaunction);
21+
if (pFunction !== pFunctionOfReturn) return false; // Ensure consistent variable naming
22+
return isFunctionOfUseEffectSetup(pFunction);
2323
}

packages/plugins/eslint-plugin-react-debug/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-debug",
3-
"version": "1.48.2",
3+
"version": "1.48.3-next.0",
44
"description": "ESLint React's ESLint plugin for debugging related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-dom",
3-
"version": "1.48.2",
3+
"version": "1.48.3-next.0",
44
"description": "ESLint React's ESLint plugin for React DOM related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-hooks-extra/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react-hooks-extra",
3-
"version": "1.48.2",
3+
"version": "1.48.3-next.0",
44
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
55
"keywords": [
66
"react",

packages/plugins/eslint-plugin-react-hooks-extra/src/hooks/use-no-direct-set-state-in-use-effect.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(
4747
const { onViolation, useEffectKind } = options;
4848
const settings = getSettingsFromContext(context);
4949
const additionalHooks = settings.additionalHooks;
50+
const getText = (n: TSESTree.Node) => context.sourceCode.getText(n);
5051
const isUseEffectLikeCall = ER.isReactHookCallWithNameAlias(context, useEffectKind, additionalHooks[useEffectKind]);
5152
const isUseStateCall = ER.isReactHookCallWithNameAlias(context, "useState", additionalHooks.useState);
5253
const isUseMemoCall = ER.isReactHookCallWithNameAlias(context, "useMemo", additionalHooks.useMemo);
@@ -80,6 +81,13 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(
8081
&& isUseEffectLikeCall(node.parent);
8182
}
8283

84+
function getCallName(node: TSESTree.Node) {
85+
if (node.type === T.CallExpression) {
86+
return AST.toString(node.callee, getText);
87+
}
88+
return AST.toString(node, getText);
89+
}
90+
8391
function getCallKind(node: TSESTree.CallExpression) {
8492
return match<TSESTree.CallExpression, CallKind>(node)
8593
.when(isUseStateCall, () => "useState")
@@ -221,15 +229,15 @@ export function useNoDirectSetStateInUseEffect<Ctx extends RuleContext>(
221229
const setStateCalls = getSetStateCalls(name, context.sourceCode.getScope(callee));
222230
for (const setStateCall of setStateCalls) {
223231
onViolation(context, setStateCall, {
224-
name: AST.toString(setStateCall, (n) => context.sourceCode.getText(n)),
232+
name: getCallName(setStateCall),
225233
});
226234
}
227235
}
228236
for (const id of setupFunctionIdentifiers) {
229237
const setStateCalls = getSetStateCalls(id.name, context.sourceCode.getScope(id));
230238
for (const setStateCall of setStateCalls) {
231239
onViolation(context, setStateCall, {
232-
name: AST.toString(setStateCall, (n) => context.sourceCode.getText(n)),
240+
name: getCallName(setStateCall),
233241
});
234242
}
235243
}

0 commit comments

Comments
 (0)