aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Langford <jake@twilsoft.uk>2024-07-01 18:49:22 +0100
committerGitHub <noreply@github.com>2024-07-01 10:49:22 -0700
commitbf94a7cee31df9525239bc7d5ca4910009dfa4ee (patch)
tree8e1df33b7ba72d1b704b0640e5b680b326afaa54
parent0cdd6a7c66a57560c91c816a567bd1d247be53c3 (diff)
feat: add Swiftlint formatter (#484)
* adds swiftlint formatter * update readme with link to swiftlint
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/swiftlint.lua11
2 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index 45ed7c9..c8e6bbd 100644
--- a/README.md
+++ b/README.md
@@ -330,6 +330,7 @@ You can view this list in vim with `:help conform-formatters`
- [stylua](https://github.com/JohnnyMorganz/StyLua) - An opinionated code formatter for Lua.
- [swift_format](https://github.com/apple/swift-format) - Swift formatter from apple. Requires building from source with `swift build`.
- [swiftformat](https://github.com/nicklockwood/SwiftFormat) - SwiftFormat is a code library and command-line tool for reformatting `swift` code on macOS or Linux.
+- [swiftlint](https://github.com/realm/SwiftLint) - A tool to enforce Swift style and conventions.
- [taplo](https://github.com/tamasfe/taplo) - A TOML toolkit written in Rust.
- [templ](https://templ.guide/commands-and-tools/cli/#formatting-templ-files) - Formats templ template files.
- [terraform_fmt](https://www.terraform.io/docs/cli/commands/fmt.html) - The terraform-fmt command rewrites `terraform` configuration files to a canonical format and style.
diff --git a/lua/conform/formatters/swiftlint.lua b/lua/conform/formatters/swiftlint.lua
new file mode 100644
index 0000000..1a6bd6f
--- /dev/null
+++ b/lua/conform/formatters/swiftlint.lua
@@ -0,0 +1,11 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/realm/SwiftLint",
+ description = "A tool to enforce Swift style and conventions.",
+ },
+ command = "swiftlint",
+ stdin = true,
+ args = { "lint", "--use-stdin", "--fix", "--format" },
+ cwd = require("conform.util").root_file({ ".swiftlint.yml", "Package.swift" }),
+}