File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
packages/core/src/component Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 11import type * as AST from "@eslint-react/ast" ;
2- import { F , O } from "@eslint-react/eff" ;
2+ import { O } from "@eslint-react/eff" ;
33import type { RuleContext } from "@eslint-react/types" ;
44
55import { getFunctionComponentIdentifier } from "./component-id" ;
66import { isComponentName } from "./component-name" ;
77
88export 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}
You can’t perform that action at this time.
0 commit comments