infinitered / reactotron

A desktop app for inspecting your React JS and React Native projects. macOS, Linux, and Windows.
https://docs.infinite.red/reactotron/
MIT License
14.81k stars 941 forks source link

Simplify prettier config #1407

Open joshuayoes opened 7 months ago

joshuayoes commented 7 months ago

Currently, there is a lot of copy and paste in our prettier config across workspaces.

We also have a script to copy and paste a .prettierignore file into all the workspaces https://github.com/infinitered/reactotron/blob/909427ed20ec271b3f0696c0ccbb20d7be1aebd7/scripts/copy-prettier-ignore.mjs

We should simplify it by creating one config as a workspace and then consume it in all the lib workspaces.

balindam commented 3 months ago

hey @joshuayoes,

I am thinking of picking up this issue. I wanted to discuss with you before proceeding.

are we thinking in the direction of creating a shared configuration package for prettier and then consuming that in all the lib workspaces?

joshuayoes commented 3 months ago

@balindam yes, that was how I was imagining it, that would be great

balindam commented 3 months ago

@joshuayoes while solving the above issue, I found that the .prettierignore file at the root directory applies to sub-directories as well. Then why were we copying the same .prettierignore file to sub-directories in the first place?

joshuayoes commented 3 months ago

Since the format:write and format:check jobs run in each workspace via nx, the prettier cli needs a .prettierignore file in the actual workspace directory. As far as I can tell, the prettier cli does not have a way to pass an option to look somewhere for an ignore file, like we can do with config files, so at the time it seemed easiest to copy the files to keep them in sync. It's not the most elegant solution, I would be open to other options.