Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:6:85

And Zechariah and John and Jesus and Elias - and all were of the righteous.  

And Zachariah and, his son, John, and Jesus, son of Mary — this shows that ˹the term˺ ‘seed’ (dhurriyya) can include offspring from the female ˹side˺ — and Elias, the paternal nephew of Aaron, brother of Moses; all, of them, were of the righteous.
القرآن:٦:٨٥

وَزَكَرِيَّا وَيَحْيَىٰ وَعِيسَىٰ وَإِلْيَاسَ ۖ كُلٌّ مِنَ الصَّالِحِينَ  

{وزكريا ويحيى} ابنه {وعيسى} ابن مريم يفيد أن الذرية تتناول أولاد البنت {وإلياس} ابن أخي هارون أخي موسى {كل} منهم {من الصالحين}.