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.

Single space in empty function body: fuction() {}->function() { }

See original GitHub issue

I am wandering if there is a way to configure the following behavior regarding formatting of empty functions (I need a single space in the { } brackets):

Input:

function foo() {
  
}

Output:

function foo() {}

Expected behavior: function foo() { }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lydellcommented, Feb 1, 2019

I need to be consistent with the formatting applied by other team members.

Then unfortunately Prettier isn’t the tool you’re looking for. It’s an opinionated formatter with few options by design. It reformats your entire file. I’d suggest convincing your team to start using Prettier, like @kachkaev mentions.

1reaction
lydellcommented, Feb 1, 2019

Hi! There isn’t! Is there a specific reason you need a space there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to write an empty function in Python - pass statement?
In Python, to write empty functions, we use pass statement. pass is a special statement in Python that does nothing. It only works...
Read more >
ESLint: disallow empty lines inside function body
I strongly believe that empty lines inside the body of a function are code smells indicating that we need to perform refactoring to...
Read more >
Add one space in inline empty function that can be wrapped ...
The documentation for this behaviour can be found here. The purpose of this space is to add this option to clang-format through the...
Read more >
Code style - Braces - Keep in one line if body is empty
WEB-53322 Javascript function with no body end braces placement ... Wrapping and Braces that will allow to keep braces in one line if...
Read more >
3. Functions — How to Think Like a Computer Scientist
A body consisting of one or more Python statements, each indented the same amount – 4 spaces is the Python standard – from...
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