Since moving to use prettier-eslint prettier doesn't seem to respect the 80 column line width default setting and leaves long lines of code as they are. Is this because the ESLint config doesn't specify a max line length?
It's handy to have prettier deal with 95% of the code that goes beyond 80 columns but for ESLint not to warn about lines that go beyond that length in old code bases, is there any way of enabling my previous development experience without dropping prettier-eslint?
You need to set max-len: "off" in your eslint config and the prettier default of 80 will apply.
Good luck!
Thanks for getting back to me so soon, it's appreciated.
Sadly your suggestion doesn't seem to have any effect. Just to test I set max-len to 80 and that brought back the old behavior along with errors for long lines that prettier couldn't handle.
Odd because your suggestion makes sense but I think what's happening is that this code here (https://github.com/prettier/prettier-eslint/blob/da46ba78c8c16d1056d00605814e7cf5c9117bf0/src/utils.js#L92) needs to be tweaked, instead of letting prettier use it's default values prettier-eslint is picking up the ESLint rule that disables the max-len rule and disabling line length formatting (I presume printWidth of 0 means prettier does nothing).
If that's the case this is a tricky one to fix, I only have max-len of 0 because I inherited it via prettier-eslint-config...but if I explicitly set it to 0 I'd like it respected...
Although if you want to disable that rule you would just set it to "off" as this comment states https://github.com/prettier/eslint-config-prettier/blob/master/index.js#L5
Maybe the solution is to check the value...if max-len is 0 that means use prettier's default value else use the configured value. Does that make sense?
Maybe the solution is to check the value...if max-len is 0 that means use prettier's default value else use the configured value. Does that make sense?
Yep, that makes sense. The change goes here and a new test case would go here. Should be fairly straightforward.
Please see the contributing guidelines. Thanks!
I think this has been resolved...
Had a PR been made for this? I have something similar to the problem but I can't pine point the exact source of the problem yet so I'm just chasing potentially related github issues. Sorry for bringing back to life an old issue. :)
@Nargonath Yes, see this commit https://github.com/prettier/prettier-eslint/commit/d9d79af214e58d4bdedc0d0532c7566515ac7682
Most helpful comment
You need to set
max-len: "off"in your eslint config and the prettier default of80will apply.Good luck!