prettier-vscode: Unable to add a space before function parens

Default behavior for ESLint is to add a space before function parens. This is also a defined rule with StandardJS.

eslint space-before-function-paren

Currently, if you use the Prettier VS Code extension and enable "editor.formatOnSave": true in your settings.json the space between the function name and parens is removed on save. There is no way to control this behavior in Prettier.

space-parens

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 29
  • Comments: 35 (3 by maintainers)

Most upvoted comments

Even when I add spaceBeforeFunctionParen as true in the .prettierrc file, when running Format Document in a vue file, the space between the keyword function and the parenthesis is removed. So from data () {} (which is what I need so ESLint doesn’t complain) it turn into data() {}. 😦

This isn’t a problem with linting as much as it is a case of overreach and lack of configurability. The whole point of the original post is that it is turning an export into a function call, which changes the execution of that line of code.