mirror of
https://github.com/bendtherules/react-fiber-traverse.git
synced 2026-08-19 00:33:38 +00:00
Fix prettier on all files
This commit is contained in:
+8
-2
@@ -48,7 +48,10 @@ function findNodeByComponent(
|
||||
}
|
||||
}
|
||||
{
|
||||
const returnVal = findNodeByComponent(node.sibling, expectedClassOrFunction);
|
||||
const returnVal = findNodeByComponent(
|
||||
node.sibling,
|
||||
expectedClassOrFunction
|
||||
);
|
||||
if (returnVal !== null) {
|
||||
return returnVal;
|
||||
}
|
||||
@@ -76,7 +79,10 @@ function findNodeByComponentRef(
|
||||
}
|
||||
}
|
||||
{
|
||||
const returnVal = findNodeByComponentRef(node.sibling, expectedClassInstance);
|
||||
const returnVal = findNodeByComponentRef(
|
||||
node.sibling,
|
||||
expectedClassInstance
|
||||
);
|
||||
if (returnVal !== null) {
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import * as React from "react";
|
||||
|
||||
export type FiberNode = FiberNodeForComponentClass | FiberNodeForFunctionComponent | FiberNodeForInstrinsicElement | FiberNodeForTextNode;
|
||||
export type FiberNode =
|
||||
| FiberNodeForComponentClass
|
||||
| FiberNodeForFunctionComponent
|
||||
| FiberNodeForInstrinsicElement
|
||||
| FiberNodeForTextNode;
|
||||
|
||||
export interface FiberNodeForFunctionComponent {
|
||||
child: FiberNode | null;
|
||||
@@ -52,4 +56,6 @@ export interface FiberNodeForTextNode {
|
||||
stateNode: Text;
|
||||
}
|
||||
|
||||
export type FiberNodeisHTMLLike = FiberNodeForInstrinsicElement | FiberNodeForTextNode;
|
||||
export type FiberNodeisHTMLLike =
|
||||
| FiberNodeForInstrinsicElement
|
||||
| FiberNodeForTextNode;
|
||||
|
||||
+4
-2
@@ -16,7 +16,7 @@ function* traverseGenerator(
|
||||
node: FiberNode,
|
||||
{
|
||||
order = ["self", "child", "sibling"]
|
||||
}: { order?: Array<"self"|"child"|"sibling"> } = {}
|
||||
}: { order?: Array<"self" | "child" | "sibling"> } = {}
|
||||
): IterableIterator<FiberNode> {
|
||||
let skipChild = false,
|
||||
skipSibling = false;
|
||||
@@ -52,7 +52,9 @@ function* traverseGenerator(
|
||||
};
|
||||
|
||||
// For each item mentioned in order, find generator functions to run
|
||||
const orderedGenerators = order.map((step) => traverseMap[step]).filter(tmp => tmp!==undefined);
|
||||
const orderedGenerators = order
|
||||
.map(step => traverseMap[step])
|
||||
.filter(tmp => tmp !== undefined);
|
||||
|
||||
// Now run each generator till end
|
||||
for (const eachGen of orderedGenerators) {
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@ function isNodeComponentClass(
|
||||
return isNodeNotHtmlLike(node) && node.stateNode instanceof React.Component;
|
||||
}
|
||||
|
||||
function isConstructorHtmlLike(ctr: React.ElementType): ctr is Exclude<React.ElementType, React.ComponentType> {
|
||||
function isConstructorHtmlLike(
|
||||
ctr: React.ElementType
|
||||
): ctr is Exclude<React.ElementType, React.ComponentType> {
|
||||
if (typeof ctr === "string" || ctr === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user