@eslint-react/core 1.24.0-next.4 → 1.24.0-next.6

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
@@ -1,11 +1,11 @@
1
1
  import * as AST from '@eslint-react/ast';
2
- import * as _eslint_react_eff from '@eslint-react/eff';
3
2
  import { _ } from '@eslint-react/eff';
4
3
  import { TSESTree } from '@typescript-eslint/types';
5
4
  import * as _eslint_react_shared from '@eslint-react/shared';
6
5
  import { RuleContext, CustomComponentNormalized } from '@eslint-react/shared';
7
6
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
8
7
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
8
+ import * as birecord from 'birecord';
9
9
  import { Scope } from '@typescript-eslint/scope-manager';
10
10
  import { SyntaxKind } from 'typescript';
11
11
 
@@ -129,6 +129,11 @@ declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, cont
129
129
 
130
130
  type ERComponentKind = "classComponent" | "functionComponent";
131
131
 
132
+ declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
133
+ declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
134
+ declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
135
+ declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
136
+
132
137
  type EREffectMethodKind = "useEffect" | "useInsertionEffect" | "useLayoutEffect";
133
138
  type ERLifecycleMethodKind = "componentDidMount" | "componentWillUnmount";
134
139
 
@@ -245,12 +250,7 @@ declare const isUseStateCall: (node: TSESTree.CallExpression | undefined, contex
245
250
  declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
246
251
  declare const isUseTransitionCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
247
252
 
248
- declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
249
- declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
250
- declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
251
- declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
252
-
253
- declare const ERPhaseRelevance: _eslint_react_eff.BiRecord<{
253
+ declare const ERPhaseRelevance: birecord.BiRecord<{
254
254
  readonly mount: "unmount";
255
255
  readonly setup: "cleanup";
256
256
  }>;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as AST from '@eslint-react/ast';
2
- import * as _eslint_react_eff from '@eslint-react/eff';
3
2
  import { _ } from '@eslint-react/eff';
4
3
  import { TSESTree } from '@typescript-eslint/types';
5
4
  import * as _eslint_react_shared from '@eslint-react/shared';
6
5
  import { RuleContext, CustomComponentNormalized } from '@eslint-react/shared';
7
6
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
8
7
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
8
+ import * as birecord from 'birecord';
9
9
  import { Scope } from '@typescript-eslint/scope-manager';
10
10
  import { SyntaxKind } from 'typescript';
11
11
 
@@ -129,6 +129,11 @@ declare function getFunctionComponentIdentifier(node: AST.TSESTreeFunction, cont
129
129
 
130
130
  type ERComponentKind = "classComponent" | "functionComponent";
131
131
 
132
+ declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
133
+ declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
134
+ declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
135
+ declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
136
+
132
137
  type EREffectMethodKind = "useEffect" | "useInsertionEffect" | "useLayoutEffect";
133
138
  type ERLifecycleMethodKind = "componentDidMount" | "componentWillUnmount";
134
139
 
@@ -245,12 +250,7 @@ declare const isUseStateCall: (node: TSESTree.CallExpression | undefined, contex
245
250
  declare const isUseSyncExternalStoreCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
246
251
  declare const isUseTransitionCall: (node: TSESTree.CallExpression | undefined, context: Readonly<_typescript_eslint_utils_ts_eslint.RuleContext<string, readonly unknown[]>>) => boolean;
247
252
 
248
- declare function isComponentDidMount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
249
- declare function isComponentWillUnmount(node: TSESTree.Node): node is TSESTree.MethodDefinition | TSESTree.PropertyDefinition;
250
- declare function isComponentDidMountFunction(node: TSESTree.Node): boolean;
251
- declare function isComponentWillUnmountFunction(node: TSESTree.Node): boolean;
252
-
253
- declare const ERPhaseRelevance: _eslint_react_eff.BiRecord<{
253
+ declare const ERPhaseRelevance: birecord.BiRecord<{
254
254
  readonly mount: "unmount";
255
255
  readonly setup: "cleanup";
256
256
  }>;
package/dist/index.js CHANGED
@@ -6,6 +6,9 @@ var JSX4 = require('@eslint-react/jsx');
6
6
  var types = require('@typescript-eslint/types');
7
7
  var VAR = require('@eslint-react/var');
8
8
  var shared = require('@eslint-react/shared');
9
+ var birecord = require('birecord');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
12
 
10
13
  function _interopNamespace(e) {
11
14
  if (e && e.__esModule) return e;
@@ -28,6 +31,7 @@ function _interopNamespace(e) {
28
31
  var AST8__namespace = /*#__PURE__*/_interopNamespace(AST8);
29
32
  var JSX4__namespace = /*#__PURE__*/_interopNamespace(JSX4);
30
33
  var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
34
+ var birecord__default = /*#__PURE__*/_interopDefault(birecord);
31
35
 
32
36
  // src/component/component-collector.ts
33
37
  function getElementNameAndRepresentName(node, context, polymorphicPropName, additionalComponents = []) {
@@ -639,16 +643,6 @@ function useComponentCollectorLegacy() {
639
643
  };
640
644
  return { ctx, listeners };
641
645
  }
642
- function isSetupFunction(node) {
643
- if (node == null) return eff._;
644
- return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
645
- }
646
- function isCleanupFunction(node) {
647
- const nearReturn = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
648
- const nearFunction = AST8__namespace.findParentNode(node, AST8__namespace.isFunction);
649
- const nearFunctionOfReturn = AST8__namespace.findParentNode(nearReturn, AST8__namespace.isFunction);
650
- return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
651
- }
652
646
  function isComponentDidMount(node) {
653
647
  return AST8__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
654
648
  }
@@ -661,7 +655,17 @@ function isComponentDidMountFunction(node) {
661
655
  function isComponentWillUnmountFunction(node) {
662
656
  return AST8__namespace.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
663
657
  }
664
- var ERPhaseRelevance = eff.birecord({
658
+ function isSetupFunction(node) {
659
+ if (node == null) return eff._;
660
+ return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
661
+ }
662
+ function isCleanupFunction(node) {
663
+ const nearReturn = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
664
+ const nearFunction = AST8__namespace.findParentNode(node, AST8__namespace.isFunction);
665
+ const nearFunctionOfReturn = AST8__namespace.findParentNode(nearReturn, AST8__namespace.isFunction);
666
+ return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
667
+ }
668
+ var ERPhaseRelevance = birecord__default.default({
665
669
  mount: "unmount",
666
670
  setup: "cleanup"
667
671
  });
package/dist/index.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as AST8 from '@eslint-react/ast';
2
- import { flip, birecord, dual, _, returnFalse } from '@eslint-react/eff';
2
+ import { flip, dual, _, returnFalse } from '@eslint-react/eff';
3
3
  import * as JSX4 from '@eslint-react/jsx';
4
4
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
5
5
  import * as VAR from '@eslint-react/var';
6
6
  import { unsafeDecodeSettings } from '@eslint-react/shared';
7
+ import birecord from 'birecord';
7
8
 
8
9
  // src/component/component-collector.ts
9
10
  function getElementNameAndRepresentName(node, context, polymorphicPropName, additionalComponents = []) {
@@ -615,16 +616,6 @@ function useComponentCollectorLegacy() {
615
616
  };
616
617
  return { ctx, listeners };
617
618
  }
618
- function isSetupFunction(node) {
619
- if (node == null) return _;
620
- return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
621
- }
622
- function isCleanupFunction(node) {
623
- const nearReturn = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ReturnStatement));
624
- const nearFunction = AST8.findParentNode(node, AST8.isFunction);
625
- const nearFunctionOfReturn = AST8.findParentNode(nearReturn, AST8.isFunction);
626
- return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
627
- }
628
619
  function isComponentDidMount(node) {
629
620
  return AST8.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
630
621
  }
@@ -637,6 +628,16 @@ function isComponentDidMountFunction(node) {
637
628
  function isComponentWillUnmountFunction(node) {
638
629
  return AST8.isFunction(node) && isComponentWillUnmount(node.parent) && node.parent.value === node;
639
630
  }
631
+ function isSetupFunction(node) {
632
+ if (node == null) return _;
633
+ return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
634
+ }
635
+ function isCleanupFunction(node) {
636
+ const nearReturn = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ReturnStatement));
637
+ const nearFunction = AST8.findParentNode(node, AST8.isFunction);
638
+ const nearFunctionOfReturn = AST8.findParentNode(nearReturn, AST8.isFunction);
639
+ return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
640
+ }
640
641
  var ERPhaseRelevance = birecord({
641
642
  mount: "unmount",
642
643
  setup: "cleanup"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.24.0-next.4",
3
+ "version": "1.24.0-next.6",
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": {
@@ -37,12 +37,13 @@
37
37
  "@typescript-eslint/type-utils": "^8.19.1",
38
38
  "@typescript-eslint/types": "^8.19.1",
39
39
  "@typescript-eslint/utils": "^8.19.1",
40
+ "birecord": "^0.1.1",
40
41
  "ts-pattern": "^5.6.0",
41
- "@eslint-react/ast": "1.24.0-next.4",
42
- "@eslint-react/jsx": "1.24.0-next.4",
43
- "@eslint-react/eff": "1.24.0-next.4",
44
- "@eslint-react/shared": "1.24.0-next.4",
45
- "@eslint-react/var": "1.24.0-next.4"
42
+ "@eslint-react/eff": "1.24.0-next.6",
43
+ "@eslint-react/jsx": "1.24.0-next.6",
44
+ "@eslint-react/ast": "1.24.0-next.6",
45
+ "@eslint-react/shared": "1.24.0-next.6",
46
+ "@eslint-react/var": "1.24.0-next.6"
46
47
  },
47
48
  "devDependencies": {
48
49
  "tsup": "^8.3.5",