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.

Formatting: inline function with multiple arguments

See original GitHub issue

Prettier 1.15.1 Playground link

--parser babylon

Input:

function helloWorld() {
  useEffect(() => {
    // do something
  }, [props.value])
}

Output:

function helloWorld() {
  useEffect(
    () => {
      // do something
    },
    [props.value]
  );
}

Expected behavior:

Like input. Output seems a bit excessive.

If this is intended, please close. Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
vjeuxcommented, Nov 7, 2018

The inline version looks prettier to me

2reactions
j-f1commented, Dec 10, 2018

Feel free to open an issue or PR if this is important to you @ljharb.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to format function definition with arguments on multiple ...
Try: constructor:\ ( @a , @b , @c ) ->. Both trailing \ and leading , suppress newlines in CoffeeScript.
Read more >
Code Style: One argument per line in a multi-line function call
When splitting a function call over multiple lines, each parameter must be on a seperate line. Single line inline comments can take up...
Read more >
Arrow function expressions - JavaScript - MDN Web Docs
An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate ...
Read more >
Inline functions - Nintex help documentation
Represents a date time value in text of a specific format. Example. fn-FormatDate({WorkflowVariable:MyDate}, d). Arguments. Date A variable containing a date ...
Read more >
Code formatting in C++ Part Three - Level of Indirection
If there are more than 16 variable declarations in a group then use single lines of whitespace to break them up. Try to...
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