Skip to content

formatter: nested configs #19509

@aaronadamsCA

Description

@aaronadamsCA

I think a single oxfmt run in the root of a monorepo should be enough to correctly and consistently format every file using its nearest config file.

If there's a discussion about nested configs and only nested configs, I'm sorry but I couldn't find it!

With this directory structure:

├── package-1/
│   ├── lib/
│   │   └── file-1.tsx
│   ├── package.json
├── package-2/
│   ├── lib/
│   │   └── file-2.tsx
│   ├── .oxfmtrc.json
│   ├── .prettierrc.json
│   ├── package.json
│   └── tailwind.css
├── .oxfmtrc.json
├── .prettierrc.json
└── package.json

Unfortunately Oxfmt is broken compared to Prettier:

  • prettier walks from each source file to its nearest config file
  • ⚠️ oxfmt uses the config file in the current working directory only

This makes it very hard to migrate to Oxfmt if you're using multiple Prettier configs and/or prettier-plugin-tailwindcss, because now you need to orchestrate per-package oxfmt runs, avoid their results colliding, do very weird things to configure the IDE, etc. etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions