prettier-plugin-tailwindcss has been able to trim the classname to remove whitespace but now it no longer can. Check this Github issue
You can use an extension like Run On Save.
Configure your settings.json some rule: Auto run command from vscode extension on file save
And the pattern will be something like:
regular expression to remove space inside quotations
settings.json:
"vscode-runonsave":{ "commands":[ { "match":"\\.tsx\\$quot;, "cmd":" perl -i -pe 's/\\b\\s{2,}\\b/ /g' ${file}\\$quot; } ] }