Here's M-W's take in their Manual for Writers and Editors:
When initials are used with a surname, they are spaced and punctuated. Unspaced initials of a few famous person, which
may or may not be punctuated, are sometimes used in place of their
E. M. Forster
C. P. E. Bach
JFK or J.F.K.
When used as a first name, I see both in ...