♻️ refactor(nvim): moved stylelint linter to the html-css extra instead of having his own

This commit is contained in:
Sergio Laín 2024-02-23 09:39:01 +01:00
parent f3e9868129
commit 734bebdb8b
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 26 additions and 37 deletions

View file

@ -49,14 +49,38 @@ return {
"cssmodules-language-server",
"css-lsp",
"htmlhint",
"stylelint",
})
end,
},
{
"mfussenegger/nvim-lint",
opts = function(_, opts)
opts.linters_by_ft.html = opts.linters_by_ft.html or {}
table.insert(opts.linters_by_ft.html, "htmlhint")
local stylelint = "stylelint"
local function add_linters(tbl)
for ft, linters in pairs(tbl) do
if opts.linters_by_ft[ft] == nil then
opts.linters_by_ft[ft] = linters
else
vim.list_extend(opts.linters_by_ft[ft], linters)
end
end
end
add_linters({
["html"] = { "htmlhint" },
["css"] = { stylelint },
["scss"] = { stylelint },
["less"] = { stylelint },
["sugarss"] = { stylelint },
["vue"] = { stylelint },
["wxss"] = { stylelint },
["javascript"] = { stylelint },
["javascriptreact"] = { stylelint },
["typescript"] = { stylelint },
["typescriptreact"] = { stylelint },
})
return opts
end,
},

View file

@ -1,35 +0,0 @@
local stylelint = "stylelint"
return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { stylelint })
end,
},
{
"mfussenegger/nvim-lint",
opts = function(_, opts)
local function add_linters(tbl)
for ft, linters in pairs(tbl) do
if opts.linters_by_ft[ft] == nil then
opts.linters_by_ft[ft] = linters
else
vim.list_extend(opts.linters_by_ft[ft], linters)
end
end
end
add_linters({
["html"] = { "stylelint" },
["css"] = { "stylelint" },
["scss"] = { "stylelint" },
["sass"] = { "stylelint" },
["less"] = { "stylelint" },
})
return opts
end,
},
}