How can we fix the "Trailing Whitespace Violation" warnings caused by swiftlint in my iOS project all in one go? I don't want to manually correct each one of them. Moreover, I don't want to disable these warnings so you can skip that suggestion.
I have been trying Find And Replace option but I am not getting a correct keyword to sort this out.
Image :
Select Scripts Menu > Edit User Scripts... Press the + button and select New Shell Script. Give it a name like "Strip Trailing Spaces", and give it a shortcut like ⌃⇧R. Set Input to "Selection" and Output to "Replace Selection"
Trailing whitespace. Description: Used when there is whitespace between the end of a line and the newline.
swiftlint has an autocorrect option that will fix some issues for you, so when I get trailing whitespace warnings I run swiftlint from the command line in my project
$ swiftlint autocorrect
Update
As of version 0.43 autocorrect
has been deprecated and replaced with --fix
so now the command is
$ swiftlint --fix
autocorrect
is still available for the time being, for more info see the change log
Check the 2 checkboxes in While editing
section
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With