"And these are the years of the life of Ishmael, one hundred years, etc." (Genesis 25:17). And why were the years of his life written? So that we may know through it how many years Jacob was when he was blessed by his father. "And he expired and died" (Genesis 25:17). Every place where "expiring" is stated, he was a righteous man.
Why Scripture Records Ishmael's Lifespan and the Word for a Righteous Death
Midrash Aggadah, Genesis 25:17
ואלה שני חיי ישמעאל מאת שנה וגו'. ולמה נכתבו שני חייו, כדי שנדע בו כמה שנים היה יעקב כשנתברך מאביו: ויגוע וימת. כל מקום שנאמר גויה צדיק היה: