Format source fails with Prettier on patches with moved files where the original directory also does not exist
Categories
(Developer Infrastructure :: Lint and Formatting, task)
Tracking
(firefox70 fixed)
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: vporof, Assigned: vporof)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
For example, https://phabricator.services.mozilla.com/D37457
With --stdin-filepath
, Prettier still attempts to look for a configuration file in the directory containing the specified "virtual" file path. With file renames or usual file moves, this problem doesn't manifest itself since the parent directory still exists. However, when the whole original directory is moved or doesn't exist anymore, Prettier fails internally. This looks like a bug inside Prettier and confirmed by the returned code 2.
I've attempted to work around this by forcing Prettier to not look for configuration files, with a combination of --config-precedence
and --config
params, with no success. Prettier seems to either ignore those or simply always check for a configuration file regardless of those params, as long as --stdin-filepath
is passed, in the directory "containing" this "virtual" file path.
We can however also work around this by checking if the "virtual" file path for stdin actually exists or not. This seems to fix the problem and Prettier doesn't fail internally anymore with status code 2, and the merge completes successfully.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•