-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add linting Neovim configuration
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
return { | ||
{ | ||
"mfussenegger/nvim-lint", | ||
event = { "BufReadPre", "BufNewFile" }, | ||
config = function() | ||
local lint = require("lint") | ||
lint.linters_by_ft = { | ||
dockerfile = { "hadolint" }, | ||
json = { "jsonlint" }, | ||
markdown = { "markdownlint" }, | ||
terraform = { "tflint" }, | ||
} | ||
|
||
-- 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() | ||
-- Only run the linter in buffers that you can modify in order to | ||
-- avoid superfluous noise, notably within the handy LSP pop-ups that | ||
-- describe the hovered symbol using Markdown. | ||
if vim.opt_local.modifiable:get() then | ||
lint.try_lint() | ||
end | ||
end, | ||
} | ||
) | ||
end, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters