summaryrefslogtreecommitdiff
path: root/mut/neovim/lua/my/packages/lint.lua
blob: 815f9b3f14ff01dddb31475b61ad2b15ca56d9d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local lint = require("lint")
local conform = require("conform")

function is_executable(program)
  return vim.fn.executable(program) == 1
end

lint.linters_by_ft = {
  markdown=ternary(is_executable("vale"), { "vale" }, {}),
  python=ternary(is_executable("ruff"), { "ruff" }, {}),
  sh={ "shellcheck" },
}

conform.setup {
  formatters_by_ft={
    python= { "ruff_format", "isort" },
    go= { "goimports" },
    nix= { "alejandra" },
    terraform= { "terraform_fmt" },
    hcl= { "terraform_fmt" },
  },
  format_on_save={
    timeout_ms= 500,
    lsp_fallback= false
  }
}