eslint-plugin-react-rsc 3.0.0-beta.8 → 3.0.0-beta.81

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 CHANGED
@@ -1,59 +1,9 @@
1
- import * as _eslint_react_shared0 from "@eslint-react/shared";
1
+ import { ESLint, Linter } from "eslint";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const _default: {
5
- configs: {
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 { _default as default };
9
+ export { finalPlugin as default };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getConfigAdapters } from "@eslint-react/shared";
1
+ import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener } from "@eslint-react/shared";
2
2
  import * as ast from "@eslint-react/ast";
3
- import { findVariable, getVariableDefinitionNode } from "@eslint-react/var";
3
+ import { resolve } from "@eslint-react/var";
4
4
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
5
5
  import { ESLintUtils } from "@typescript-eslint/utils";
6
6
 
@@ -32,7 +32,7 @@ const rules$4 = { "react-rsc/function-definition": "off" };
32
32
  //#endregion
33
33
  //#region package.json
34
34
  var name$4 = "eslint-plugin-react-rsc";
35
- var version = "3.0.0-beta.8";
35
+ var version = "3.0.0-beta.81";
36
36
 
37
37
  //#endregion
38
38
  //#region src/utils/create-rule.ts
@@ -42,12 +42,12 @@ function getDocsUrl(ruleName) {
42
42
  const createRule = ESLintUtils.RuleCreator(getDocsUrl);
43
43
 
44
44
  //#endregion
45
- //#region src/rules/function-definition.ts
45
+ //#region src/rules/function-definition/function-definition.ts
46
46
  const RULE_NAME = "function-definition";
47
47
  var function_definition_default = createRule({
48
48
  meta: {
49
49
  type: "problem",
50
- docs: { description: "Validate and transform React Client/Server Function definitions." },
50
+ docs: { description: "Validates and transforms React Client/Server Function definitions." },
51
51
  fixable: "code",
52
52
  messages: {
53
53
  file: "Functions exported from files with `use server` directive are React Server Functions and therefore must be async.",
@@ -80,9 +80,9 @@ function create(context) {
80
80
  if (!ast.isFunction(node)) return false;
81
81
  if (!node.async) {
82
82
  context.report({
83
+ fix: getAsyncFix(node),
83
84
  messageId,
84
- node,
85
- fix: getAsyncFix(node)
85
+ node
86
86
  });
87
87
  return true;
88
88
  }
@@ -101,9 +101,9 @@ function create(context) {
101
101
  * @param node The export declaration node
102
102
  */
103
103
  function findAndCheckExportedFunctionDeclarations(id, node) {
104
- const variableNode = getVariableDefinitionNode(findVariable(id.name, context.sourceCode.getScope(node)), 0);
105
- if (variableNode == null) return;
106
- reportNonAsyncFunction(variableNode, "file");
104
+ const initNode = resolve(context, id);
105
+ if (initNode == null || !ast.isFunction(initNode)) return;
106
+ reportNonAsyncFunction(initNode, "file");
107
107
  }
108
108
  return defineRuleListener({
109
109
  ArrowFunctionExpression(node) {
@@ -198,17 +198,16 @@ const settings = { ...settings$1 };
198
198
 
199
199
  //#endregion
200
200
  //#region src/index.ts
201
- const { toFlatConfig } = getConfigAdapters("react-rsc", plugin);
202
- var src_default = {
201
+ const finalPlugin = {
203
202
  ...plugin,
204
203
  configs: {
205
- ["disable-experimental"]: toFlatConfig(disable_experimental_exports),
206
- ["recommended"]: toFlatConfig(recommended_exports),
207
- ["recommended-typescript"]: toFlatConfig(recommended_typescript_exports),
208
- ["strict"]: toFlatConfig(strict_exports),
209
- ["strict-typescript"]: toFlatConfig(strict_typescript_exports)
204
+ ["disable-experimental"]: disable_experimental_exports,
205
+ ["recommended"]: recommended_exports,
206
+ ["recommended-typescript"]: recommended_typescript_exports,
207
+ ["strict"]: strict_exports,
208
+ ["strict-typescript"]: strict_typescript_exports
210
209
  }
211
210
  };
212
211
 
213
212
  //#endregion
214
- export { src_default as default };
213
+ 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.8",
3
+ "version": "3.0.0-beta.81",
4
4
  "description": "ESLint React's ESLint plugin for RSC related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,22 +37,26 @@
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/shared": "3.0.0-beta.8",
44
- "@eslint-react/ast": "3.0.0-beta.8",
45
- "@eslint-react/var": "3.0.0-beta.8"
45
+ "@eslint-react/ast": "3.0.0-beta.81",
46
+ "@eslint-react/shared": "3.0.0-beta.81",
47
+ "@eslint-react/var": "3.0.0-beta.81"
46
48
  },
47
49
  "devDependencies": {
48
50
  "@types/react": "^19.2.14",
49
51
  "@types/react-dom": "^19.2.3",
50
- "tsdown": "^0.20.3",
51
- "@local/configs": "0.0.0"
52
+ "eslint": "^10.0.3",
53
+ "tsdown": "^0.21.0",
54
+ "@local/configs": "0.0.0",
55
+ "@local/eff": "3.0.0-beta.72"
52
56
  },
53
57
  "peerDependencies": {
54
- "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
55
- "typescript": ">=4.8.4 <6.0.0"
58
+ "eslint": "^10.0.0",
59
+ "typescript": "*"
56
60
  },
57
61
  "engines": {
58
62
  "node": ">=20.19.0"
@@ -63,6 +67,6 @@
63
67
  "scripts": {
64
68
  "build": "tsdown",
65
69
  "lint:publish": "publint",
66
- "lint:ts": "tsc --noEmit"
70
+ "lint:ts": "tsl"
67
71
  }
68
72
  }