IT LIVES! The formatter schema change PR is up: <h...
# development
b
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
How would it be used?
./pants fmt EVERYTHING
b
::
matches files even without targets 🙂
w
So, I have Prettier installed I type
./pants fmt ::
What happens?
Do subsystems now have extensions registered?
b
the plugin gets all files in the specs, then filter/partition it however they please
w
so, until the plugins are updated, they don't change existing functionality?
b
yup. And FWIW we/I haven't thought closely on "hybrid" plugins (e.g. supports targets and targetless)
w
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
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
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
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