prettier-cli icon indicating copy to clipboard operation
prettier-cli copied to clipboard

Experimental CLI does not support max_line_length from .editorconfig

Open HolgerJeromin opened this issue 6 months ago • 5 comments

Environments:

  • Prettier Version: 3.6.0
  • Running Prettier via: CLI
  • Runtime: Node
  • Operating System: Windows

Steps to reproduce:

..\node_modules\.bin\prettier.cmd --ignore-path ../.prettierignore --write . and ..\node_modules\.bin\prettier.cmd --ignore-path ../.prettierignore --experimental-cli --write . produces the same output. Hurray.

But having max_line_length = 120 in .editorconfig is not handled in experimental-cli.

HolgerJeromin avatar Jun 23 '25 10:06 HolgerJeromin

Interesting 🤔

That is indeed not supported at the moment in the thing we are using for parsing .editorconfig files.

Interestingly there's no mention of this property in EditorConfig's own website, but it seems mentioned in their wiki, that's why I didn't know this existed.

It should be an easy fix, thanks for reporting the issue 👍

fabiospampinato avatar Jun 23 '25 12:06 fabiospampinato

ref https://prettier.io/docs/options#print-width and other references to editorconfig at this page.

HolgerJeromin avatar Jun 23 '25 12:06 HolgerJeromin

While we are on this, please support "off"

https://github.com/prettier/prettier/blob/75bdb5d5de50308c396657dcbda70b60798f5d09/src/config/editorconfig/editorconfig-to-prettier.js#L48

Though there is an open issue about this, https://github.com/prettier/prettier/issues/17514, let's just align with the current behavior of Prettier.

fisker avatar Jun 23 '25 12:06 fisker

@fisker is there an issue in editorconfig's repo tracking that? 🤔 Is "off" documented in Prettier's docs?

fabiospampinato avatar Jun 23 '25 13:06 fabiospampinato

is there an issue in editorconfig's repo tracking that?

As far as I know, there is not.

Is "off" documented in Prettier's docs?

No, it's undocumented, but it's better to stay the way it works. We properly not going to do anything about https://github.com/prettier/prettier/issues/17514.

fisker avatar Jun 23 '25 15:06 fisker