'options.editorconfig from prettier-cli

Is there a way to pass that options.editorconfig true flag using the cli without a configuration file. I can't get prettier to respect the .editorconfig file.

I don't way this isn't the default. An .editorconfig is a configuration file, way do I need another configuration just to honor the original configuration.

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

I have a directory with one .js file and an .editorconfig.

testdir:
    file01.js
    .editorconfig
root = true
indent_style = tab

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

[*.{html,json}]
indent_size = 2

running prettier from testdir using the cli with:

npx prettier -w .

formats the file01.js to use spaces as indentation. Since prettier is invoked from that directory it should see that .editorconfig file, it is not posting to a specific file path that could be any where.

I also naively tried to pass --editorconfig: npx prettier --editorconfig -w .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source