来自 prettier-cli 的 options.editorconfig

kre*_*jan 8 editorconfig prettier

有没有一种方法可以options.editorconfig在没有配置文件的情况下使用 cli 传递该 true 标志。我不能变得更漂亮以尊重.editorconfig文件。

我不认为这不是默认的。.editorconfig 是一个配置文件,我是否需要另一个配置来遵守原始配置。

https://prettier.io/docs/en/configuration.html#editorconfig

我有一个包含一个.js文件和一个.editorconfig.

testdir:
    file01.js
    .editorconfig
Run Code Online (Sandbox Code Playgroud)
root = true
indent_style = tab

[*.{js,ts,css}]
indent_size = 4

[*.{html,json}]
indent_size = 2
Run Code Online (Sandbox Code Playgroud)

testdir使用 cli来运行更漂亮:

npx prettier -w .

格式化file01.js以使用空格作为缩进。由于 prettier 是从该目录调用的,因此它应该看到该.editorconfig文件,因此它不会发布到可能位于任何位置的特定文件路径。

我还天真地尝试通过--editorconfig: npx prettier --editorconfig -w .