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.

Prettier ignoring eslint rule: operator-linebreak

See original GitHub issue

Versions:

  • prettier-eslint version: 8.8.2
  • node version: 8.11.3
  • npm version: 6.2.0

What I did: I formatted a javascript file with prettier installed within VSCode.

What happened: Prettier moved my operators to the end of the line before the line break even though my eslint rule is: 'operator-linebreak': ['error', 'before'] .

Problem description: It seems prettier is ignoring the operator-linebreak option.

Code Sample

    testMe() {
      const someVariable = {};

      return (
        someVariable &&
        someVariable.someProp &&
        someVariable.someProp.someArray.find(thing => thing > 99)
      );
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:42
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

45reactions
zimmecommented, Aug 9, 2018

Yes, that is correct. Prettier doesn’t have a config for this styling which means that we can’t change prettiers behaviour for this based on the eslint config.

I’d recommend using eslint-config-prettier when using this package as it will disable all eslint rules that conflict with prettier’s styling.

edit: Also most eslint rules’s auto fixes isn’t able to rearrange code on different lines.

13reactions
github-actions[bot]commented, May 26, 2020

Stale issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eslint and prettier conflict on operator-linebreak rule
1 Answer 1 · 3. This config will disable eslint rules, but I need to keep eslint rules and disable prettier rules ·...
Read more >
operator-linebreak - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Code formatting & linting with Prettier & ESLint - Think Tomorrow
Code formatting and code linting are important. Especially when working in a team. Let me explain to you why it matters and how...
Read more >
Prettier ignoring eslint rule: operator-linebreak - Bountysource
What I did: I formatted a javascript file with prettier installed within VSCode. What happened: Prettier moved my operators to the end of...
Read more >
Rationale - Prettier
We haven't been able to find a good rule for all those cases, so Prettier instead keeps objects multiline if there's a newline...
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