Prettier ignoring eslint rule: operator-linebreak
See original GitHub issueVersions:
prettier-eslint
version: 8.8.2node
version: 8.11.3npm
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:
- Created 5 years ago
- Reactions:42
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Stale issue