https://pantsbuild.org/ logo
b

bitter-ability-32190

09/23/2022, 5:19 PM
IT LIVES! The formatter schema change PR is up: https://github.com/pantsbuild/pants/pull/16980 Say hello to targetless formatters (and very soon, say hello to
fix
)
😮 3
🔥 4
w

wide-midnight-78598

09/23/2022, 5:52 PM
How would it be used?
./pants fmt EVERYTHING
b

bitter-ability-32190

09/23/2022, 5:54 PM
::
matches files even without targets 🙂
w

wide-midnight-78598

09/23/2022, 5:55 PM
So, I have Prettier installed I type
./pants fmt ::
What happens?
Do subsystems now have extensions registered?
b

bitter-ability-32190

09/23/2022, 5:57 PM
the plugin gets all files in the specs, then filter/partition it however they please
w

wide-midnight-78598

09/23/2022, 5:58 PM
so, until the plugins are updated, they don't change existing functionality?
b

bitter-ability-32190

09/23/2022, 5:59 PM
yup. And FWIW we/I haven't thought closely on "hybrid" plugins (e.g. supports targets and targetless)
w

wide-midnight-78598

09/23/2022, 6:00 PM
okay, because there's gonna be a thing about how to grab various configurations when files are just being thrown around willy nilly - making sure each uses the correct config for its type and location
b

bitter-ability-32190

09/23/2022, 6:01 PM
The filtering/partitiong is just another
rule
. So do whatever you need to do to make it "work". 🙂
👍 2
An example is our BUILD file formatters are now "targetless" and filter the input specs based on the Pants config 🙂
💯 1
❤️ 1
h

hundreds-father-404

09/23/2022, 6:55 PM
And FWIW we/I haven't thought closely on "hybrid" plugins (e.g. supports targets and targetless)
It also gets into the discussion about "synthesizing targets", that you only need to manually write BUILD files when you want to change metadata. That would be the optimal approach imo for things like Prettier, that it's always using a target-based approach. Vs the alternative where users start with target-less implementation, and then have to migrate to targets when they want new functionality like the
skip_prettier
field Although, synthesizing targets is far off and still not universally agreed too. So not at all blocking
b

bitter-ability-32190

09/23/2022, 8:53 PM
The braindead solution would be to register both a files and a targets formatter. And if you can make sure not to step on the others toes, then magic Ideally we can do better though
👍 1
Actually you can do that easily by requesting specs and filtering the relevant targets (like we do in lint/fmt) and then excluding those files from your targetless-formatter