John the Baptist said he wasn’t even worthy to bear the shoes of Jesus though, right?
He is a humble man who humble himself to God and do His will. He did say he is not even worthy to bear the shoes of Jesus, that doesn’t make him a sinful person.
As for the definition of righteousness, I like the Scofield note on it for Luke 2:25:
Some examples of men who were declared righteous (verses show where) yet also clearly sinned:
-Noah (Genesis 7:1, Ezekiel 14:14), who made the mistake of getting drunk and thus got taken advantage of by his daughters.
-David (1 Samuel 29:6, 2 Samuel 22:21-24), who committed adultery with a woman, fathered an illegitimate child with her, had her husband killed to cover it up, got rebuked by God’s prophet for hiding it, and was severely punished by God as a result.
-Job (Job 1:1, 1:8, 2:3, Ezekiel 14:14), ended up admitting at the end of the book that he had talked about things he knew nothing about, so that he abhorred himself and repented in dust and ashes.
-Daniel (Ezekiel 14:14), specifically admitted he had sinned and committed iniquity (Daniel 9:5-20).
The point of the matter is this. They sinned and repented. Many of the saints of the Church were no different. They sinned and repented. Saul sinned before his conversion and became Paul. St. Augustine, my patron saint lived a sinful life. But their actions, a Christians through the merits of God’s grace can live sinless lives if they live the commandments. You don’t live by these, and sin, you die a second death. Of course if you repent, you will be reward.