eslint-plugin-react-rsc 3.0.0-beta.7 → 3.0.0-beta.71
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.d.ts +5 -55
- package/dist/index.js +20 -20
- package/package.json +10 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,59 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ESLint, Linter } from "eslint";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Disable experimental rules that might be subject to change in the future
|
|
8
|
-
*/
|
|
9
|
-
"disable-experimental": {
|
|
10
|
-
plugins: {};
|
|
11
|
-
name?: string;
|
|
12
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
13
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
|
|
17
|
-
*/
|
|
18
|
-
recommended: {
|
|
19
|
-
plugins: {};
|
|
20
|
-
name?: string;
|
|
21
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
22
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
|
|
26
|
-
*/
|
|
27
|
-
"recommended-typescript": {
|
|
28
|
-
plugins: {};
|
|
29
|
-
name?: string;
|
|
30
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
31
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* More strict version of the `recommended` preset
|
|
35
|
-
*/
|
|
36
|
-
strict: {
|
|
37
|
-
plugins: {};
|
|
38
|
-
name?: string;
|
|
39
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
40
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
|
|
44
|
-
*/
|
|
45
|
-
"strict-typescript": {
|
|
46
|
-
plugins: {};
|
|
47
|
-
name?: string;
|
|
48
|
-
rules?: Record<string, _eslint_react_shared0.RuleConfig>;
|
|
49
|
-
settings?: _eslint_react_shared0.SettingsConfig;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
meta: {
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
};
|
|
56
|
-
rules: Record<string, _eslint_react_shared0.CompatibleRule>;
|
|
4
|
+
type ConfigName = "disable-experimental" | "recommended" | "recommended-typescript" | "strict" | "strict-typescript";
|
|
5
|
+
declare const finalPlugin: ESLint.Plugin & {
|
|
6
|
+
configs: Record<ConfigName, Linter.Config>;
|
|
57
7
|
};
|
|
58
8
|
//#endregion
|
|
59
|
-
export {
|
|
9
|
+
export { finalPlugin as default };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@eslint-react/eff";
|
|
2
|
+
import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener } from "@eslint-react/shared";
|
|
2
3
|
import * as ast from "@eslint-react/ast";
|
|
3
|
-
import {
|
|
4
|
+
import { resolve } from "@eslint-react/var";
|
|
4
5
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
5
6
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
6
7
|
|
|
@@ -32,7 +33,7 @@ const rules$4 = { "react-rsc/function-definition": "off" };
|
|
|
32
33
|
//#endregion
|
|
33
34
|
//#region package.json
|
|
34
35
|
var name$4 = "eslint-plugin-react-rsc";
|
|
35
|
-
var version = "3.0.0-beta.
|
|
36
|
+
var version = "3.0.0-beta.71";
|
|
36
37
|
|
|
37
38
|
//#endregion
|
|
38
39
|
//#region src/utils/create-rule.ts
|
|
@@ -42,12 +43,12 @@ function getDocsUrl(ruleName) {
|
|
|
42
43
|
const createRule = ESLintUtils.RuleCreator(getDocsUrl);
|
|
43
44
|
|
|
44
45
|
//#endregion
|
|
45
|
-
//#region src/rules/function-definition.ts
|
|
46
|
+
//#region src/rules/function-definition/function-definition.ts
|
|
46
47
|
const RULE_NAME = "function-definition";
|
|
47
48
|
var function_definition_default = createRule({
|
|
48
49
|
meta: {
|
|
49
50
|
type: "problem",
|
|
50
|
-
docs: { description: "
|
|
51
|
+
docs: { description: "Validates and transforms React Client/Server Function definitions." },
|
|
51
52
|
fixable: "code",
|
|
52
53
|
messages: {
|
|
53
54
|
file: "Functions exported from files with `use server` directive are React Server Functions and therefore must be async.",
|
|
@@ -80,9 +81,9 @@ function create(context) {
|
|
|
80
81
|
if (!ast.isFunction(node)) return false;
|
|
81
82
|
if (!node.async) {
|
|
82
83
|
context.report({
|
|
84
|
+
fix: getAsyncFix(node),
|
|
83
85
|
messageId,
|
|
84
|
-
node
|
|
85
|
-
fix: getAsyncFix(node)
|
|
86
|
+
node
|
|
86
87
|
});
|
|
87
88
|
return true;
|
|
88
89
|
}
|
|
@@ -101,11 +102,11 @@ function create(context) {
|
|
|
101
102
|
* @param node The export declaration node
|
|
102
103
|
*/
|
|
103
104
|
function findAndCheckExportedFunctionDeclarations(id, node) {
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
reportNonAsyncFunction(
|
|
105
|
+
const initNode = resolve(context, id);
|
|
106
|
+
if (initNode == null || !ast.isFunction(initNode)) return;
|
|
107
|
+
reportNonAsyncFunction(initNode, "file");
|
|
107
108
|
}
|
|
108
|
-
return {
|
|
109
|
+
return defineRuleListener({
|
|
109
110
|
ArrowFunctionExpression(node) {
|
|
110
111
|
checkLocalServerFunction(node);
|
|
111
112
|
},
|
|
@@ -131,7 +132,7 @@ function create(context) {
|
|
|
131
132
|
FunctionExpression(node) {
|
|
132
133
|
checkLocalServerFunction(node);
|
|
133
134
|
}
|
|
134
|
-
};
|
|
135
|
+
});
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
//#endregion
|
|
@@ -198,17 +199,16 @@ const settings = { ...settings$1 };
|
|
|
198
199
|
|
|
199
200
|
//#endregion
|
|
200
201
|
//#region src/index.ts
|
|
201
|
-
const
|
|
202
|
-
var src_default = {
|
|
202
|
+
const finalPlugin = {
|
|
203
203
|
...plugin,
|
|
204
204
|
configs: {
|
|
205
|
-
["disable-experimental"]:
|
|
206
|
-
["recommended"]:
|
|
207
|
-
["recommended-typescript"]:
|
|
208
|
-
["strict"]:
|
|
209
|
-
["strict-typescript"]:
|
|
205
|
+
["disable-experimental"]: disable_experimental_exports,
|
|
206
|
+
["recommended"]: recommended_exports,
|
|
207
|
+
["recommended-typescript"]: recommended_typescript_exports,
|
|
208
|
+
["strict"]: strict_exports,
|
|
209
|
+
["strict-typescript"]: strict_typescript_exports
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
212
|
|
|
213
213
|
//#endregion
|
|
214
|
-
export {
|
|
214
|
+
export { finalPlugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-rsc",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.71",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for RSC related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,17 +37,21 @@
|
|
|
37
37
|
"./package.json"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@typescript-eslint/scope-manager": "canary",
|
|
41
|
+
"@typescript-eslint/type-utils": "canary",
|
|
40
42
|
"@typescript-eslint/types": "canary",
|
|
41
43
|
"@typescript-eslint/utils": "canary",
|
|
42
44
|
"ts-pattern": "^5.9.0",
|
|
43
|
-
"@eslint-react/ast": "3.0.0-beta.
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
45
|
+
"@eslint-react/ast": "3.0.0-beta.71",
|
|
46
|
+
"@eslint-react/eff": "3.0.0-beta.71",
|
|
47
|
+
"@eslint-react/shared": "3.0.0-beta.71",
|
|
48
|
+
"@eslint-react/var": "3.0.0-beta.71"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@types/react": "^19.2.14",
|
|
49
52
|
"@types/react-dom": "^19.2.3",
|
|
50
|
-
"
|
|
53
|
+
"eslint": "^10.0.2",
|
|
54
|
+
"tsdown": "^0.21.0-beta.2",
|
|
51
55
|
"@local/configs": "0.0.0"
|
|
52
56
|
},
|
|
53
57
|
"peerDependencies": {
|
|
@@ -63,6 +67,6 @@
|
|
|
63
67
|
"scripts": {
|
|
64
68
|
"build": "tsdown",
|
|
65
69
|
"lint:publish": "publint",
|
|
66
|
-
"lint:ts": "
|
|
70
|
+
"lint:ts": "tsl"
|
|
67
71
|
}
|
|
68
72
|
}
|