@ospm/eslint-plugin-react-signals-hooks
Version:
ESLint plugin for React Signals hooks - enforces best practices, performance optimizations, and integration patterns for @preact/signals-react usage in React projects
28 lines • 769 B
JavaScript
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
/**
* Returns true if the given node is within a JSXElement or JSXFragment.
*/
export function isInJSXContext(node) {
let parent = node.parent;
while (parent) {
if (parent.type === AST_NODE_TYPES.JSXElement || parent.type === AST_NODE_TYPES.JSXFragment) {
return true;
}
parent = parent.parent;
}
return false;
}
/**
* Returns true if the given node is within a JSXAttribute.
*/
export function isInJSXAttribute(node) {
let parent = node.parent;
while (parent) {
if (parent.type === AST_NODE_TYPES.JSXAttribute) {
return true;
}
parent = parent.parent;
}
return false;
}
//# sourceMappingURL=jsx.js.map