Skip to content

Commit a4a9732

Browse files
committed
fix(core): fix component name utils
1 parent 59a31d2 commit a4a9732

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import type * as AST from "@eslint-react/ast";
2-
import { F, O } from "@eslint-react/eff";
2+
import { O } from "@eslint-react/eff";
33
import type { RuleContext } from "@eslint-react/types";
44

55
import { getFunctionComponentIdentifier } from "./component-id";
66
import { isComponentName } from "./component-name";
77

88
export function hasNoneOrValidComponentName(node: AST.TSESTreeFunction, context: RuleContext) {
9-
return F.pipe(
10-
getFunctionComponentIdentifier(node, context),
11-
O.exists(id => {
12-
const name = Array.isArray(id)
13-
? id.at(-1)?.name
14-
: id.name;
15-
return !!name && isComponentName(name);
16-
}),
17-
);
9+
const mbIdentifier = getFunctionComponentIdentifier(node, context);
10+
if (O.isNone(mbIdentifier)) {
11+
return true;
12+
}
13+
const id = mbIdentifier.value;
14+
const name = Array.isArray(id)
15+
? id.at(-1)?.name
16+
: id.name;
17+
return !!name && isComponentName(name);
1818
}

0 commit comments

Comments
 (0)