@eslint-react/core 1.23.0-beta.0 → 1.23.0-beta.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.js +5 -11
- package/dist/index.mjs +5 -8
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -4,14 +4,12 @@ var AST9 = require('@eslint-react/ast');
|
|
|
4
4
|
var eff = require('@eslint-react/eff');
|
|
5
5
|
var JSX4 = require('@eslint-react/jsx');
|
|
6
6
|
var types = require('@typescript-eslint/types');
|
|
7
|
-
var ShortUniqueId = require('short-unique-id');
|
|
8
7
|
var tsPattern = require('ts-pattern');
|
|
8
|
+
var uid = require('uid');
|
|
9
9
|
var shared = require('@eslint-react/shared');
|
|
10
10
|
var VAR = require('@eslint-react/var');
|
|
11
11
|
var types$1 = require('@eslint-react/types');
|
|
12
12
|
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
13
|
function _interopNamespace(e) {
|
|
16
14
|
if (e && e.__esModule) return e;
|
|
17
15
|
var n = Object.create(null);
|
|
@@ -32,7 +30,6 @@ function _interopNamespace(e) {
|
|
|
32
30
|
|
|
33
31
|
var AST9__namespace = /*#__PURE__*/_interopNamespace(AST9);
|
|
34
32
|
var JSX4__namespace = /*#__PURE__*/_interopNamespace(JSX4);
|
|
35
|
-
var ShortUniqueId__default = /*#__PURE__*/_interopDefault(ShortUniqueId);
|
|
36
33
|
var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
|
|
37
34
|
|
|
38
35
|
// src/component/component-collector.ts
|
|
@@ -242,7 +239,6 @@ var isUseTransitionCall = eff.F.flip(isReactHookCallWithName)("useTransition");
|
|
|
242
239
|
function isInsideReactHook(node) {
|
|
243
240
|
return eff.O.exists(AST9__namespace.traverseUpGuard(node, AST9__namespace.isFunction), isReactHook);
|
|
244
241
|
}
|
|
245
|
-
var uid = new ShortUniqueId__default.default({ length: 10 });
|
|
246
242
|
function useHookCollector() {
|
|
247
243
|
const hooks = /* @__PURE__ */ new Map();
|
|
248
244
|
const fStack = [];
|
|
@@ -250,7 +246,7 @@ function useHookCollector() {
|
|
|
250
246
|
const id = AST9__namespace.getFunctionIdentifier(node);
|
|
251
247
|
const name = eff.O.flatMapNullable(id, (id2) => id2.name);
|
|
252
248
|
if (eff.O.isSome(id) && eff.O.isSome(name) && isReactHookName(name.value)) {
|
|
253
|
-
const key = uid.
|
|
249
|
+
const key = uid.uid(10);
|
|
254
250
|
fStack.push([node, eff.O.some(key)]);
|
|
255
251
|
hooks.set(key, {
|
|
256
252
|
_: key,
|
|
@@ -363,7 +359,6 @@ function getComponentNameFromIdentifier(node) {
|
|
|
363
359
|
function isComponentName(name) {
|
|
364
360
|
return !!name && RE_COMPONENT_NAME.test(name);
|
|
365
361
|
}
|
|
366
|
-
var uid2 = new ShortUniqueId__default.default({ length: 10 });
|
|
367
362
|
function isClassComponent(node) {
|
|
368
363
|
if (!("superClass" in node && node.superClass)) return false;
|
|
369
364
|
const { superClass } = node;
|
|
@@ -412,7 +407,7 @@ function useComponentCollectorLegacy() {
|
|
|
412
407
|
const collect = (node) => {
|
|
413
408
|
if (!isClassComponent(node)) return;
|
|
414
409
|
const id = AST9__namespace.getClassIdentifier(node);
|
|
415
|
-
const key =
|
|
410
|
+
const key = uid.uid(10);
|
|
416
411
|
const flag = isPureComponent(node) ? ERClassComponentFlag.PureComponent : ERClassComponentFlag.None;
|
|
417
412
|
components.set(
|
|
418
413
|
key,
|
|
@@ -475,7 +470,6 @@ function hasNoneOrValidComponentName(node, context) {
|
|
|
475
470
|
}
|
|
476
471
|
|
|
477
472
|
// src/component/component-collector.ts
|
|
478
|
-
var uid3 = new ShortUniqueId__default.default({ length: 10 });
|
|
479
473
|
function hasValidHierarchy(node, context, hint) {
|
|
480
474
|
if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
|
|
481
475
|
return false;
|
|
@@ -521,7 +515,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
521
515
|
const components = /* @__PURE__ */ new Map();
|
|
522
516
|
const functionStack = [];
|
|
523
517
|
const getCurrentFunction = () => eff.O.fromNullable(functionStack.at(-1));
|
|
524
|
-
const onFunctionEnter = (node) => functionStack.push([
|
|
518
|
+
const onFunctionEnter = (node) => functionStack.push([uid.uid(10), node, false, []]);
|
|
525
519
|
const onFunctionExit = () => {
|
|
526
520
|
const [key, fn, isComponent] = functionStack.at(-1) ?? [];
|
|
527
521
|
if (!key || !fn || !isComponent) return functionStack.pop();
|
|
@@ -556,7 +550,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
556
550
|
const initPath = AST9__namespace.getFunctionInitPath(currentFn);
|
|
557
551
|
const id = getFunctionComponentIdentifier(currentFn, context);
|
|
558
552
|
const name = eff.O.flatMapNullable(id, getComponentNameFromIdentifier);
|
|
559
|
-
const key =
|
|
553
|
+
const key = uid.uid(10);
|
|
560
554
|
components.set(key, {
|
|
561
555
|
_: key,
|
|
562
556
|
id,
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import * as AST9 from '@eslint-react/ast';
|
|
|
2
2
|
import { F, isString, O } from '@eslint-react/eff';
|
|
3
3
|
import * as JSX4 from '@eslint-react/jsx';
|
|
4
4
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
5
|
-
import ShortUniqueId from 'short-unique-id';
|
|
6
5
|
import { isMatching, P, match } from 'ts-pattern';
|
|
6
|
+
import { uid } from 'uid';
|
|
7
7
|
import { normalizeSettings, decodeSettings, unsafeReadSettings } from '@eslint-react/shared';
|
|
8
8
|
import * as VAR from '@eslint-react/var';
|
|
9
9
|
import { birecord } from '@eslint-react/types';
|
|
@@ -215,7 +215,6 @@ var isUseTransitionCall = F.flip(isReactHookCallWithName)("useTransition");
|
|
|
215
215
|
function isInsideReactHook(node) {
|
|
216
216
|
return O.exists(AST9.traverseUpGuard(node, AST9.isFunction), isReactHook);
|
|
217
217
|
}
|
|
218
|
-
var uid = new ShortUniqueId({ length: 10 });
|
|
219
218
|
function useHookCollector() {
|
|
220
219
|
const hooks = /* @__PURE__ */ new Map();
|
|
221
220
|
const fStack = [];
|
|
@@ -223,7 +222,7 @@ function useHookCollector() {
|
|
|
223
222
|
const id = AST9.getFunctionIdentifier(node);
|
|
224
223
|
const name = O.flatMapNullable(id, (id2) => id2.name);
|
|
225
224
|
if (O.isSome(id) && O.isSome(name) && isReactHookName(name.value)) {
|
|
226
|
-
const key = uid
|
|
225
|
+
const key = uid(10);
|
|
227
226
|
fStack.push([node, O.some(key)]);
|
|
228
227
|
hooks.set(key, {
|
|
229
228
|
_: key,
|
|
@@ -336,7 +335,6 @@ function getComponentNameFromIdentifier(node) {
|
|
|
336
335
|
function isComponentName(name) {
|
|
337
336
|
return !!name && RE_COMPONENT_NAME.test(name);
|
|
338
337
|
}
|
|
339
|
-
var uid2 = new ShortUniqueId({ length: 10 });
|
|
340
338
|
function isClassComponent(node) {
|
|
341
339
|
if (!("superClass" in node && node.superClass)) return false;
|
|
342
340
|
const { superClass } = node;
|
|
@@ -385,7 +383,7 @@ function useComponentCollectorLegacy() {
|
|
|
385
383
|
const collect = (node) => {
|
|
386
384
|
if (!isClassComponent(node)) return;
|
|
387
385
|
const id = AST9.getClassIdentifier(node);
|
|
388
|
-
const key =
|
|
386
|
+
const key = uid(10);
|
|
389
387
|
const flag = isPureComponent(node) ? ERClassComponentFlag.PureComponent : ERClassComponentFlag.None;
|
|
390
388
|
components.set(
|
|
391
389
|
key,
|
|
@@ -448,7 +446,6 @@ function hasNoneOrValidComponentName(node, context) {
|
|
|
448
446
|
}
|
|
449
447
|
|
|
450
448
|
// src/component/component-collector.ts
|
|
451
|
-
var uid3 = new ShortUniqueId({ length: 10 });
|
|
452
449
|
function hasValidHierarchy(node, context, hint) {
|
|
453
450
|
if (isChildrenOfCreateElement(node, context) || isFunctionOfRenderMethod(node)) {
|
|
454
451
|
return false;
|
|
@@ -494,7 +491,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
494
491
|
const components = /* @__PURE__ */ new Map();
|
|
495
492
|
const functionStack = [];
|
|
496
493
|
const getCurrentFunction = () => O.fromNullable(functionStack.at(-1));
|
|
497
|
-
const onFunctionEnter = (node) => functionStack.push([
|
|
494
|
+
const onFunctionEnter = (node) => functionStack.push([uid(10), node, false, []]);
|
|
498
495
|
const onFunctionExit = () => {
|
|
499
496
|
const [key, fn, isComponent] = functionStack.at(-1) ?? [];
|
|
500
497
|
if (!key || !fn || !isComponent) return functionStack.pop();
|
|
@@ -529,7 +526,7 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
|
|
|
529
526
|
const initPath = AST9.getFunctionInitPath(currentFn);
|
|
530
527
|
const id = getFunctionComponentIdentifier(currentFn, context);
|
|
531
528
|
const name = O.flatMapNullable(id, getComponentNameFromIdentifier);
|
|
532
|
-
const key =
|
|
529
|
+
const key = uid(10);
|
|
533
530
|
components.set(key, {
|
|
534
531
|
_: key,
|
|
535
532
|
id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "1.23.0-beta.
|
|
3
|
+
"version": "1.23.0-beta.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": {
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"./package.json"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
37
|
-
"@typescript-eslint/type-utils": "^8.
|
|
38
|
-
"@typescript-eslint/types": "^8.
|
|
39
|
-
"@typescript-eslint/utils": "^8.
|
|
40
|
-
"short-unique-id": "^5.2.0",
|
|
36
|
+
"@typescript-eslint/scope-manager": "^8.19.0",
|
|
37
|
+
"@typescript-eslint/type-utils": "^8.19.0",
|
|
38
|
+
"@typescript-eslint/types": "^8.19.0",
|
|
39
|
+
"@typescript-eslint/utils": "^8.19.0",
|
|
41
40
|
"ts-pattern": "^5.6.0",
|
|
42
|
-
"
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
41
|
+
"uid": "^2.0.2",
|
|
42
|
+
"@eslint-react/ast": "1.23.0-beta.1",
|
|
43
|
+
"@eslint-react/eff": "1.23.0-beta.1",
|
|
44
|
+
"@eslint-react/shared": "1.23.0-beta.1",
|
|
45
|
+
"@eslint-react/types": "1.23.0-beta.1",
|
|
46
|
+
"@eslint-react/var": "1.23.0-beta.1",
|
|
47
|
+
"@eslint-react/jsx": "1.23.0-beta.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.3.5",
|