Oh and SJ lmk if you wanna thought dump on prettie...
# development
Oh and SJ lmk if you wanna thought dump on prettier supporting both targetless+targets
I'm extremely interested in this topic too
The tldr is have the targetless request target specs and just omit those from it's partition
Plus maybe a generic helper for other tools to do the same
Yes, definitely - I've got the markdowns everywheres in my codez and it needs a little prettier in its life
So, I don't know what the ideas here were - but what I can say is that as a user, I would want/expect/possibly desire something as straightforward as an array of globs in the
for a multi-target formatter. Not proposing this is the best, but we're competing against:
npx prettier --write .
If I have to do much configuration to replicate that, it feels silly. Now, if my equivalent to this was:
Copy code

coolname=["**/*.html", "foo/**/*.{md,js,ts}", bar/**/*.json"]
That presents a bunch of technical challenges if there are conflicting formatters, but I would then want to treat it as if I was just running the above
command and everything "just works ™️ " , and configs are picked up in relative (and parent) directory terms (and etc etc).
This approach would kinda break caching, break hermetic sandboxes, and a few other things - but just suggesting that from a user API, I would expect suuuuuper simple and trivial
In fact, even if I could just run a formatter at the command line with an alias - as though I'm running the
command, that's already getting me somewhere (as a user)
If you already have prettier support for targets, doing it for targetless should be straightforward (note I didn't say easy 😛) 1. Declare your request type as a subclass of FmtFilesRequest 2. In your partition rule, you'll be getting every file that matches the CLI spec. You need to filter out anything that you shouldn't run on. You can either glean this from the prettier config (best user UX, but also highest assumption) or do as you suggest and make the user specify using a subsystem option. You also need to find all relevant targets and filter out any ones marked skip. 3. Then just run prettier in your runner rule like normal Since prettier is multi language, I would also propose we move it to a new folder, maybe "multilang"
So, what is the data flow if I have like, 3 targets, and a bunch of loose files (not in any targets, like my main readme.md for example).
./pants fmt lint :::::::::::::::::::::::
When would the targetless vs target-ful formatters run?
Yes 😂 Except you're missing specs
Targetless formatters are formatters are targetless linters are linters 🙂
Okay, so like, the sum total of all formatters would run before the first linter is picked up? Despite targetless/ful status?
Yup. To the user, the distinction should be a minor detail. Formatters are formatters
Ahhh, okay okay, so it doesn't matter. That was my big mental block here, I thought there would need to be some defined ordering or something
Nope 🙂 oblivious users are happy users
Declare your request type as a subclass of FmtFilesRequest
Would this apply to targeted and target-lacking files? I haven't looked at the plugin after the latest changes
How would the targetless approach pick up all the config files?
So you'll want one implementation for simplicity with you doing all the target legwork yourself. Configs picked up like normal, given the filenames
Hmm, for the life of me I can't recall how I did this. Alright, either way, this is enough info for me to try some shenanigans out
Let's hope for 🍎ful shenanigans
Ping for help (in the morning)
Definitely not starting yet, having a fistfight with ffmpeg and a raspberry pi. Need to teach it who's the boss
... angela
Hmm actually I might have a work use-case for this. 🤔 Which means I might take a look this week or next
❤️ 1