So all Israel was recorded in genealogies, and these are written in the Book of the Kings of Israel. And Judah was taken into exile in Babylon because of their breach of faith. – 1 Chrn 9:1 (ESV)
The books of 1 & 2 Chronicles know that the kingdom of Israel and Judah will end. This is important to note – the author (or at least the final reviewer) can more accurately weigh the relative merits of each regime. Obviously, this is done with the Spirit's guidance, but the Spirit's insights are not different from what we would expect from what is revealed to us elsewhere in the Bible. If a king conducts great building projects, expands the borders, averts disaster from rival nations, has a long reign, and leads his people to victory in battle, but he does not obey and worship the Lord God, his rule is detestable in the eyes of God.