@eslint-react/core
Advanced tools
Comparing version 1.24.0-next.12 to 1.24.0-next.13
@@ -6,4 +6,4 @@ 'use strict'; | ||
var JSX3 = require('@eslint-react/jsx'); | ||
var shared = require('@eslint-react/shared'); | ||
var types = require('@typescript-eslint/types'); | ||
var shared = require('@eslint-react/shared'); | ||
var VAR = require('@eslint-react/var'); | ||
@@ -38,6 +38,2 @@ var birecord = require('birecord'); | ||
// src/component/component-collector.ts | ||
// src/utils/get-id.ts | ||
var id = 0n; | ||
var getId = () => (id++).toString(); | ||
function isInitializedFromReact(name, initialScope, importSource = "react") { | ||
@@ -176,4 +172,4 @@ return name.toLowerCase() === "react" || VAR__namespace.isInitializedFromSource( | ||
if (node == null) return eff._; | ||
const id2 = AST8__namespace.getFunctionIdentifier(node); | ||
return id2?.name != null && isReactHookName(id2.name); | ||
const id = AST8__namespace.getFunctionIdentifier(node); | ||
return id?.name != null && isReactHookName(id.name); | ||
} | ||
@@ -273,9 +269,9 @@ function isReactHookCall(node) { | ||
const onFunctionEnter = (node) => { | ||
const id2 = AST8__namespace.getFunctionIdentifier(node); | ||
const name = id2?.name; | ||
const id = AST8__namespace.getFunctionIdentifier(node); | ||
const name = id?.name; | ||
if (name != null && isReactHookName(name)) { | ||
const key = getId(); | ||
const key = shared.getId(); | ||
fEntries.push({ key, node }); | ||
hooks.set(key, { | ||
id: id2, | ||
id, | ||
key, | ||
@@ -449,5 +445,5 @@ kind: "function", | ||
function hasNoneOrValidComponentName(node, context) { | ||
const id2 = getFunctionComponentIdentifier(node, context); | ||
if (id2 == null) return true; | ||
const name = Array.isArray(id2) ? id2.at(-1)?.name : id2.name; | ||
const id = getFunctionComponentIdentifier(node, context); | ||
if (id == null) return true; | ||
const name = Array.isArray(id) ? id.at(-1)?.name : id.name; | ||
return name != null && isComponentName(name); | ||
@@ -503,3 +499,3 @@ } | ||
const onFunctionEnter = (node) => { | ||
const key = getId(); | ||
const key = shared.getId(); | ||
functionEntries.push({ key, node, hookCalls: [], isComponent: false }); | ||
@@ -545,7 +541,7 @@ }; | ||
const initPath = AST8__namespace.getFunctionInitPath(entry.node); | ||
const id2 = getFunctionComponentIdentifier(entry.node, context); | ||
const name = getComponentNameFromIdentifier(id2); | ||
const key = getId(); | ||
const id = getFunctionComponentIdentifier(entry.node, context); | ||
const name = getComponentNameFromIdentifier(id); | ||
const key = shared.getId(); | ||
components.set(key, { | ||
id: id2, | ||
id, | ||
key, | ||
@@ -597,6 +593,6 @@ kind: "function", | ||
const initPath = AST8__namespace.getFunctionInitPath(entry.node); | ||
const id2 = getFunctionComponentIdentifier(entry.node, context); | ||
const name = getComponentNameFromIdentifier(id2); | ||
const id = getFunctionComponentIdentifier(entry.node, context); | ||
const name = getComponentNameFromIdentifier(id); | ||
components.set(entry.key, { | ||
id: id2, | ||
id, | ||
key: entry.key, | ||
@@ -628,4 +624,4 @@ kind: "function", | ||
} | ||
const id2 = AST8__namespace.getClassIdentifier(node); | ||
const key = getId(); | ||
const id = AST8__namespace.getClassIdentifier(node); | ||
const key = shared.getId(); | ||
const flag = isPureComponent(node) ? ERClassComponentFlag.PureComponent : ERClassComponentFlag.None; | ||
@@ -635,6 +631,6 @@ components.set( | ||
{ | ||
id: id2, | ||
id, | ||
key, | ||
kind: "class", | ||
name: id2?.name, | ||
name: id?.name, | ||
node, | ||
@@ -720,3 +716,2 @@ // TODO: Get displayName of class component | ||
exports.getFunctionComponentIdentifier = getFunctionComponentIdentifier; | ||
exports.getId = getId; | ||
exports.hasNoneOrValidComponentName = hasNoneOrValidComponentName; | ||
@@ -723,0 +718,0 @@ exports.isCallFromReact = isCallFromReact; |
{ | ||
"name": "@eslint-react/core", | ||
"version": "1.24.0-next.12", | ||
"version": "1.24.0-next.13", | ||
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.", | ||
@@ -42,7 +42,7 @@ "homepage": "https://github.com/Rel1cx/eslint-react", | ||
"ts-pattern": "^5.6.0", | ||
"@eslint-react/ast": "1.24.0-next.12", | ||
"@eslint-react/eff": "1.24.0-next.12", | ||
"@eslint-react/jsx": "1.24.0-next.12", | ||
"@eslint-react/shared": "1.24.0-next.12", | ||
"@eslint-react/var": "1.24.0-next.12" | ||
"@eslint-react/ast": "1.24.0-next.13", | ||
"@eslint-react/jsx": "1.24.0-next.13", | ||
"@eslint-react/shared": "1.24.0-next.13", | ||
"@eslint-react/var": "1.24.0-next.13", | ||
"@eslint-react/eff": "1.24.0-next.13" | ||
}, | ||
@@ -49,0 +49,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
265516
4020
+ Added@eslint-react/ast@1.24.0-next.13(transitive)
+ Added@eslint-react/eff@1.24.0-next.13(transitive)
+ Added@eslint-react/jsx@1.24.0-next.13(transitive)
+ Added@eslint-react/shared@1.24.0-next.13(transitive)
+ Added@eslint-react/var@1.24.0-next.13(transitive)
- Removed@eslint-react/ast@1.24.0-next.12(transitive)
- Removed@eslint-react/eff@1.24.0-next.12(transitive)
- Removed@eslint-react/jsx@1.24.0-next.12(transitive)
- Removed@eslint-react/shared@1.24.0-next.12(transitive)
- Removed@eslint-react/var@1.24.0-next.12(transitive)