How to use Prettier to format source code and sorting Tailwind CSS classes

npm install --save-dev prettier prettier-plugin-tailwindcss

package.json

"scripts": {
  ...
  "format": "prettier --write ."
},
"prettier": {
  "plugins": [
    "prettier-plugin-tailwindcss"
  ]
}
npm run format