Wellbore stability analysis in chemically active shale formations