@@ -502,60 +502,63 @@ module.exports = {
502
502
503
503
const tagName = getTagName ( node ) ;
504
504
505
- // Let's dive deeper into tags that are HTML/DOM elements (`<button>`), and not React components (`<Button />`)
506
- if ( isValidHTMLTagInJSX ( node ) ) {
507
- // Some attributes are allowed on some tags only
508
- const allowedTags = has ( ATTRIBUTE_TAGS_MAP , name ) ? ATTRIBUTE_TAGS_MAP [ name ] : null ;
509
- if ( tagName && allowedTags ) {
510
- // Scenario 1A: Allowed attribute found where not supposed to, report it
511
- if ( allowedTags . indexOf ( tagName ) === - 1 ) {
512
- report ( context , messages . invalidPropOnTag , 'invalidPropOnTag' , {
513
- node,
514
- data : {
515
- name,
516
- tagName,
517
- allowedTags : allowedTags . join ( ', ' ) ,
518
- } ,
519
- } ) ;
520
- }
521
- // Scenario 1B: There are allowed attributes on allowed tags, no need to report it
522
- return ;
523
- }
524
-
525
- // Let's see if the attribute is a close version to some standard property name
526
- const standardName = getStandardName ( name , context ) ;
505
+ if ( tagName === 'fbt' ) { return ; } // fbt nodes are bonkers, let's not go there
527
506
528
- const hasStandardNameButIsNotUsed = standardName && standardName !== name ;
529
- const usesStandardName = standardName && standardName === name ;
507
+ if ( ! isValidHTMLTagInJSX ( node ) ) { return ; }
530
508
531
- if ( usesStandardName ) {
532
- // Scenario 2A: The attribute name is the standard name, no need to report it
533
- return ;
534
- }
509
+ // Let's dive deeper into tags that are HTML/DOM elements (`<button>`), and not React components (`<Button />`)
535
510
536
- if ( hasStandardNameButIsNotUsed ) {
537
- // Scenario 2B: The name of the attribute is close to a standard one, report it with the standard name
538
- report ( context , messages . unknownPropWithStandardName , 'unknownPropWithStandardName' , {
511
+ // Some attributes are allowed on some tags only
512
+ const allowedTags = has ( ATTRIBUTE_TAGS_MAP , name ) ? ATTRIBUTE_TAGS_MAP [ name ] : null ;
513
+ if ( tagName && allowedTags ) {
514
+ // Scenario 1A: Allowed attribute found where not supposed to, report it
515
+ if ( allowedTags . indexOf ( tagName ) === - 1 ) {
516
+ report ( context , messages . invalidPropOnTag , 'invalidPropOnTag' , {
539
517
node,
540
518
data : {
541
519
name,
542
- standardName,
543
- } ,
544
- fix ( fixer ) {
545
- return fixer . replaceText ( node . name , standardName ) ;
520
+ tagName,
521
+ allowedTags : allowedTags . join ( ', ' ) ,
546
522
} ,
547
523
} ) ;
548
- return ;
549
524
}
525
+ // Scenario 1B: There are allowed attributes on allowed tags, no need to report it
526
+ return ;
527
+ }
528
+
529
+ // Let's see if the attribute is a close version to some standard property name
530
+ const standardName = getStandardName ( name , context ) ;
550
531
551
- // Scenario 3: We have an attribute that is unknown, report it
552
- report ( context , messages . unknownProp , 'unknownProp' , {
532
+ const hasStandardNameButIsNotUsed = standardName && standardName !== name ;
533
+ const usesStandardName = standardName && standardName === name ;
534
+
535
+ if ( usesStandardName ) {
536
+ // Scenario 2A: The attribute name is the standard name, no need to report it
537
+ return ;
538
+ }
539
+
540
+ if ( hasStandardNameButIsNotUsed ) {
541
+ // Scenario 2B: The name of the attribute is close to a standard one, report it with the standard name
542
+ report ( context , messages . unknownPropWithStandardName , 'unknownPropWithStandardName' , {
553
543
node,
554
544
data : {
555
545
name,
546
+ standardName,
547
+ } ,
548
+ fix ( fixer ) {
549
+ return fixer . replaceText ( node . name , standardName ) ;
556
550
} ,
557
551
} ) ;
552
+ return ;
558
553
}
554
+
555
+ // Scenario 3: We have an attribute that is unknown, report it
556
+ report ( context , messages . unknownProp , 'unknownProp' , {
557
+ node,
558
+ data : {
559
+ name,
560
+ } ,
561
+ } ) ;
559
562
} ,
560
563
} ;
561
564
} ,
0 commit comments