@eslint-react/kit 4.0.0-beta.1 → 4.0.0-beta.3

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/README.md CHANGED
@@ -14,6 +14,7 @@ ESLint React's toolkit for building custom React lint rules right inside your `e
14
14
  - [`kit.is`](#kitis) — Predicates
15
15
  - [`kit.hint`](#kithint) — Detection hint bit-flags
16
16
  - [`kit.flag`](#kitflag) — Component characteristic flags
17
+ - [`kit.settings`](#kitsettings) — Normalized ESLint React settings
17
18
  - [Examples](#examples)
18
19
  - [Simple: Ban `forwardRef`](#simple-ban-forwardref)
19
20
  - [Component: Destructure component props](#component-destructure-component-props)
@@ -24,7 +25,7 @@ ESLint React's toolkit for building custom React lint rules right inside your `e
24
25
  ## Installation
25
26
 
26
27
  ```sh
27
- npm install --save-dev @eslint-react/kit
28
+ npm install --save-dev @eslint-react/kit@beta
28
29
  ```
29
30
 
30
31
  ## Quick Start
@@ -115,6 +116,7 @@ kit
115
116
  ├── is -> All predicates (component, hook, React API, import source)
116
117
  ├── hint -> Detection hint bit-flags
117
118
  ├── flag -> Component characteristic bit-flags
119
+ ├── settings -> Normalized ESLint React settings
118
120
  ```
119
121
 
120
122
  ---
@@ -253,11 +255,46 @@ for (const component of query.all(program)) {
253
255
  }
254
256
  ```
255
257
 
258
+ #### `kit.settings`
259
+
260
+ Exposes the normalized `react-x` settings from the ESLint shared configuration (`context.settings["react-x"]`). This lets your custom rules read and react to the same project-level settings used by the built-in rules.
261
+
262
+ | Property | Type | Default | Description |
263
+ | ----------------------- | ------------------------------------------------------- | ----------- | --------------------------------------------------------- |
264
+ | `version` | `string` | auto-detect | Resolved React version (e.g. `"19.2.4"`). |
265
+ | `importSource` | `string` | `"react"` | The module React is imported from (e.g. `"@pika/react"`). |
266
+ | `compilationMode` | `"infer" \| "annotation" \| "syntax" \| "all" \| "off"` | `"off"` | The React Compiler compilation mode the project uses. |
267
+ | `polymorphicPropName` | `string \| null` | `"as"` | Prop name used for polymorphic components. |
268
+ | `additionalStateHooks` | `RegExpLike` | — | Pattern matching custom hooks treated as state hooks. |
269
+ | `additionalEffectHooks` | `RegExpLike` | — | Pattern matching custom hooks treated as effect hooks. |
270
+
271
+ `RegExpLike` is an object with a `test(s: string) => boolean` method (same interface as `RegExp`).
272
+
273
+ **Usage:**
274
+
275
+ ```ts
276
+ defineReactConfig({
277
+ name: "require-react-19",
278
+ make: (context, { settings }) => ({
279
+ Program(program) {
280
+ if (!settings.version.startsWith("19.")) {
281
+ context.report({
282
+ node: program,
283
+ message: `This project requires React 19, but detected version ${settings.version}.`,
284
+ });
285
+ }
286
+ },
287
+ }),
288
+ });
289
+ ```
290
+
291
+ ---
292
+
256
293
  ## Examples
257
294
 
258
295
  ### Simple: Ban `forwardRef`
259
296
 
260
- This is a simplified kit reimplementation of the built-in [`react-x/no-forwardRef`](https://eslint-react.xyz/docs/rules/no-forwardRef) rule.
297
+ This is a simplified kit reimplementation of the built-in [`react-x/no-forwardRef`](https://beta.eslint-react.xyz/docs/rules/no-forward-ref) rule.
261
298
 
262
299
  ```ts
263
300
  defineReactConfig({
@@ -274,7 +311,7 @@ defineReactConfig({
274
311
 
275
312
  ### Component: Destructure component props
276
313
 
277
- This is a simplified kit reimplementation of the built-in [`react-x/prefer-destructuring-assignment`](https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment) rule.
314
+ This is a simplified kit reimplementation of the built-in [`react-x/prefer-destructuring-assignment`](https://beta.eslint-react.xyz/docs/rules/prefer-destructuring-assignment) rule.
278
315
 
279
316
  ```ts
280
317
  defineReactConfig({
@@ -308,7 +345,7 @@ defineReactConfig({
308
345
 
309
346
  ### Hooks: Warn on custom hooks that don't call other hooks
310
347
 
311
- This is a simplified kit reimplementation of the built-in [`react-x/no-unnecessary-use-prefix`](https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix) rule.
348
+ This is a simplified kit reimplementation of the built-in [`react-x/no-unnecessary-use-prefix`](https://beta.eslint-react.xyz/docs/rules/no-unnecessary-use-prefix) rule.
312
349
 
313
350
  ```ts
314
351
  defineReactConfig({
@@ -335,7 +372,7 @@ defineReactConfig({
335
372
  ### Multiple Collectors: No component/hook factories
336
373
 
337
374
  Disallow defining components or hooks inside other functions (factory pattern).
338
- This is a simplified kit reimplementation of the built-in [`react-x/component-hook-factories`](https://eslint-react.xyz/docs/rules/component-hook-factories) rule.
375
+ This is a simplified kit reimplementation of the built-in [`react-x/component-hook-factories`](https://beta.eslint-react.xyz/docs/rules/component-hook-factories) rule.
339
376
 
340
377
  ```ts
341
378
  defineReactConfig({
@@ -378,4 +415,4 @@ function isFunction({ type }: TSESTree.Node) {
378
415
 
379
416
  ## More Examples
380
417
 
381
- Please check the [Rule Recipes](https://eslint-react.xyz/docs/configuration/configure-custom-rules#rule-recipes) in the documentation site.
418
+ Please check the [Rule Recipes](https://beta.eslint-react.xyz/docs/configuration/configure-custom-rules#rule-recipes) in the documentation site.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as core from "@eslint-react/core";
2
+ import { ESLintReactSettingsNormalized, RuleFix, RuleFixer, RuleListener, defineRuleListener as merge } from "@eslint-react/shared";
2
3
  import { TSESTreeFunction } from "@eslint-react/ast";
3
4
  import { TSESTree } from "@typescript-eslint/utils";
4
- import { RuleContext, RuleFix, RuleFixer, RuleListener } from "@typescript-eslint/utils/ts-eslint";
5
+ import { RuleContext } from "@typescript-eslint/utils/ts-eslint";
5
6
  import { Linter } from "eslint";
6
7
 
7
8
  //#region src/index.d.ts
@@ -11,41 +12,81 @@ interface Collector<T> {
11
12
  };
12
13
  visitor: RuleListener;
13
14
  }
14
- interface CollectorWithContext<T, E> extends Collector<T> {
15
+ interface CollectorWithContext<T> extends Collector<T> {
15
16
  query: {
16
17
  all(program: TSESTree.Program): T[];
17
18
  };
18
19
  }
19
- declare function components(ctx: RuleContext<string, unknown[]>, options?: {
20
- collectDisplayName?: boolean;
21
- hint?: bigint;
22
- }): CollectorWithContext<core.FunctionComponentSemanticNode, core.FunctionComponentSemanticNode>;
23
- declare function hooks(ctx: RuleContext<string, unknown[]>): CollectorWithContext<core.HookSemanticNode, {
24
- key: string;
25
- node: TSESTree.Node;
26
- }>;
20
+ interface RuleDefinition {
21
+ name: string;
22
+ make(ctx: RuleContext, kit: RuleToolkit): RuleListener;
23
+ }
27
24
  interface RuleToolkit {
25
+ collect: {
26
+ components(ctx: RuleContext, options?: {
27
+ collectDisplayName?: boolean;
28
+ hint?: bigint;
29
+ }): CollectorWithContext<core.FunctionComponentSemanticNode>;
30
+ hooks(ctx: RuleContext): CollectorWithContext<core.HookSemanticNode>;
31
+ };
32
+ flag: {
33
+ component: typeof core.ComponentFlag;
34
+ };
35
+ hint: {
36
+ component: typeof core.ComponentDetectionHint & {
37
+ Default: bigint;
38
+ };
39
+ };
28
40
  is: {
41
+ captureOwnerStack: (node: null | TSESTree.Node) => boolean;
42
+ captureOwnerStackCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
43
+ childrenCount: (node: null | TSESTree.Node) => boolean;
44
+ childrenCountCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
45
+ childrenForEach: (node: null | TSESTree.Node) => boolean;
46
+ childrenForEachCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
47
+ childrenMap: (node: null | TSESTree.Node) => boolean;
48
+ childrenMapCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
49
+ childrenOnly: (node: null | TSESTree.Node) => boolean;
50
+ childrenOnlyCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
51
+ childrenToArray: (node: null | TSESTree.Node) => boolean;
52
+ childrenToArrayCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
53
+ cloneElement: (node: null | TSESTree.Node) => boolean;
54
+ cloneElementCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
29
55
  componentDefinition: (node: TSESTreeFunction, hint: bigint) => boolean;
30
56
  componentName: typeof core.isComponentName;
31
57
  componentNameLoose: typeof core.isComponentNameLoose;
32
58
  componentWrapperCall: (node: TSESTree.Node) => boolean;
33
- componentWrapperCallLoose: (node: TSESTree.Node) => boolean;
34
59
  componentWrapperCallback: (node: TSESTree.Node) => boolean;
60
+ componentWrapperCallLoose: (node: TSESTree.Node) => boolean;
61
+ createContext: (node: null | TSESTree.Node) => boolean;
62
+ createContextCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
63
+ createElement: (node: null | TSESTree.Node) => boolean;
64
+ createElementCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
65
+ createRef: (node: null | TSESTree.Node) => boolean;
66
+ createRefCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
67
+ forwardRef: (node: null | TSESTree.Node) => boolean;
68
+ forwardRefCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
35
69
  hook: typeof core.isHook;
36
70
  hookCall: typeof core.isHookCall;
37
71
  hookName: typeof core.isHookName;
38
- useEffectLikeCall: typeof core.isUseEffectLikeCall;
39
- useStateLikeCall: typeof core.isUseStateLikeCall;
40
- useEffectSetupCallback: typeof core.isUseEffectSetupCallback;
41
- useEffectCleanupCallback: typeof core.isUseEffectCleanupCallback;
42
- useCall: typeof core.isUseCall;
72
+ initializedFromReact: typeof core.isInitializedFromReact;
73
+ initializedFromReactNative: typeof core.isInitializedFromReactNative;
74
+ lazy: (node: null | TSESTree.Node) => boolean;
75
+ lazyCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
76
+ memo: (node: null | TSESTree.Node) => boolean;
77
+ memoCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
78
+ reactAPI: (api: string) => (node: null | TSESTree.Node) => boolean;
79
+ reactAPICall: (api: string) => (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
43
80
  useActionStateCall: typeof core.isUseActionStateCall;
81
+ useCall: typeof core.isUseCall;
44
82
  useCallbackCall: typeof core.isUseCallbackCall;
45
83
  useContextCall: typeof core.isUseContextCall;
46
84
  useDebugValueCall: typeof core.isUseDebugValueCall;
47
85
  useDeferredValueCall: typeof core.isUseDeferredValueCall;
48
86
  useEffectCall: typeof core.isUseEffectCall;
87
+ useEffectCleanupCallback: typeof core.isUseEffectCleanupCallback;
88
+ useEffectLikeCall: typeof core.isUseEffectLikeCall;
89
+ useEffectSetupCallback: typeof core.isUseEffectSetupCallback;
49
90
  useFormStatusCall: typeof core.isUseFormStatusCall;
50
91
  useIdCall: typeof core.isUseIdCall;
51
92
  useImperativeHandleCall: typeof core.isUseImperativeHandleCall;
@@ -56,60 +97,15 @@ interface RuleToolkit {
56
97
  useReducerCall: typeof core.isUseReducerCall;
57
98
  useRefCall: typeof core.isUseRefCall;
58
99
  useStateCall: typeof core.isUseStateCall;
100
+ useStateLikeCall: typeof core.isUseStateLikeCall;
59
101
  useSyncExternalStoreCall: typeof core.isUseSyncExternalStoreCall;
60
102
  useTransitionCall: typeof core.isUseTransitionCall;
61
- reactAPI: (api: string) => (node: null | TSESTree.Node) => boolean;
62
- reactAPICall: (api: string) => (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
63
- captureOwnerStack: (node: null | TSESTree.Node) => boolean;
64
- childrenCount: (node: null | TSESTree.Node) => boolean;
65
- childrenForEach: (node: null | TSESTree.Node) => boolean;
66
- childrenMap: (node: null | TSESTree.Node) => boolean;
67
- childrenOnly: (node: null | TSESTree.Node) => boolean;
68
- childrenToArray: (node: null | TSESTree.Node) => boolean;
69
- cloneElement: (node: null | TSESTree.Node) => boolean;
70
- createContext: (node: null | TSESTree.Node) => boolean;
71
- createElement: (node: null | TSESTree.Node) => boolean;
72
- createRef: (node: null | TSESTree.Node) => boolean;
73
- forwardRef: (node: null | TSESTree.Node) => boolean;
74
- memo: (node: null | TSESTree.Node) => boolean;
75
- lazy: (node: null | TSESTree.Node) => boolean;
76
- captureOwnerStackCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
77
- childrenCountCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
78
- childrenForEachCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
79
- childrenMapCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
80
- childrenOnlyCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
81
- childrenToArrayCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
82
- cloneElementCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
83
- createContextCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
84
- createElementCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
85
- createRefCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
86
- forwardRefCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
87
- memoCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
88
- lazyCall: (node: null | TSESTree.Node) => node is TSESTree.CallExpression;
89
- initializedFromReact: typeof core.isInitializedFromReact;
90
- initializedFromReactNative: typeof core.isInitializedFromReactNative;
91
- };
92
- hint: {
93
- component: typeof core.ComponentDetectionHint & {
94
- Default: bigint;
95
- };
96
- };
97
- flag: {
98
- component: typeof core.ComponentFlag;
99
- };
100
- collect: {
101
- components: typeof components;
102
- hooks: typeof hooks;
103
103
  };
104
- }
105
- interface RuleDefinition {
106
- name: string;
107
- make(ctx: RuleContext<string, unknown[]>, kit: RuleToolkit): RuleListener;
104
+ settings: ESLintReactSettingsNormalized;
108
105
  }
109
106
  declare function defineConfig(...rules: RuleDefinition[]): Linter.Config;
110
- declare function merge(...listeners: RuleListener[]): RuleListener;
111
107
  declare module "@typescript-eslint/utils/ts-eslint" {
112
- interface RuleContext<MessageIds extends string, Options extends readonly unknown[]> {
108
+ interface RuleContext<MessageIds extends string = string, Options extends readonly unknown[] = readonly unknown[]> {
113
109
  report(descriptor: {
114
110
  readonly data?: Readonly<Record<string, unknown>>;
115
111
  readonly fix?: ((fixer: RuleFixer) => IterableIterator<RuleFix> | readonly RuleFix[] | RuleFix | null) | null;
@@ -125,4 +121,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
125
121
  }
126
122
  }
127
123
  //#endregion
128
- export { Collector, CollectorWithContext, type RuleContext, RuleToolkit, defineConfig as default, defineConfig, merge };
124
+ export { Collector, CollectorWithContext, RuleDefinition, type RuleFix, type RuleFixer, type RuleListener, defineConfig as default, defineConfig, merge };
package/dist/index.js CHANGED
@@ -1,48 +1,89 @@
1
1
  import * as core from "@eslint-react/core";
2
+ import { defineRuleListener as merge, getSettingsFromContext } from "@eslint-react/shared";
2
3
 
3
4
  //#region package.json
4
5
  var name = "@eslint-react/kit";
5
- var version = "4.0.0-beta.1";
6
+ var version = "4.0.0-beta.3";
6
7
 
7
8
  //#endregion
8
9
  //#region src/index.ts
9
- function components(ctx, options) {
10
- const { api, visitor } = core.getComponentCollector(ctx, options);
11
- return {
12
- query: { all: (program) => api.getAllComponents(program) },
13
- visitor
14
- };
15
- }
16
- function hooks(ctx) {
17
- const { api, visitor } = core.getHookCollector(ctx);
18
- return {
19
- query: { all: (program) => api.getAllHooks(program) },
20
- visitor
21
- };
22
- }
23
10
  function createKit(ctx) {
24
11
  return {
12
+ collect: {
13
+ components(ctx, options) {
14
+ const { api, visitor } = core.getComponentCollector(ctx, options);
15
+ return {
16
+ query: { all(program) {
17
+ return api.getAllComponents(program);
18
+ } },
19
+ visitor
20
+ };
21
+ },
22
+ hooks(ctx) {
23
+ const { api, visitor } = core.getHookCollector(ctx);
24
+ return {
25
+ query: { all(program) {
26
+ return api.getAllHooks(program);
27
+ } },
28
+ visitor
29
+ };
30
+ }
31
+ },
32
+ flag: { component: core.ComponentFlag },
33
+ hint: { component: {
34
+ ...core.ComponentDetectionHint,
35
+ Default: core.DEFAULT_COMPONENT_DETECTION_HINT
36
+ } },
25
37
  is: {
38
+ captureOwnerStack: core.isCaptureOwnerStack(ctx),
39
+ captureOwnerStackCall: core.isCaptureOwnerStackCall(ctx),
40
+ childrenCount: core.isChildrenCount(ctx),
41
+ childrenCountCall: core.isChildrenCountCall(ctx),
42
+ childrenForEach: core.isChildrenForEach(ctx),
43
+ childrenForEachCall: core.isChildrenForEachCall(ctx),
44
+ childrenMap: core.isChildrenMap(ctx),
45
+ childrenMapCall: core.isChildrenMapCall(ctx),
46
+ childrenOnly: core.isChildrenOnly(ctx),
47
+ childrenOnlyCall: core.isChildrenOnlyCall(ctx),
48
+ childrenToArray: core.isChildrenToArray(ctx),
49
+ childrenToArrayCall: core.isChildrenToArrayCall(ctx),
50
+ cloneElement: core.isCloneElement(ctx),
51
+ cloneElementCall: core.isCloneElementCall(ctx),
26
52
  componentDefinition: (node, hint) => core.isComponentDefinition(ctx, node, hint),
27
53
  componentName: core.isComponentName,
28
54
  componentNameLoose: core.isComponentNameLoose,
29
55
  componentWrapperCall: (node) => core.isComponentWrapperCall(ctx, node),
30
- componentWrapperCallLoose: (node) => core.isComponentWrapperCallLoose(ctx, node),
31
56
  componentWrapperCallback: (node) => core.isComponentWrapperCallback(ctx, node),
57
+ componentWrapperCallLoose: (node) => core.isComponentWrapperCallLoose(ctx, node),
58
+ createContext: core.isCreateContext(ctx),
59
+ createContextCall: core.isCreateContextCall(ctx),
60
+ createElement: core.isCreateElement(ctx),
61
+ createElementCall: core.isCreateElementCall(ctx),
62
+ createRef: core.isCreateRef(ctx),
63
+ createRefCall: core.isCreateRefCall(ctx),
64
+ forwardRef: core.isForwardRef(ctx),
65
+ forwardRefCall: core.isForwardRefCall(ctx),
32
66
  hook: core.isHook,
33
67
  hookCall: core.isHookCall,
34
68
  hookName: core.isHookName,
35
- useEffectLikeCall: core.isUseEffectLikeCall,
36
- useStateLikeCall: core.isUseStateLikeCall,
37
- useEffectSetupCallback: core.isUseEffectSetupCallback,
38
- useEffectCleanupCallback: core.isUseEffectCleanupCallback,
39
- useCall: core.isUseCall,
69
+ initializedFromReact: core.isInitializedFromReact,
70
+ initializedFromReactNative: core.isInitializedFromReactNative,
71
+ lazy: core.isLazy(ctx),
72
+ lazyCall: core.isLazyCall(ctx),
73
+ memo: core.isMemo(ctx),
74
+ memoCall: core.isMemoCall(ctx),
75
+ reactAPI: (api) => core.isReactAPI(api)(ctx),
76
+ reactAPICall: (api) => core.isReactAPICall(api)(ctx),
40
77
  useActionStateCall: core.isUseActionStateCall,
78
+ useCall: core.isUseCall,
41
79
  useCallbackCall: core.isUseCallbackCall,
42
80
  useContextCall: core.isUseContextCall,
43
81
  useDebugValueCall: core.isUseDebugValueCall,
44
82
  useDeferredValueCall: core.isUseDeferredValueCall,
45
83
  useEffectCall: core.isUseEffectCall,
84
+ useEffectCleanupCallback: core.isUseEffectCleanupCallback,
85
+ useEffectLikeCall: core.isUseEffectLikeCall,
86
+ useEffectSetupCallback: core.isUseEffectSetupCallback,
46
87
  useFormStatusCall: core.isUseFormStatusCall,
47
88
  useIdCall: core.isUseIdCall,
48
89
  useImperativeHandleCall: core.isUseImperativeHandleCall,
@@ -53,48 +94,11 @@ function createKit(ctx) {
53
94
  useReducerCall: core.isUseReducerCall,
54
95
  useRefCall: core.isUseRefCall,
55
96
  useStateCall: core.isUseStateCall,
97
+ useStateLikeCall: core.isUseStateLikeCall,
56
98
  useSyncExternalStoreCall: core.isUseSyncExternalStoreCall,
57
- useTransitionCall: core.isUseTransitionCall,
58
- reactAPI: (api) => core.isReactAPI(api)(ctx),
59
- reactAPICall: (api) => core.isReactAPICall(api)(ctx),
60
- captureOwnerStack: core.isCaptureOwnerStack(ctx),
61
- childrenCount: core.isChildrenCount(ctx),
62
- childrenForEach: core.isChildrenForEach(ctx),
63
- childrenMap: core.isChildrenMap(ctx),
64
- childrenOnly: core.isChildrenOnly(ctx),
65
- childrenToArray: core.isChildrenToArray(ctx),
66
- cloneElement: core.isCloneElement(ctx),
67
- createContext: core.isCreateContext(ctx),
68
- createElement: core.isCreateElement(ctx),
69
- createRef: core.isCreateRef(ctx),
70
- forwardRef: core.isForwardRef(ctx),
71
- memo: core.isMemo(ctx),
72
- lazy: core.isLazy(ctx),
73
- captureOwnerStackCall: core.isCaptureOwnerStackCall(ctx),
74
- childrenCountCall: core.isChildrenCountCall(ctx),
75
- childrenForEachCall: core.isChildrenForEachCall(ctx),
76
- childrenMapCall: core.isChildrenMapCall(ctx),
77
- childrenOnlyCall: core.isChildrenOnlyCall(ctx),
78
- childrenToArrayCall: core.isChildrenToArrayCall(ctx),
79
- cloneElementCall: core.isCloneElementCall(ctx),
80
- createContextCall: core.isCreateContextCall(ctx),
81
- createElementCall: core.isCreateElementCall(ctx),
82
- createRefCall: core.isCreateRefCall(ctx),
83
- forwardRefCall: core.isForwardRefCall(ctx),
84
- memoCall: core.isMemoCall(ctx),
85
- lazyCall: core.isLazyCall(ctx),
86
- initializedFromReact: core.isInitializedFromReact,
87
- initializedFromReactNative: core.isInitializedFromReactNative
99
+ useTransitionCall: core.isUseTransitionCall
88
100
  },
89
- hint: { component: {
90
- ...core.ComponentDetectionHint,
91
- Default: core.DEFAULT_COMPONENT_DETECTION_HINT
92
- } },
93
- flag: { component: core.ComponentFlag },
94
- collect: {
95
- components,
96
- hooks
97
- }
101
+ settings: getSettingsFromContext(ctx)
98
102
  };
99
103
  }
100
104
  function defineConfig(...rules) {
@@ -124,17 +128,6 @@ function defineConfig(...rules) {
124
128
  }, {})
125
129
  };
126
130
  }
127
- function merge(...listeners) {
128
- const [base = {}, ...rest] = listeners;
129
- for (const r of rest) for (const key in r) {
130
- const existing = base[key];
131
- base[key] = existing ? (...args) => {
132
- existing(...args);
133
- r[key]?.(...args);
134
- } : r[key];
135
- }
136
- return base;
137
- }
138
131
 
139
132
  //#endregion
140
133
  export { defineConfig as default, defineConfig, merge };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/kit",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.3",
4
4
  "description": "ESLint React's utility module for building custom rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,14 +37,15 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@typescript-eslint/utils": "^8.57.2",
40
- "@eslint-react/ast": "4.0.0-beta.1",
41
- "@eslint-react/core": "4.0.0-beta.1"
40
+ "@eslint-react/core": "4.0.0-beta.3",
41
+ "@eslint-react/shared": "4.0.0-beta.3",
42
+ "@eslint-react/ast": "4.0.0-beta.3"
42
43
  },
43
44
  "devDependencies": {
44
45
  "eslint": "^10.1.0",
45
- "tsdown": "^0.21.4",
46
- "@local/eff": "3.0.0-beta.72",
47
- "@local/configs": "0.0.0"
46
+ "tsdown": "^0.21.6",
47
+ "@local/configs": "0.0.0",
48
+ "@local/eff": "3.0.0-beta.72"
48
49
  },
49
50
  "peerDependencies": {
50
51
  "eslint": "^10.0.0",