eslint-plugin-react-rsc 5.2.1-next.3 → 5.2.2-beta.0
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 +6 -6
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
|
|
2
|
-
import
|
|
2
|
+
import { Check } from "@eslint-react/ast";
|
|
3
3
|
import * as core from "@eslint-react/core";
|
|
4
4
|
import { merge } from "@eslint-react/eslint";
|
|
5
5
|
import { resolve } from "@eslint-react/var";
|
|
@@ -34,7 +34,7 @@ const rules$4 = { "react-rsc/function-definition": "off" };
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region package.json
|
|
36
36
|
var name$4 = "eslint-plugin-react-rsc";
|
|
37
|
-
var version = "5.2.
|
|
37
|
+
var version = "5.2.2-beta.0";
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/utils/create-rule.ts
|
|
@@ -63,7 +63,7 @@ var function_definition_default = createRule({
|
|
|
63
63
|
});
|
|
64
64
|
function create(context) {
|
|
65
65
|
if (!context.sourceCode.text.includes("use server")) return {};
|
|
66
|
-
const hasFileLevelUseServerDirective =
|
|
66
|
+
const hasFileLevelUseServerDirective = context.sourceCode.ast.body.some((stmt) => Check.directive(stmt) && stmt.directive === "use server");
|
|
67
67
|
/**
|
|
68
68
|
* Check if `node` is an async function, and report if not
|
|
69
69
|
* @param node The function node to check
|
|
@@ -79,7 +79,7 @@ function create(context) {
|
|
|
79
79
|
return null;
|
|
80
80
|
}
|
|
81
81
|
function reportNonAsyncFunction(node, messageId) {
|
|
82
|
-
if (!
|
|
82
|
+
if (!Check.isFunction(node)) return false;
|
|
83
83
|
if (!node.async) {
|
|
84
84
|
context.report({
|
|
85
85
|
fix: getAsyncFix(node),
|
|
@@ -104,7 +104,7 @@ function create(context) {
|
|
|
104
104
|
*/
|
|
105
105
|
function findAndCheckExportedFunctionDeclarations(id, node) {
|
|
106
106
|
const initNode = resolve(context, id);
|
|
107
|
-
if (initNode == null || !
|
|
107
|
+
if (initNode == null || !Check.isFunction(initNode)) return;
|
|
108
108
|
reportNonAsyncFunction(initNode, "file");
|
|
109
109
|
}
|
|
110
110
|
return merge({
|
|
@@ -115,7 +115,7 @@ function create(context) {
|
|
|
115
115
|
if (!hasFileLevelUseServerDirective) return;
|
|
116
116
|
const decl = node.declaration;
|
|
117
117
|
if (reportNonAsyncFunction(decl, "file")) return;
|
|
118
|
-
if (
|
|
118
|
+
if (Check.identifier(decl)) findAndCheckExportedFunctionDeclarations(decl, node);
|
|
119
119
|
},
|
|
120
120
|
ExportNamedDeclaration(node) {
|
|
121
121
|
if (!hasFileLevelUseServerDirective) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-rsc",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2-beta.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for RSC related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,19 +42,19 @@
|
|
|
42
42
|
"@typescript-eslint/types": "^8.58.1",
|
|
43
43
|
"@typescript-eslint/utils": "^8.58.1",
|
|
44
44
|
"ts-pattern": "^5.9.0",
|
|
45
|
-
"@eslint-react/core": "5.2.
|
|
46
|
-
"@eslint-react/ast": "5.2.
|
|
47
|
-
"@eslint-react/eslint": "5.2.
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
45
|
+
"@eslint-react/core": "5.2.2-beta.0",
|
|
46
|
+
"@eslint-react/ast": "5.2.2-beta.0",
|
|
47
|
+
"@eslint-react/eslint": "5.2.2-beta.0",
|
|
48
|
+
"@eslint-react/shared": "5.2.2-beta.0",
|
|
49
|
+
"@eslint-react/var": "5.2.2-beta.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.2.14",
|
|
53
53
|
"@types/react-dom": "^19.2.3",
|
|
54
54
|
"eslint": "^10.2.0",
|
|
55
55
|
"tsdown": "^0.21.7",
|
|
56
|
-
"@local/
|
|
57
|
-
"@local/
|
|
56
|
+
"@local/configs": "0.0.0",
|
|
57
|
+
"@local/eff": "3.0.0-beta.72"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"eslint": "^10.2.0",
|