Unable to add a space before function parens
See original GitHub issueDefault 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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:29
- Comments:35 (3 by maintainers)
Top Results From Across the Web
VS Code - space before function parentheses - Stack Overflow
In VS Code open File -> Preferences -> Settings; Add to your JSON config: "javascript.format.insertSpaceBeforeFunctionParenthesis": true.
Read more >space-before-function-paren - Pluggable JavaScript Linter
This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.
Read more >Prettier Function Parenthesis Spacing - Opinionated is Key
Upon running Prettier, I noticed that it kept adding spaces between the function keyword and the argument parenthesis. For example (demo):.
Read more >C++ Formatting's Spacing for Function Parentheses would ...
This highlights a vague, obscure bug in the C++ document parser that is attempting to format C++ documents. In reality, typedef function pointer...
Read more >Prettier-space-parenthesis - npm.io
I know but code without spaces looks ugly for me. Why adding a space before a if () , while () and not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Even when I add
spaceBeforeFunctionParen
astrue
in the.prettierrc
file, when running Format Document in avue
file, the space between the keywordfunction
and the parenthesis is removed. So fromdata () {}
(which is what I need so ESLint doesn’t complain) it turn intodata() {}
. 😦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.