1return {
2
3 { -- Linting
4 "mfussenegger/nvim-lint",
5 event = { "BufReadPre", "BufNewFile" },
6 config = function()
7 local lint = require("lint")
8 lint.linters_by_ft = {
9 html = { "htmlhint" },
10 dockerfile = { "hadolint" },
11 rust = { "clippy" },
12 }
13
14 -- However, note that this will enable a set of default linters,
15 -- which will cause errors unless these tools are available:
16 -- {
17 -- clojure = { "clj-kondo" },
18 -- dockerfile = { "hadolint" },
19 -- inko = { "inko" },
20 -- janet = { "janet" },
21 -- json = { "jsonlint" },
22 -- markdown = { "vale" },
23 -- rst = { "vale" },
24 -- ruby = { "ruby" },
25 -- terraform = { "tflint" },
26 -- text = { "vale" }
27 -- }
28 --
29 -- You can disable the default linters by setting their filetypes to nil:
30 -- lint.linters_by_ft['clojure'] = nil
31 -- lint.linters_by_ft['dockerfile'] = nil
32 -- lint.linters_by_ft['inko'] = nil
33 -- lint.linters_by_ft['janet'] = nil
34 -- lint.linters_by_ft['json'] = nil
35 -- lint.linters_by_ft['markdown'] = nil
36 -- lint.linters_by_ft['rst'] = nil
37 -- lint.linters_by_ft['ruby'] = nil
38 -- lint.linters_by_ft['terraform'] = nil
39 -- lint.linters_by_ft['text'] = nil
40
41 -- Create autocommand which carries out the actual linting
42 -- on the specified events.
43 local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
44 vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
45 group = lint_augroup,
46 callback = function()
47 -- Only run the linter in buffers that you can modify in order to
48 -- avoid superfluous noise, notably within the handy LSP pop-ups that
49 -- describe the hovered symbol using Markdown.
50 if vim.opt_local.modifiable:get() then
51 lint.try_lint()
52 end
53 end,
54 })
55 end,
56 },
57}