JoshuaKGoldberg / prettier-plugin-curly

Prettier plugin to enforce consistent brace style for all control statements. 🥌
MIT License
50 stars 2 forks source link

fix: support running inside a CommonJS module #577

Closed JoshuaKGoldberg closed 1 month ago

JoshuaKGoldberg commented 1 month ago

PR Checklist

Overview

The main fix here is removing "type": "module" from package.json 😞. Prettier loads in CJS mode no matter what, so trying to import .js files with ESM imports causes the require() complaints.

I couldn't figure out a clean way to get ESBuild/tsup to switch .js extensions in source files to switch to .cjs/.mjs in outputs. Which is probably for the best, that'd be spooky...

Two followups:

💖