Yōga Sūtras
Yōga Sūtra 3.14
शान्तोदिताव्यपदेश्यधर्मानुपाती धर्मी।
When thoughts during peaceful state, aroused state, as well as those about to come in the future are all in tune with dharma, the person is said to be dharmi, one who follows dharma.