In the context of sustainable development, studying how corporate ESG performance affects the quality of accounting information can be significant for promoting its high-quality development. This study, based on the empirical analysis of A-share listed companies from 2014 to 2023, has found that enterprises’ ESG performance can significantly improve the quality of accounting information by alleviating financial constraints and reducing agency costs. It is also observed that digital transformation can positively regulate the effect of ESG performance on enterprises’ accounting-information quality. Besides, the heterogeneity results indicate that the ESG performance of state-owned enterprises and those in heavily polluting industry has a more significant effect on improving their accounting-information quality.