Extension doesn't notify user of syntax error in config files
See original GitHub issuePrettier supports a lot of configuration file names, as noted on the following list, from their docs’ configuration page:
Prettier uses cosmiconfig for configuration file support. This means you can configure prettier via:
- A .prettierrc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json/.js.
- A prettier.config.js file that exports an object.
- A “prettier” key in your package.json file.
I tried both .prettierrc.js and prettier.config.js. Prettier works as usual, following my configurations, but the extension doesn’t seem to look for either of them, falling back to default settings. It outputs the following message: Failed to resolve config for /home/user/example/file/name.js. Falling back to the default config settings.
Just for context, I’m configuring prettier by javascript to be able to require a template configuration from a npm package.
Does anyone else have had the same issue before? I searched for the error message, but couldn’t find any related issue.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
Version 3.16.0 will now show an error when an invalid configuration file is detected.
Ok, so that’s the part of the code that emits the error message:
And that’s resolveConfig definition:
So I tried running
prettier.resolveConfig(myFilePath, { editorconfig: true })
just like Prettier VSCode does (with the same prettier version too), but it actually works and resolves the config as expected. I’ll try to debug the extension and see what actually is the value oferror
.