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.

Line Length Issues - All the time

See original GitHub issue

Versions:

  • prettier-eslint version: 8.8.2
  • node version: 10.6.0
  • npm (or yarn) version: 1.7.0

Have you followed the debugging tips?

Yes

Relevant code or config

function getHashDiffPromiseOf(type, model, nextHashData, blockNumber, transaction) {
  return Promise.all(
    Object.keys(nextHashData).map(value => applyHashDiffFor(
      model,
      { [type]: value },
      nextHashData[value],
      blockNumber,
      transaction,
    )),
  );
}

What I did:

Ran prettier-eslint

What happened:

It took a line that conforms to the eslint spec and breaks it:

function getHashDiffPromiseOf(type, model, nextHashData, blockNumber, transaction) {
  return Promise.all(
    Object.keys(nextHashData).map(value => applyHashDiffFor(model, { [type]: value }, nextHashData[value], blockNumber, transaction)),
  );
}

I often find myself having to try to force prettier in these case but sometimes this isn’t really possible.

function getHashDiffPromiseOf(type, model, nextHashData, blockNumber, transaction) {
  return Promise.all(
    Object.keys(nextHashData).map(value => applyHashDiffFor(
      // $ prettier dont break me! $ //
      model,
      { [type]: value },
      nextHashData[value],
      blockNumber,
      transaction,
    )),
  );
}

I strictly enforce 0 eslint errors on almost all of our projects so this is a constant problem for us 😦. Hoping its a straight forward fix!

Reproduction repository:

Not really needed, this type of things happens alll the time - I always find situations where its breaking this rule in some major way - often when it could easily get around it as well (like object call chains, etc).

"max-len": [
      "error",
      {
        "code": 100,
        "ignoreComments": true,
        "ignoreStrings": true,
        "ignoreTemplateLiterals": true
      }
    ]

that is the max-len config i currently have.

Suggested solution:

When it is going to be a change that breaks eslint rules, it should not make any change

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:50
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
jabacchettacommented, Feb 16, 2019

What did end up working for me is adding `“implicit-arrow-linebreak”: “off”.

This appears to be an ESLint bug.

0reactions
github-actions[bot]commented, May 27, 2020

Stale issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Readability: The Optimal Line Length - Baymard Institute
The optimal line length for body text is 50–75 characters · Shorter or longer line lengths can hurt readability · Our large-scale testing...
Read more >
Technical Blogs' Line Length Problem - TJ VanToll
“[I]f a line of text is too long the reader's eyes will have a hard time focusing on the text. This is because...
Read more >
Troubleshooting Line Length in HTML Email - Email On Acid
Line length is one of those tricky elements that can cause strange rendering issues in email clients. These problems may appear to take ......
Read more >
Line length revisited: following the research
Recent eye movement research is reviewed which questions whether long line lengths do cause reading difficulties.
Read more >
Size Matters: Balancing Line Length And Font Size In ...
When the time comes, sacrifice measure for a comfortable font size. A good font size (not too small) is readable. A good font...
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