Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialL S
6,540 PointsAutoformat on Save, Visual Studio Code, Prettier
I write this:
get activePlayer() {
return this.players.find(player => player.active);
}
But when i save VSCode formats it to this giving me an error:
get activePlayer() {
return this.players.find((player) => player.active);
}
player to (player)
How can i fix this?
I think it is done by Prettier, but i am not 100% sure
1 Answer
Steven Parker
231,275 PointsThose are both valid syntax, your original is just a shorthand version of the more formal one.
Neither one should cause any error.
L S
6,540 PointsL S
6,540 PointsI found an extension called "Formatting toggle" that can turn auto-formatting on and off, but if someone have any other good recommendations it would be appreciated