For example I got:
<Image
alt=""
src="/img/logo.svg"
width="30"
height="30"
className="d-inline-block align-top"
/>
Any plugin to sort these attributes according to some rules, such as alphabetical order, type, etc.? I am using VS Code, ESLint and Prettier.
2
Answers
First select the lines you want sorted, then press
ctrl + shift + p
(orcmd + shift + p
on mac) to open command palette in vscode. Search forSort Lines Ascending
(or Descending).Try to use ESLint Perfectionist and sort-jsx-props rule:
https://perfectionist.dev/rules/sort-jsx-props
There information about usage with VS Code:
https://perfectionist.dev/guide/integrations#visual-studio-code