Update checked-in dependencies
This commit is contained in:
parent
2bb35eab2f
commit
200dd0cf5b
88 changed files with 1039 additions and 527 deletions
13
node_modules/eslint-plugin-github/lib/utils/get-element-type.js
generated
vendored
13
node_modules/eslint-plugin-github/lib/utils/get-element-type.js
generated
vendored
|
|
@ -16,15 +16,22 @@ function getElementType(context, node, lazyElementCheck = false) {
|
|||
|
||||
// check if the node contains a polymorphic prop
|
||||
const polymorphicPropName = settings?.github?.polymorphicPropName ?? 'as'
|
||||
|
||||
const prop = getProp(node.attributes, polymorphicPropName)
|
||||
const literalPropValue = getLiteralPropValue(getProp(node.attributes, polymorphicPropName))
|
||||
let checkConditionalMap = true
|
||||
|
||||
// If the prop is not a literal and we cannot determine it, don't fall back to the conditional map value, if it exists
|
||||
if (prop && !literalPropValue) {
|
||||
checkConditionalMap = false
|
||||
}
|
||||
const rawElement = getLiteralPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
|
||||
|
||||
// if a component configuration does not exists, return the raw element
|
||||
if (!settings?.github?.components?.[rawElement]) return rawElement
|
||||
|
||||
const defaultComponent = settings.github.components[rawElement]
|
||||
|
||||
// check if the default component is also defined in the configuration
|
||||
return defaultComponent ? defaultComponent : defaultComponent
|
||||
return checkConditionalMap ? settings.github.components[rawElement] : rawElement
|
||||
}
|
||||
|
||||
module.exports = {getElementType}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue