File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ module.exports = {
50
50
create ( context ) {
51
51
return {
52
52
JSXElement : node => {
53
- const elementType = getElementType ( context , node . openingElement )
53
+ const elementType = getElementType ( context , node . openingElement , true )
54
54
if ( elementType !== `iframe` && ifSemanticElement ( context , node ) ) {
55
55
const titleProp = getPropValue ( getProp ( node . openingElement . attributes , `title` ) )
56
56
if ( titleProp ) {
Original file line number Diff line number Diff line change @@ -7,15 +7,19 @@ If a prop determines the type, it can be specified with `props`.
7
7
8
8
For now, we only support the mapping of one prop type to an element type, rather than combinations of props.
9
9
*/
10
- function getElementType ( context , node , ignoreMap = false ) {
10
+ function getElementType ( context , node , lazyElementCheck = false ) {
11
11
const { settings} = context
12
12
13
+ if ( lazyElementCheck ) {
14
+ return elementType ( node )
15
+ }
16
+
13
17
// check if the node contains a polymorphic prop
14
18
const polymorphicPropName = settings ?. github ?. polymorphicPropName ?? 'as'
15
19
const rawElement = getLiteralPropValue ( getProp ( node . attributes , polymorphicPropName ) ) ?? elementType ( node )
16
20
17
21
// if a component configuration does not exists, return the raw element
18
- if ( ignoreMap || ! settings ?. github ?. components ?. [ rawElement ] ) return rawElement
22
+ if ( ! settings ?. github ?. components ?. [ rawElement ] ) return rawElement
19
23
20
24
const defaultComponent = settings . github . components [ rawElement ]
21
25
You can’t perform that action at this time.
0 commit comments