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.

Unexpected new line before the body of a concise arrow function

See original GitHub issue

Prettier 1.15.3 Playground link

--parser babylon

Input:

expect(
  () => new GraphQLObjectType({
      field1: 'foo',
      field2: 'bar'
  })
);

Output:

expect(
  () =>
    new GraphQLObjectType({
      field1: "foo",
      field2: "bar"
    })
);

Expected behavior:

expect(
  () => new GraphQLObjectType({
      field1: 'foo',
      field2: 'bar'
  })
);

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
hawkrivescommented, Jan 9, 2019
0reactions
ShinJustinHolly3317commented, Nov 10, 2022

anyone working on this bug?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Line break within arrow function throws “Uncaught SyntaxError
Show activity on this post. I'm getting the error “Uncaught SyntaxError: Unexpected token => ” on my console when I put the e...
Read more >
Arrow function expressions - JavaScript - MDN Web Docs
Arrow functions can have either a concise body or the usual block body. In a concise body, only a single expression is specified,...
Read more >
implicit-arrow-linebreak - ESLint - Pluggable JavaScript Linter
An arrow function body can contain an implicit return as an expression instead of a block body ... "below" requires a newline before...
Read more >
Arrow Functions in JavaScript: Fat & Concise Syntax - SitePoint
When you only have one expression in your function body, you can make ES6 arrow syntax even more concise. You can keep everything...
Read more >
Arrow function expressions - JavaScript
Before arrow functions, every new function defined its own this value based on how ... In a concise body, only an expression is...
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