question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Space is not being inserted before brace for normal function declarations since 1.5.3

See original GitHub issue
function foo (){  // <--- no space before left brace
  console.log('test')
}

.prettierrc:

{
  "bracesSpacing": true,
  "bracketSpacing": false,
  "jsxSingleQuote": true,
  "semi": false,
  "singleQuote": true,
  "spaceBeforeFunctionParen": true,
}

Used to work fine in 1.5.2-fix

Also --no-braces-spacing option does not appear to work. I had to use .prettierrc.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
perichcommented, Aug 3, 2017

That flag doesn’t change the behavior of this bug for me. All function declarations omit the space between the parens and opening brace on the current build.

var foo = function bar() {
}

gets formatted to

var foo = function bar(){
}

Same is true for anonymous functions passed as arguments.

1reaction
boeserwolfcommented, Aug 29, 2018

Hi guys, after doing some research, using --space-empty-fn solves this issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"insert space between empty braces" not working as expected
The space should be inserted instantly on closing brace, because VS formatter is instant by default for almost all formatting settings. but not...
Read more >
Why are spaces required before a curly brace in a function ...
From Bash manual: The braces are reserved words, so they must be separated from the list by blanks or other shell metacharacters. function ......
Read more >
Clang-Format Style Options - bcain-llvm
SBPO_ControlStatements (in configuration: ControlStatements ) Put a space before opening parentheses only after control statement keywords ( for/if/while... ).
Read more >
Writing R Extensions - The Comprehensive R Archive Network
The sources of an R package consist of a subdirectory containing the files DESCRIPTION and NAMESPACE , and the subdirectories R , data...
Read more >
Groovy Language Documentation
Multiline comments can thus be put at the end of a statement, ... the case where the curly braces come immediately after an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found