-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolveConfigFile bug? #16344
Comments
👋 @Jack-Works! Try await require('prettier').resolveConfigFile(require('path').resolve(process.cwd(), 'foobar.json')) Config file is resolved relative to a file path, not dir path. |
👋 @Jack-Works, we use the issue tracker exclusively for development purposes. For questions, please use Stack Overflow. |
@kachkaev any reason why this shouldn't work with directories? Seems kind of wrong to have to put some random file name just to get this to work await require('prettier').resolveConfigFile(require('path').resolve(process.cwd(), 'foobar.json'))
// ^^ |
This was changed in #15363, but I intended to change behavior for I'm curious what the usage of |
Oh this would be awesome and actually what I need!
I wasn't sure why passing a directory to const configPath = await prettier.resolveConfigFile(dest);
if (!configPath) return;
const config = await prettier.resolveConfig(configPath); This is how I came across this issue because passing a directory to const configPath = await prettier.resolveConfigFile(`${dest}/hey.json`);
if (!configPath) return;
const config = await prettier.resolveConfig(configPath); All in all, if const config = await prettier.resolveConfig(dest); |
We can't accept directory in |
Can you clarify? Not sure how overrides effect this 🤔
❓ Doesn't this function recursively just look up the file path searching for a prettier config and returns it if it finds one? 🤔 |
prettier/src/config/resolve-config.js Line 64 in 1dfe28f
prettier/src/config/resolve-config.js Lines 86 to 105 in 1dfe28f
|
Ahhhh got ya! Thanks for the explanation 🙇🏽♂️ |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Environments:
Steps to reproduce:
run in a folder with a
.prettierrc
fileExpected behavior:
Resolve the file
Actual behavior:
null
The text was updated successfully, but these errors were encountered: