eslint-plugin-react-x 5.28.5 → 5.28.6
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 +12 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -135,7 +135,7 @@ const rules$6 = {
|
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region package.json
|
|
137
137
|
var name$6 = "eslint-plugin-react-x";
|
|
138
|
-
var version = "5.28.
|
|
138
|
+
var version = "5.28.6";
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/utils/create-rule.ts
|
|
141
141
|
function getDocsUrl(ruleName) {
|
|
@@ -6749,10 +6749,18 @@ function inferViolations$2(context, facts) {
|
|
|
6749
6749
|
const args0 = callNode.arguments.at(0);
|
|
6750
6750
|
return args0 != null && isArgumentUsingRefValue(context, args0, refParams);
|
|
6751
6751
|
};
|
|
6752
|
-
const
|
|
6752
|
+
const getHelperFunction = (callee) => {
|
|
6753
6753
|
const origin = resolveOrigin(context, callee);
|
|
6754
|
+
if (Check.isFunction(origin)) return origin;
|
|
6755
|
+
if (!core.isUseCallbackCall(context, origin)) return null;
|
|
6756
|
+
const callback = origin.arguments.at(0);
|
|
6757
|
+
if (callback == null || callback.type === AST_NODE_TYPES.SpreadElement) return null;
|
|
6758
|
+
const unwrapped = Extract.unwrap(callback);
|
|
6759
|
+
return Check.isFunction(unwrapped) ? unwrapped : null;
|
|
6760
|
+
};
|
|
6761
|
+
const getRefDerivedParams = (call, callee) => {
|
|
6762
|
+
const origin = getHelperFunction(callee);
|
|
6754
6763
|
if (origin == null) return void 0;
|
|
6755
|
-
if (!Check.isFunction(origin)) return void 0;
|
|
6756
6764
|
const refParams = /* @__PURE__ */ new Set();
|
|
6757
6765
|
origin.params.forEach((param, index) => {
|
|
6758
6766
|
const paramId = param.type === AST_NODE_TYPES.Identifier ? param : param.type === AST_NODE_TYPES.AssignmentPattern && param.left.type === AST_NODE_TYPES.Identifier ? param.left : null;
|
|
@@ -6785,6 +6793,7 @@ function inferViolations$2(context, facts) {
|
|
|
6785
6793
|
for (const trackedCall of trackedFnCalls) {
|
|
6786
6794
|
const unwrappedCallee = Extract.unwrap(trackedCall.callee);
|
|
6787
6795
|
if (!Check.isIdentifier(unwrappedCallee)) continue;
|
|
6796
|
+
if (isRefGatedContext(context, trackedCall)) continue;
|
|
6788
6797
|
const refParams = getRefDerivedParams(trackedCall, unwrappedCallee);
|
|
6789
6798
|
for (const setStateCall of getSetStateCalls(unwrappedCallee)) {
|
|
6790
6799
|
if (isExemptSetStateCall(setStateCall, refParams)) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.28.
|
|
3
|
+
"version": "5.28.6",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eslint-react/ast": "5.28.
|
|
40
|
-
"@eslint-react/core": "5.28.
|
|
41
|
-
"@eslint-react/eslint": "5.28.
|
|
42
|
-
"@eslint-react/jsx": "5.28.
|
|
43
|
-
"@eslint-react/shared": "5.28.
|
|
44
|
-
"@eslint-react/var": "5.28.
|
|
39
|
+
"@eslint-react/ast": "5.28.6",
|
|
40
|
+
"@eslint-react/core": "5.28.6",
|
|
41
|
+
"@eslint-react/eslint": "5.28.6",
|
|
42
|
+
"@eslint-react/jsx": "5.28.6",
|
|
43
|
+
"@eslint-react/shared": "5.28.6",
|
|
44
|
+
"@eslint-react/var": "5.28.6",
|
|
45
45
|
"@typescript-eslint/scope-manager": "^8.72.0",
|
|
46
46
|
"@typescript-eslint/types": "^8.72.0",
|
|
47
47
|
"@typescript-eslint/typescript-estree": "^8.72.0",
|