eslint-plugin-react-rsc 3.0.0-beta.60 → 3.0.0-beta.61

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 +12 -5
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "@eslint-react/eff";
1
+ import { unit } from "@eslint-react/eff";
2
2
  import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener } from "@eslint-react/shared";
3
3
  import * as ast from "@eslint-react/ast";
4
- import { findVariable, getVariableInitializer } from "@eslint-react/var";
4
+ import { findVariable } from "@eslint-react/var";
5
5
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
6
6
  import { ESLintUtils } from "@typescript-eslint/utils";
7
7
 
@@ -33,7 +33,7 @@ const rules$4 = { "react-rsc/function-definition": "off" };
33
33
  //#endregion
34
34
  //#region package.json
35
35
  var name$4 = "eslint-plugin-react-rsc";
36
- var version = "3.0.0-beta.60";
36
+ var version = "3.0.0-beta.61";
37
37
 
38
38
  //#endregion
39
39
  //#region src/utils/create-rule.ts
@@ -102,8 +102,15 @@ function create(context) {
102
102
  * @param node The export declaration node
103
103
  */
104
104
  function findAndCheckExportedFunctionDeclarations(id, node) {
105
- const initNode = getVariableInitializer(findVariable(id.name, context.sourceCode.getScope(node)), 0);
106
- if (initNode == null) return;
105
+ function resolve(v) {
106
+ if (v == null) return unit;
107
+ const def = v.defs.at(0);
108
+ if (def == null) return unit;
109
+ if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
110
+ return def.node;
111
+ }
112
+ const initNode = resolve(findVariable(id.name, context.sourceCode.getScope(node)));
113
+ if (initNode == null || !ast.isFunction(initNode)) return;
107
114
  reportNonAsyncFunction(initNode, "file");
108
115
  }
109
116
  return defineRuleListener({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-rsc",
3
- "version": "3.0.0-beta.60",
3
+ "version": "3.0.0-beta.61",
4
4
  "description": "ESLint React's ESLint plugin for RSC related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -40,10 +40,10 @@
40
40
  "@typescript-eslint/types": "canary",
41
41
  "@typescript-eslint/utils": "canary",
42
42
  "ts-pattern": "^5.9.0",
43
- "@eslint-react/ast": "3.0.0-beta.60",
44
- "@eslint-react/eff": "3.0.0-beta.60",
45
- "@eslint-react/shared": "3.0.0-beta.60",
46
- "@eslint-react/var": "3.0.0-beta.60"
43
+ "@eslint-react/ast": "3.0.0-beta.61",
44
+ "@eslint-react/eff": "3.0.0-beta.61",
45
+ "@eslint-react/shared": "3.0.0-beta.61",
46
+ "@eslint-react/var": "3.0.0-beta.61"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/react": "^19.2.14",