SwiftFormat icon indicating copy to clipboard operation
SwiftFormat copied to clipboard

Specifying --lint in .swiftformat results in "Unknown option --lint"

Open JetForMe opened this issue 4 years ago • 3 comments

It's a bit dangerous that the default is to format files, so I wanted to put --lint in .swiftformat. But it doesn’t like that:

$ swiftformat .
Running SwiftFormat...
Reading config file at /…/.swiftformat
error: Unknown option --lint. Did you mean --lintonly? in configuration file.

JetForMe avatar Jan 03 '22 22:01 JetForMe

@JetForMe --lint is not a formatting option but a mode, so you can't set it in the config. I'll see if I can find a better solution.

nicklockwood avatar Jan 09 '22 07:01 nicklockwood

Oh, I had figured the file was just a way of specifying any and all options you might specify on the command line.

JetForMe avatar Jan 09 '22 10:01 JetForMe

@JetForMe not sure if this entirely solves your problem, but adding --lintonly all to your .swiftformat file will prevent swiftformat from doing anything unless it's run in --lint mode (you'll still need to actually add --lint to the command when running it if you want it to lint the files).

nicklockwood avatar Aug 13 '23 18:08 nicklockwood