I'm trying to format all TS files in my repo using Prettier CLI, but I'm running into an issue. Prettier CLI and Prettier VS Code extension are formatting anonymous functions differently.
When I format the TS files using the CLI: npx prettier "**/example.ts" --write
It formats anonymous functions like this:
const test = function () {
console.log('test');
};
And then when I save the file (which formats the file with Prettier) it changes to this:
const test = function() {
console.log('test');
};
Note the space after "function" goes away.
From some digging, I've found that Prettier does NOT put a space there. This aligns with the Prettier extension. Adding the space is more like a TS/ESLint style.
Does anyone know why Prettier CLI is adding this space?