e5e3132ddd
Introduce two new ESLint rules that prevent the use of `jotaiStore` and direct calls to `.atomFamily()` or `.selectorFamily()` within component selector `get` callbacks. These rules promote cleaner and more reactive code practices. Fixed file touched by those new rules : `calendarDayRecordIdsComponentFamilySelector`
19 lines
367 B
TypeScript
19 lines
367 B
TypeScript
import { type TSESTree } from '@typescript-eslint/utils';
|
|
|
|
export const isNodeInsideAncestor = (
|
|
node: TSESTree.Node,
|
|
ancestor: TSESTree.Node,
|
|
): boolean => {
|
|
let nextParent: TSESTree.Node | undefined = node.parent;
|
|
|
|
while (nextParent) {
|
|
if (nextParent === ancestor) {
|
|
return true;
|
|
}
|
|
|
|
nextParent = nextParent.parent;
|
|
}
|
|
|
|
return false;
|
|
};
|