✨ feat: add nvim-lint for code linting and update auto-install config

This commit is contained in:
sankalp committed 2025-07-25 14:27:36 +05:45
1 parent 1cc51f2774
commit 5c803c0175
6 files changed
+92 -33

No files matched your search

+17 -10
View File
@@ -59,18 +59,25 @@ blink.setup({
score_offset = 100,
},
spell = {
name = 'spell',
module = 'blink.compat.source',
max_items = 10,
score_offset = -20,
name = 'Spell',
module = 'blink-cmp-spell',
opts = {
keep_all_entries = true, -- don't filter it
-- enable_in_context = function()
-- return require("cmp.config.context").in_treesitter_capture "spell"
-- end,
preselect_correct_word = false,
-- EXAMPLE: Only enable source in `@spell` captures, and disable it
-- in `@nospell` captures.
enable_in_context = function()
local curpos = vim.api.nvim_win_get_cursor(0)
local captures = vim.treesitter.get_captures_at_pos(0, curpos[1] - 1, curpos[2] - 1)
local in_spell_capture = false
for _, cap in ipairs(captures) do
if cap.capture == 'spell' then
in_spell_capture = true
elseif cap.capture == 'nospell' then
return false
end
end
return in_spell_capture
end,
},
kind = 'Spell',
},
},
},
+1 -3
View File
@@ -15,8 +15,6 @@ conform.setup({
json = { 'prettier' },
yaml = { 'prettier' },
sh = { 'shfmt' },
elixir = { 'mix' },
-- ruby = { "rubocop" }, -- optional
},
-- Autoformat on save
@@ -28,7 +26,7 @@ conform.setup({
-- Setup mason-conform
local auto_install = require('lib.util').get_user_config('auto_install', true)
local installed_formatters = require('plugins.list').null_ls_sources or {}
local installed_formatters = require('plugins.list').formatter_sources or {}
require('mason-conform').setup({
ensure_installed = installed_formatters,
+31
View File
@@ -0,0 +1,31 @@
local lint = require('lint')
-- Filetype to linters mapping
lint.linters_by_ft = {
javascript = { 'eslint_d' },
typescript = { 'eslint_d' },
javascriptreact = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
dockerfile = { 'hadolint' },
vim = { 'vint' },
markdown = { 'write_good', 'markdownlint' },
text = { 'write_good' },
sh = { 'shellcheck' },
yaml = { 'actionlint' },
}
-- Trigger linting on save and buffer events
vim.api.nvim_create_autocmd({ 'BufWritePost', 'BufReadPost', 'InsertLeave' }, {
callback = function()
lint.try_lint()
end,
})
-- Setup mason-nvim-lint to auto-install linters
local auto_install = require('lib.util').get_user_config('auto_install', true)
local installed_linters = require('plugins.list').linter_sources or {}
require('mason-nvim-lint').setup({
ensure_installed = installed_linters,
automatic_installation = auto_install,
})