I have a JS file with about 1,000 variables that looks like this:
export const FruitOrange: React.FC = () => (
<Trans id="fruit.orange">Orange</Trans>
);
export const FruitApple: React.FC = () => (
<Trans id="fruit.apple">Apple</Trans>
);
I want to sort all the variables in this to be in alphabetical order.
In other words, I want to sort the variable declarations so that FruitApple
comes before FruitOrange
.
How can I do this?
- VSCode cannot do this as of 2023.
- I have PHPStorm, and I tried configuring arrangement rules for JavaScript and TypeScript, but even though I set the Order for each matching rule to Order by name, when I reformat the code, it is not in alphabetical order.
I just need to reformat the file once; any tool that can do this automatically is acceptable; I just don't want to hand-sort 1,000 variables.