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
resolveConfig(cwd)
fails to find config file
#15879
Comments
Broken by #15363, didn't know it's documented, I thought it's bug.. |
Maybe we can restore the old behavior, and add a new |
It's really bad that it accepts a dir path, which make no sense at all. Config files can have overrides, without file path the resolved config can be totally wrong. |
I agree that always passing the path to the actual file would be the best approach moving forward. However, this is a pretty hard break in documented behavior. Is it possible restore (but deprecate) the old behavior for compatibilty and include a warning in the docs, so the old behavior can be removed at a later time? There might be other tools that rely on the old directory lookup. |
I agree this is reasonable, but we'll have to add another usable/correct api, and it will be hard (and take a long time) to remove the new added one again. I highly doubt there are more broken cases. I say, we should just update the docs to reflect the current behavior. @sosukesuzuki need your opinion. |
@fisker I agree with you. It is enough to update the docs I think. If the same problem is reported repeatedly in the future, we can consider again. |
Would you like to update it? |
If you can do it, I want you to do it. |
Going to sleep..maybe later. |
@fisker If we should just update the documentation, can we remove this from 3.2 milestone? |
... not for the workspace directory. Passing a directory to resolveConfig was broken in prettier v3.1.1, as reported here: prettier/prettier#15879
... not for the workspace directory. Passing a directory to resolveConfig was broken in prettier v3.1.1, as reported here: prettier/prettier#15879
... not for the workspace directory. Passing a directory to resolveConfig was broken in prettier v3.1.1, as reported here: prettier/prettier#15879
Environments:
Steps to reproduce:
node ./test.js
Expected behavior:
The script prints the parsed contents of the
.prettierrc
inside that directory, sincecwd
is an explicitly supported input parameter (see https://prettier.io/docs/en/api.html#prettierresolveconfigfileurlorpath--options)Actual behavior:
The script prints
null
.Notes:
package.json
followed by runningnpm install
.node ./test.js
will print the expected outputdirname(cwd)
instead ofcwd
, thus never testing for the existence of.prettierrc
in the project directory.The text was updated successfully, but these errors were encountered: