Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b05b0cb

Browse filesBrowse files
Do not look up as prop
1 parent 8abef65 commit b05b0cb
Copy full SHA for b05b0cb

File tree

Expand file treeCollapse file tree

2 files changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-3
lines changed

‎lib/rules/a11y-no-title-attribute.js

Copy file name to clipboardExpand all lines: lib/rules/a11y-no-title-attribute.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = {
5050
create(context) {
5151
return {
5252
JSXElement: node => {
53-
const elementType = getElementType(context, node.openingElement)
53+
const elementType = getElementType(context, node.openingElement, true)
5454
if (elementType !== `iframe` && ifSemanticElement(context, node)) {
5555
const titleProp = getPropValue(getProp(node.openingElement.attributes, `title`))
5656
if (titleProp) {

‎lib/utils/get-element-type.js

Copy file name to clipboardExpand all lines: lib/utils/get-element-type.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ If a prop determines the type, it can be specified with `props`.
77
88
For now, we only support the mapping of one prop type to an element type, rather than combinations of props.
99
*/
10-
function getElementType(context, node, ignoreMap = false) {
10+
function getElementType(context, node, lazyElementCheck = false) {
1111
const {settings} = context
1212

13+
if (lazyElementCheck) {
14+
return elementType(node)
15+
}
16+
1317
// check if the node contains a polymorphic prop
1418
const polymorphicPropName = settings?.github?.polymorphicPropName ?? 'as'
1519
const rawElement = getLiteralPropValue(getProp(node.attributes, polymorphicPropName)) ?? elementType(node)
1620

1721
// 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
1923

2024
const defaultComponent = settings.github.components[rawElement]
2125

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.