@eslint-react/core 1.26.3-beta.8 → 1.26.3-next.1

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.mts CHANGED
@@ -76,12 +76,6 @@ interface ERClassComponent extends ERSemanticNode {
76
76
  }
77
77
  type ERComponent = ERClassComponent | ERFunctionComponent;
78
78
 
79
- type FunctionEntry = {
80
- key: string;
81
- node: AST.TSESTreeFunction;
82
- hookCalls: TSESTree.CallExpression[];
83
- isComponent: boolean;
84
- };
85
79
  /**
86
80
  * Get a ctx and listeners for the rule to collect function components
87
81
  * @param context The ESLint rule context
@@ -91,16 +85,23 @@ type FunctionEntry = {
91
85
  */
92
86
  declare function useComponentCollector(context: RuleContext, hint?: bigint, options?: useComponentCollector.Options): useComponentCollector.ReturnType;
93
87
  declare namespace useComponentCollector {
88
+ type Entry = {
89
+ key: string;
90
+ node: AST.TSESTreeFunction;
91
+ hookCalls: TSESTree.CallExpression[];
92
+ isComponent: boolean;
93
+ };
94
+ type Ctx = {
95
+ getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
96
+ getCurrentEntries: () => Entry[];
97
+ getCurrentEntry: () => Entry | _;
98
+ };
94
99
  type Options = {
95
100
  collectDisplayName?: boolean;
96
101
  collectHookCalls?: boolean;
97
102
  };
98
103
  type ReturnType = {
99
- ctx: {
100
- getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
101
- getCurrentEntries: () => FunctionEntry[];
102
- getCurrentEntry: () => FunctionEntry | _;
103
- };
104
+ ctx: Ctx;
104
105
  listeners: ESLintUtils.RuleListener;
105
106
  };
106
107
  }
@@ -111,10 +112,11 @@ declare namespace useComponentCollector {
111
112
  */
112
113
  declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType;
113
114
  declare namespace useComponentCollectorLegacy {
115
+ type Ctx = {
116
+ getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
117
+ };
114
118
  type ReturnType = {
115
- ctx: {
116
- getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
117
- };
119
+ ctx: Ctx;
118
120
  listeners: ESLintUtils.RuleListener;
119
121
  };
120
122
  }
@@ -274,10 +276,16 @@ interface ERHook extends ERSemanticNode {
274
276
 
275
277
  declare function useHookCollector(): useHookCollector.ReturnType;
276
278
  declare namespace useHookCollector {
279
+ type Entry = {
280
+ key: string;
281
+ node: AST.TSESTreeFunction;
282
+ isHook: boolean;
283
+ };
284
+ type Ctx = {
285
+ getAllHooks(node: TSESTree$1.Program): Map<string, ERHook>;
286
+ };
277
287
  type ReturnType = {
278
- ctx: {
279
- getAllHooks(node: TSESTree$1.Program): Map<string, ERHook>;
280
- };
288
+ ctx: Ctx;
281
289
  listeners: ESLintUtils.RuleListener;
282
290
  };
283
291
  }
package/dist/index.d.ts CHANGED
@@ -76,12 +76,6 @@ interface ERClassComponent extends ERSemanticNode {
76
76
  }
77
77
  type ERComponent = ERClassComponent | ERFunctionComponent;
78
78
 
79
- type FunctionEntry = {
80
- key: string;
81
- node: AST.TSESTreeFunction;
82
- hookCalls: TSESTree.CallExpression[];
83
- isComponent: boolean;
84
- };
85
79
  /**
86
80
  * Get a ctx and listeners for the rule to collect function components
87
81
  * @param context The ESLint rule context
@@ -91,16 +85,23 @@ type FunctionEntry = {
91
85
  */
92
86
  declare function useComponentCollector(context: RuleContext, hint?: bigint, options?: useComponentCollector.Options): useComponentCollector.ReturnType;
93
87
  declare namespace useComponentCollector {
88
+ type Entry = {
89
+ key: string;
90
+ node: AST.TSESTreeFunction;
91
+ hookCalls: TSESTree.CallExpression[];
92
+ isComponent: boolean;
93
+ };
94
+ type Ctx = {
95
+ getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
96
+ getCurrentEntries: () => Entry[];
97
+ getCurrentEntry: () => Entry | _;
98
+ };
94
99
  type Options = {
95
100
  collectDisplayName?: boolean;
96
101
  collectHookCalls?: boolean;
97
102
  };
98
103
  type ReturnType = {
99
- ctx: {
100
- getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
101
- getCurrentEntries: () => FunctionEntry[];
102
- getCurrentEntry: () => FunctionEntry | _;
103
- };
104
+ ctx: Ctx;
104
105
  listeners: ESLintUtils.RuleListener;
105
106
  };
106
107
  }
@@ -111,10 +112,11 @@ declare namespace useComponentCollector {
111
112
  */
112
113
  declare function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType;
113
114
  declare namespace useComponentCollectorLegacy {
115
+ type Ctx = {
116
+ getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
117
+ };
114
118
  type ReturnType = {
115
- ctx: {
116
- getAllComponents: (node: TSESTree$1.Program) => Map<string, ERClassComponent>;
117
- };
119
+ ctx: Ctx;
118
120
  listeners: ESLintUtils.RuleListener;
119
121
  };
120
122
  }
@@ -274,10 +276,16 @@ interface ERHook extends ERSemanticNode {
274
276
 
275
277
  declare function useHookCollector(): useHookCollector.ReturnType;
276
278
  declare namespace useHookCollector {
279
+ type Entry = {
280
+ key: string;
281
+ node: AST.TSESTreeFunction;
282
+ isHook: boolean;
283
+ };
284
+ type Ctx = {
285
+ getAllHooks(node: TSESTree$1.Program): Map<string, ERHook>;
286
+ };
277
287
  type ReturnType = {
278
- ctx: {
279
- getAllHooks(node: TSESTree$1.Program): Map<string, ERHook>;
280
- };
288
+ ctx: Ctx;
281
289
  listeners: ESLintUtils.RuleListener;
282
290
  };
283
291
  }
package/dist/index.js CHANGED
@@ -448,6 +448,44 @@ function hasNoneOrValidComponentName(node, context) {
448
448
  }
449
449
 
450
450
  // src/component/component-collector.ts
451
+ function hasValidHierarchy(node, context, hint) {
452
+ if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
453
+ return false;
454
+ }
455
+ if (hint & ERComponentHint.SkipMapCallback && AST8__namespace.isMapCallLoose(node.parent)) {
456
+ return false;
457
+ }
458
+ if (hint & ERComponentHint.SkipObjectMethod && AST8__namespace.isFunctionOfObjectMethod(node.parent)) {
459
+ return false;
460
+ }
461
+ if (hint & ERComponentHint.SkipClassMethod && AST8__namespace.isFunctionOfClassMethod(node.parent)) {
462
+ return false;
463
+ }
464
+ if (hint & ERComponentHint.SkipClassProperty && AST8__namespace.isFunctionOfClassProperty(node.parent)) {
465
+ return false;
466
+ }
467
+ const boundaryNode = AST8__namespace.findParentNode(
468
+ node,
469
+ AST8__namespace.isOneOf([
470
+ types.AST_NODE_TYPES.JSXExpressionContainer,
471
+ types.AST_NODE_TYPES.ArrowFunctionExpression,
472
+ types.AST_NODE_TYPES.FunctionExpression,
473
+ types.AST_NODE_TYPES.Property,
474
+ types.AST_NODE_TYPES.ClassBody
475
+ ])
476
+ );
477
+ return boundaryNode == null || boundaryNode.type !== types.AST_NODE_TYPES.JSXExpressionContainer;
478
+ }
479
+ function getComponentFlag(initPath) {
480
+ let flag = ERComponentFlag.None;
481
+ if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
482
+ flag |= ERComponentFlag.Memo;
483
+ }
484
+ if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
485
+ flag |= ERComponentFlag.ForwardRef;
486
+ }
487
+ return flag;
488
+ }
451
489
  function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options = {}) {
452
490
  const { collectDisplayName = false, collectHookCalls = false } = options;
453
491
  const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
@@ -549,44 +587,6 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
549
587
  };
550
588
  return { ctx, listeners };
551
589
  }
552
- function hasValidHierarchy(node, context, hint) {
553
- if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
554
- return false;
555
- }
556
- if (hint & ERComponentHint.SkipMapCallback && AST8__namespace.isMapCallLoose(node.parent)) {
557
- return false;
558
- }
559
- if (hint & ERComponentHint.SkipObjectMethod && AST8__namespace.isFunctionOfObjectMethod(node.parent)) {
560
- return false;
561
- }
562
- if (hint & ERComponentHint.SkipClassMethod && AST8__namespace.isFunctionOfClassMethod(node.parent)) {
563
- return false;
564
- }
565
- if (hint & ERComponentHint.SkipClassProperty && AST8__namespace.isFunctionOfClassProperty(node.parent)) {
566
- return false;
567
- }
568
- const boundaryNode = AST8__namespace.findParentNode(
569
- node,
570
- AST8__namespace.isOneOf([
571
- types.AST_NODE_TYPES.JSXExpressionContainer,
572
- types.AST_NODE_TYPES.ArrowFunctionExpression,
573
- types.AST_NODE_TYPES.FunctionExpression,
574
- types.AST_NODE_TYPES.Property,
575
- types.AST_NODE_TYPES.ClassBody
576
- ])
577
- );
578
- return boundaryNode == null || boundaryNode.type !== types.AST_NODE_TYPES.JSXExpressionContainer;
579
- }
580
- function getComponentFlag(initPath) {
581
- let flag = ERComponentFlag.None;
582
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
583
- flag |= ERComponentFlag.Memo;
584
- }
585
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
586
- flag |= ERComponentFlag.ForwardRef;
587
- }
588
- return flag;
589
- }
590
590
  function useComponentCollectorLegacy() {
591
591
  const components = /* @__PURE__ */ new Map();
592
592
  const ctx = {
package/dist/index.mjs CHANGED
@@ -421,6 +421,44 @@ function hasNoneOrValidComponentName(node, context) {
421
421
  }
422
422
 
423
423
  // src/component/component-collector.ts
424
+ function hasValidHierarchy(node, context, hint) {
425
+ if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
426
+ return false;
427
+ }
428
+ if (hint & ERComponentHint.SkipMapCallback && AST8.isMapCallLoose(node.parent)) {
429
+ return false;
430
+ }
431
+ if (hint & ERComponentHint.SkipObjectMethod && AST8.isFunctionOfObjectMethod(node.parent)) {
432
+ return false;
433
+ }
434
+ if (hint & ERComponentHint.SkipClassMethod && AST8.isFunctionOfClassMethod(node.parent)) {
435
+ return false;
436
+ }
437
+ if (hint & ERComponentHint.SkipClassProperty && AST8.isFunctionOfClassProperty(node.parent)) {
438
+ return false;
439
+ }
440
+ const boundaryNode = AST8.findParentNode(
441
+ node,
442
+ AST8.isOneOf([
443
+ AST_NODE_TYPES.JSXExpressionContainer,
444
+ AST_NODE_TYPES.ArrowFunctionExpression,
445
+ AST_NODE_TYPES.FunctionExpression,
446
+ AST_NODE_TYPES.Property,
447
+ AST_NODE_TYPES.ClassBody
448
+ ])
449
+ );
450
+ return boundaryNode == null || boundaryNode.type !== AST_NODE_TYPES.JSXExpressionContainer;
451
+ }
452
+ function getComponentFlag(initPath) {
453
+ let flag = ERComponentFlag.None;
454
+ if (initPath != null && AST8.hasCallInFunctionInitPath("memo", initPath)) {
455
+ flag |= ERComponentFlag.Memo;
456
+ }
457
+ if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef", initPath)) {
458
+ flag |= ERComponentFlag.ForwardRef;
459
+ }
460
+ return flag;
461
+ }
424
462
  function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options = {}) {
425
463
  const { collectDisplayName = false, collectHookCalls = false } = options;
426
464
  const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
@@ -522,44 +560,6 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options =
522
560
  };
523
561
  return { ctx, listeners };
524
562
  }
525
- function hasValidHierarchy(node, context, hint) {
526
- if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
527
- return false;
528
- }
529
- if (hint & ERComponentHint.SkipMapCallback && AST8.isMapCallLoose(node.parent)) {
530
- return false;
531
- }
532
- if (hint & ERComponentHint.SkipObjectMethod && AST8.isFunctionOfObjectMethod(node.parent)) {
533
- return false;
534
- }
535
- if (hint & ERComponentHint.SkipClassMethod && AST8.isFunctionOfClassMethod(node.parent)) {
536
- return false;
537
- }
538
- if (hint & ERComponentHint.SkipClassProperty && AST8.isFunctionOfClassProperty(node.parent)) {
539
- return false;
540
- }
541
- const boundaryNode = AST8.findParentNode(
542
- node,
543
- AST8.isOneOf([
544
- AST_NODE_TYPES.JSXExpressionContainer,
545
- AST_NODE_TYPES.ArrowFunctionExpression,
546
- AST_NODE_TYPES.FunctionExpression,
547
- AST_NODE_TYPES.Property,
548
- AST_NODE_TYPES.ClassBody
549
- ])
550
- );
551
- return boundaryNode == null || boundaryNode.type !== AST_NODE_TYPES.JSXExpressionContainer;
552
- }
553
- function getComponentFlag(initPath) {
554
- let flag = ERComponentFlag.None;
555
- if (initPath != null && AST8.hasCallInFunctionInitPath("memo", initPath)) {
556
- flag |= ERComponentFlag.Memo;
557
- }
558
- if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef", initPath)) {
559
- flag |= ERComponentFlag.ForwardRef;
560
- }
561
- return flag;
562
- }
563
563
  function useComponentCollectorLegacy() {
564
564
  const components = /* @__PURE__ */ new Map();
565
565
  const ctx = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.26.3-beta.8",
3
+ "version": "1.26.3-next.1",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -41,15 +41,15 @@
41
41
  "@typescript-eslint/utils": "^8.23.0",
42
42
  "birecord": "^0.1.1",
43
43
  "ts-pattern": "^5.6.2",
44
- "@eslint-react/ast": "1.26.3-beta.8",
45
- "@eslint-react/shared": "1.26.3-beta.8",
46
- "@eslint-react/jsx": "1.26.3-beta.8",
47
- "@eslint-react/var": "1.26.3-beta.8",
48
- "@eslint-react/eff": "1.26.3-beta.8"
44
+ "@eslint-react/ast": "1.26.3-next.1",
45
+ "@eslint-react/eff": "1.26.3-next.1",
46
+ "@eslint-react/jsx": "1.26.3-next.1",
47
+ "@eslint-react/shared": "1.26.3-next.1",
48
+ "@eslint-react/var": "1.26.3-next.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "^8.3.6",
52
- "@local/configs": "0.0.0"
52
+ "@workspace/configs": "0.0.0"
53
53
  },
54
54
  "engines": {
55
55
  "bun": ">=1.0.15",