JoshuaKGoldberg / JoshuaKGoldberg/formatly

🐛 Bug: cwd option doesn't work for in-memory Prettier

Open
#563 2 comments 0 reactions 0 assignees View on GitHub
status: accepting prs type: bug
Dominant language
TypeScript
Stars
47
Forks
3
Avg merge
34m
Merged PRs (30d)
38

Description

### Bug Report Checklist

- [x] I have tried restarting my IDE and the issue persists.
- [x] I have pulled the latest `main` branch of the repository.
- [x] I have [searched for related issues](https://github.com/JoshuaKGoldberg/formatly/issues?q=is%3Aissue) and found none that matched my issue.

### Expected

Formatting with Prettier when Prettier is installed formats from options.cwd

### Actual

Formatting with Prettier when Prettier is installed resolves from options.cwd, but formats from process.cwd().

### Additional Info

This isn't breaking anything for me, I just noticed it while taking a look at https://github.com/prettier/prettier/issues/17422#issuecomment-5287820840.

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the report. Start by locating the in-memory Prettier formatting path and trace how options.cwd is used for module resolution versus formatting. Confirm the fix by checking that formatting uses options.cwd rather than process.cwd().

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.