eslint-plugin-react-x 5.28.5 → 5.28.7

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -3
  2. 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.5";
138
+ var version = "5.28.7";
139
139
  //#endregion
140
140
  //#region src/utils/create-rule.ts
141
141
  function getDocsUrl(ruleName) {
@@ -3754,6 +3754,7 @@ const IMPURE_FUNCS = /* @__PURE__ */ new Map([
3754
3754
  "clearTimeout",
3755
3755
  "close",
3756
3756
  "confirm",
3757
+ "Date",
3757
3758
  "dispatchEvent",
3758
3759
  "fetch",
3759
3760
  "focus",
@@ -3887,6 +3888,7 @@ const IMPURE_FUNCS = /* @__PURE__ */ new Map([
3887
3888
  "clearTimeout",
3888
3889
  "close",
3889
3890
  "confirm",
3891
+ "Date",
3890
3892
  "dispatchEvent",
3891
3893
  "fetch",
3892
3894
  "focus",
@@ -6749,10 +6751,18 @@ function inferViolations$2(context, facts) {
6749
6751
  const args0 = callNode.arguments.at(0);
6750
6752
  return args0 != null && isArgumentUsingRefValue(context, args0, refParams);
6751
6753
  };
6752
- const getRefDerivedParams = (call, callee) => {
6754
+ const getHelperFunction = (callee) => {
6753
6755
  const origin = resolveOrigin(context, callee);
6756
+ if (Check.isFunction(origin)) return origin;
6757
+ if (!core.isUseCallbackCall(context, origin)) return null;
6758
+ const callback = origin.arguments.at(0);
6759
+ if (callback == null || callback.type === AST_NODE_TYPES.SpreadElement) return null;
6760
+ const unwrapped = Extract.unwrap(callback);
6761
+ return Check.isFunction(unwrapped) ? unwrapped : null;
6762
+ };
6763
+ const getRefDerivedParams = (call, callee) => {
6764
+ const origin = getHelperFunction(callee);
6754
6765
  if (origin == null) return void 0;
6755
- if (!Check.isFunction(origin)) return void 0;
6756
6766
  const refParams = /* @__PURE__ */ new Set();
6757
6767
  origin.params.forEach((param, index) => {
6758
6768
  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 +6795,7 @@ function inferViolations$2(context, facts) {
6785
6795
  for (const trackedCall of trackedFnCalls) {
6786
6796
  const unwrappedCallee = Extract.unwrap(trackedCall.callee);
6787
6797
  if (!Check.isIdentifier(unwrappedCallee)) continue;
6798
+ if (isRefGatedContext(context, trackedCall)) continue;
6788
6799
  const refParams = getRefDerivedParams(trackedCall, unwrappedCallee);
6789
6800
  for (const setStateCall of getSetStateCalls(unwrappedCallee)) {
6790
6801
  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.5",
3
+ "version": "5.28.7",
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.5",
40
- "@eslint-react/core": "5.28.5",
41
- "@eslint-react/eslint": "5.28.5",
42
- "@eslint-react/jsx": "5.28.5",
43
- "@eslint-react/shared": "5.28.5",
44
- "@eslint-react/var": "5.28.5",
39
+ "@eslint-react/ast": "5.28.7",
40
+ "@eslint-react/core": "5.28.7",
41
+ "@eslint-react/eslint": "5.28.7",
42
+ "@eslint-react/jsx": "5.28.7",
43
+ "@eslint-react/shared": "5.28.7",
44
+ "@eslint-react/var": "5.28.7",
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",