Skip to content

Commit 9bd7c06

Browse files
committed
use literal prop value method
1 parent f54eae3 commit 9bd7c06

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/utils/get-element-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {elementType, getProp, getPropValue} = require('jsx-ast-utils')
1+
const {elementType, getProp, getLiteralPropValue} = require('jsx-ast-utils')
22

33
/*
44
Allows custom component to be mapped to an element type.
@@ -12,7 +12,7 @@ function getElementType(context, node, ignoreMap = false) {
1212

1313
// check if the node contains a polymorphic prop
1414
const polymorphicPropName = settings?.github?.polymorphicPropName ?? 'as'
15-
const rawElement = getPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
15+
const rawElement = getLiteralPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
1616

1717
// if a component configuration does not exists, return the raw element
1818
if (ignoreMap || !settings?.github?.components?.[rawElement]) return rawElement

lib/utils/get-role.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {getProp, getPropValue} = require('jsx-ast-utils')
1+
const {getProp, getLiteralPropValue} = require('jsx-ast-utils')
22
const {elementRoles} = require('aria-query')
33
const {getElementType} = require('./get-element-type')
44
const ObjectMap = require('./object-map')
@@ -43,7 +43,7 @@ function cleanElementRolesMap() {
4343
*/
4444
function getRole(context, node) {
4545
// Early return if role is explicitly set
46-
const explicitRole = getPropValue(getProp(node.attributes, 'role'))
46+
const explicitRole = getLiteralPropValue(getProp(node.attributes, 'role'))
4747
if (explicitRole) {
4848
return explicitRole
4949
}
@@ -80,7 +80,7 @@ function getRole(context, node) {
8080
continue
8181
}
8282

83-
const value = getPropValue(propOnNode)
83+
const value = getLiteralPropValue(propOnNode)
8484
if (value || (value === '' && prop === 'alt')) {
8585
if (
8686
prop === 'href' ||

0 commit comments

Comments
 (0)