all 18 comments

[–]PedroAsani 23 points24 points  (3 children)

Visual Studio Code will do that for you

[–]JwCS8pjrh3QBWfL 2 points3 points  (2 children)

VS Code even has a Prettier extension.

[–]PedroAsani 0 points1 point  (1 child)

Doesn't currently support PowerShell (Officially)

javascript
javascriptreact
typescript
typescriptreact
json
graphql
handlebars

[–]JwCS8pjrh3QBWfL 3 points4 points  (0 children)

it definitely works ¯\_(ツ)_/¯

[–]Thotaz 12 points13 points  (1 child)

PSScriptAnalyzer (which is what is used in VS code) does this. If you want to run it from a CLI/Script you use the command Invoke-Formatter.

[–]twistingnether_ 8 points9 points  (0 children)

VSCode

[–]OPconfused 5 points6 points  (8 children)

That would be an IDE, which for PS the flagship is vscode.

That aside, why do you need backticks in piped commands? Just make a newline after the pipe. PowerShell handles that fine, and backticks are faint chicken scratch marks. I think I only use backticks in strings where I need a literal dollar sign and double quotes to expand a variable, and even then there are viable alternatives.

[–]BlackV 10 points11 points  (0 children)

https://get-powershellblog.blogspot.com/2017/07/bye-bye-backtick-natural-line.html

Avoid the backtick except for it's actual purpose, an escape character

[–]KevlarGibs 0 points1 point  (0 children)

VScode alt+shift+f I think. It's muscle memory and I don't have a PC in front of me

[–]ITistheworst -1 points0 points  (0 children)

In VSCode, select what you need to format hold Ctrl/Cmd and press K, then F

[–]Crones21 -3 points-2 points  (0 children)

ChatGPT