57 lines
2.0 KiB
Lua
57 lines
2.0 KiB
Lua
return {
|
|
|
|
{ -- Linting
|
|
'mfussenegger/nvim-lint',
|
|
event = { 'BufReadPre', 'BufNewFile' },
|
|
config = function()
|
|
local lint = require 'lint'
|
|
|
|
-- Defining in this format allows other plugins to define linters.
|
|
-- require('lint').linters_by_ft
|
|
--
|
|
-- However, note that this will enable a set of default linters,
|
|
-- which will cause errors unless these tools are available:
|
|
-- {
|
|
-- clojure = { "clj-kondo" },
|
|
-- dockerfile = { "hadolint" },
|
|
-- inko = { "inko" },
|
|
-- janet = { "janet" },
|
|
-- json = { "jsonlint" },
|
|
-- markdown = { "vale" },
|
|
-- rst = { "vale" },
|
|
-- ruby = { "ruby" },
|
|
-- terraform = { "tflint" },
|
|
-- text = { "vale" }
|
|
-- }
|
|
lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
|
|
|
-- JS and TS already run eslint when formatting with conform.nvim.
|
|
-- Additionally, this causes issues in JS or TS projects that do not have an eslint config file.
|
|
-- lint.linters_by_ft['typescript'] = { 'eslint' }
|
|
-- lint.linters_by_ft['javascript'] = { 'eslint' }
|
|
|
|
-- You can disable the default linters by setting their filetypes to nil:
|
|
-- lint.linters_by_ft['clojure'] = nil
|
|
-- lint.linters_by_ft['dockerfile'] = nil
|
|
-- lint.linters_by_ft['inko'] = nil
|
|
-- lint.linters_by_ft['janet'] = nil
|
|
-- lint.linters_by_ft['json'] = nil
|
|
-- lint.linters_by_ft['markdown'] = nil
|
|
-- lint.linters_by_ft['rst'] = nil
|
|
-- lint.linters_by_ft['ruby'] = nil
|
|
-- lint.linters_by_ft['terraform'] = nil
|
|
-- lint.linters_by_ft['text'] = nil
|
|
|
|
-- Create autocommand which carries out the actual linting
|
|
-- on the specified events.
|
|
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
|
group = lint_augroup,
|
|
callback = function()
|
|
lint.try_lint()
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
}
|