From 7cf7fd7088ca7bd63421581627fba5db1c8a2579 Mon Sep 17 00:00:00 2001 From: Ethan Estrada Date: Thu, 19 Sep 2024 22:11:25 -0500 Subject: [PATCH] Add luac linter --- README.md | 2 ++ lua/lint/linters/luac.lua | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 lua/lint/linters/luac.lua diff --git a/README.md b/README.md index 2dd017aa..b92e3c24 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Other dedicated linters that are built-in are: | [ktlint][ktlint] | `ktlint` | | [lacheck][lacheck] | `lacheck` | | [Languagetool][5] | `languagetool` | +| [luac][luac] | `luac` | | [luacheck][19] | `luacheck` | | [markdownlint][26] | `markdownlint` | | [markdownlint-cli2][markdownlint-cli2] | `markdownlint-cli2` | @@ -495,6 +496,7 @@ busted tests/ [phpstan]: https://phpstan.org/ [psalm]: https://psalm.dev/ [lacheck]: https://www.ctan.org/tex-archive/support/lacheck +[luac]: https://www.lua.org/manual/5.1/luac.html [credo]: https://github.com/rrrene/credo [ghdl]: https://github.com/ghdl/ghdl [glslc]: https://github.com/google/shaderc diff --git a/lua/lint/linters/luac.lua b/lua/lint/linters/luac.lua new file mode 100644 index 00000000..23961555 --- /dev/null +++ b/lua/lint/linters/luac.lua @@ -0,0 +1,12 @@ +return { + cmd = "luac", + stdin = true, + append_fname = false, + args = { "-p", "-" }, + stream = "stderr", + ignore_exitcode = true, + parser = require("lint.parser").from_errorformat("luac:\\ stdin:%l:\\ %m,%-G%.%#", { + source = "luac", + severity = vim.diagnostic.severity.ERROR, + }), +}