With coc.nvim, I use this in my coc-settings.json:
coc.nvim
coc-settings.json
"[elixir]": { "coc.preferences.formatOnSave": true },