@eslint-react/core 5.0.0-beta.0 → 5.0.1-beta.0

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -8
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import * as ast from "@eslint-react/ast";
2
2
  import { resolveImportSource } from "@eslint-react/var";
3
3
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
4
4
  import { isAPIFromReact as isAPIFromReact$1 } from "@eslint-react/core";
5
- import { IdGenerator, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE } from "@eslint-react/shared";
5
+ import { RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE } from "@eslint-react/shared";
6
+ import { ulid } from "ulid";
6
7
  import { JsxDetectionHint, isJsxLike } from "@eslint-react/jsx";
7
8
  import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/utils";
8
9
  import { P, isMatching, match } from "ts-pattern";
@@ -366,7 +367,6 @@ function isAssignmentToThisState(node) {
366
367
 
367
368
  //#endregion
368
369
  //#region src/class-component-collector.ts
369
- const idGen$2 = new IdGenerator("class-component:");
370
370
  /**
371
371
  * @param context The rule context.
372
372
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
@@ -380,7 +380,7 @@ function getClassComponentCollector(context) {
380
380
  const collect = (node) => {
381
381
  if (!isClassComponent(node)) return;
382
382
  const id = ast.getClassId(node);
383
- const key = idGen$2.next();
383
+ const key = ulid();
384
384
  const name = id == null ? null : ast.getFullyQualifiedName(id, getText);
385
385
  components.set(key, {
386
386
  id,
@@ -687,7 +687,6 @@ function isUseEffectCleanupCallback(node) {
687
687
 
688
688
  //#endregion
689
689
  //#region src/function-component-collector.ts
690
- const idGen$1 = new IdGenerator("component:");
691
690
  /**
692
691
  * Get an api and visitor object for the rule to collect function components
693
692
  * @param context The ESLint rule context
@@ -701,7 +700,7 @@ function getFunctionComponentCollector(context, options = {}) {
701
700
  const getText = (n) => context.sourceCode.getText(n);
702
701
  const getCurrentEntry = () => functionEntries.at(-1) ?? null;
703
702
  const onFunctionEnter = (node) => {
704
- const key = idGen$1.next();
703
+ const key = ulid();
705
704
  const exp = ast.findParent(node, (n) => n.type === AST_NODE_TYPES.ExportDefaultDeclaration);
706
705
  const isExportDefault = exp != null;
707
706
  const isExportDefaultDeclaration = exp != null && ast.getUnderlyingExpression(exp.declaration) === node;
@@ -720,9 +719,9 @@ function getFunctionComponentCollector(context, options = {}) {
720
719
  hint,
721
720
  hookCalls: [],
722
721
  initPath,
723
- isFunctionComponentDefinition: isFunctionComponentDefinition(context, node, hint),
724
722
  isExportDefault,
725
723
  isExportDefaultDeclaration,
724
+ isFunctionComponentDefinition: isFunctionComponentDefinition(context, node, hint),
726
725
  node,
727
726
  rets: []
728
727
  };
@@ -781,7 +780,6 @@ function getFunctionComponentCollector(context, options = {}) {
781
780
 
782
781
  //#endregion
783
782
  //#region src/hook-collector.ts
784
- const idGen = new IdGenerator("hook:");
785
783
  /**
786
784
  * Get an api and visitor object for the rule to collect hooks
787
785
  * @param context The ESLint rule context
@@ -794,7 +792,7 @@ function getHookCollector(context) {
794
792
  const getCurrentEntry = () => functionEntries.at(-1) ?? null;
795
793
  const onFunctionEnter = (node) => {
796
794
  const id = ast.getFunctionId(node);
797
- const key = idGen.next();
795
+ const key = ulid();
798
796
  const entry = {
799
797
  id,
800
798
  key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.0.0-beta.0",
3
+ "version": "5.0.1-beta.0",
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": {
@@ -34,10 +34,11 @@
34
34
  "@typescript-eslint/types": "^8.58.0",
35
35
  "@typescript-eslint/utils": "^8.58.0",
36
36
  "ts-pattern": "^5.9.0",
37
- "@eslint-react/ast": "5.0.0-beta.0",
38
- "@eslint-react/var": "5.0.0-beta.0",
39
- "@eslint-react/shared": "5.0.0-beta.0",
40
- "@eslint-react/jsx": "5.0.0-beta.0"
37
+ "ulid": "^3.0.2",
38
+ "@eslint-react/ast": "5.0.1-beta.0",
39
+ "@eslint-react/jsx": "5.0.1-beta.0",
40
+ "@eslint-react/shared": "5.0.1-beta.0",
41
+ "@eslint-react/var": "5.0.1-beta.0"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@typescript-eslint/typescript-estree": "^8.58.0",