This study provides compelling evidence that greater adherence to the EAT-Lancet diet is associated with a reduced likelihood of T2D events among Shanghai residents. This highlights the critical importance of sustainable dietary patterns in preventing diabetes within the demographic context of China.