🐛 fix(nvim): linters adding table is not using the linters entry instead of the formatting entry
This commit is contained in:
parent
dc930a2b85
commit
ed6c419593
2 changed files with 22 additions and 20 deletions
|
@ -9,19 +9,17 @@ return {
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
--- Extend the conform plugin config and add given formatters
|
local function add_linters(tbl)
|
||||||
---@param tbl table<string, conform.FormatterUnit[]> Table of filetype to formatters mappings
|
for ft, linters in pairs(tbl) do
|
||||||
local function add_formatters(tbl)
|
if opts.linters_by_ft[ft] == nil then
|
||||||
for ft, formatters in pairs(tbl) do
|
opts.linters_by_ft[ft] = linters
|
||||||
if opts.formatters_by_ft[ft] == nil then
|
|
||||||
opts.formatters_by_ft[ft] = formatters
|
|
||||||
else
|
else
|
||||||
vim.list_extend(opts.formatters_by_ft[ft], formatters)
|
vim.list_extend(opts.linters_by_ft[ft], linters)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
add_formatters({
|
add_linters({
|
||||||
["go"] = { "golangcilint" },
|
["go"] = { "golangcilint" },
|
||||||
["gomod"] = { "golangcilint" },
|
["gomod"] = { "golangcilint" },
|
||||||
["gowork"] = { "golangcilint" },
|
["gowork"] = { "golangcilint" },
|
||||||
|
|
|
@ -11,20 +11,24 @@ return {
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.linters_by_ft.html = opts.linters_by_ft.html or {}
|
local function add_linters(tbl)
|
||||||
table.insert(opts.linters_by_ft.html, stylelint)
|
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
|
||||||
|
|
||||||
opts.linters_by_ft.css = opts.linters_by_ft.css or {}
|
add_linters({
|
||||||
table.insert(opts.linters_by_ft.css, stylelint)
|
["html"] = { "stylelint" },
|
||||||
|
["css"] = { "stylelint" },
|
||||||
|
["scss"] = { "stylelint" },
|
||||||
|
["sass"] = { "stylelint" },
|
||||||
|
["less"] = { "stylelint" },
|
||||||
|
})
|
||||||
|
|
||||||
opts.linters_by_ft.scss = opts.linters_by_ft.scss or {}
|
|
||||||
table.insert(opts.linters_by_ft.scss, stylelint)
|
|
||||||
|
|
||||||
opts.linters_by_ft.sass = opts.linters_by_ft.sass or {}
|
|
||||||
table.insert(opts.linters_by_ft.sass, stylelint)
|
|
||||||
|
|
||||||
opts.linters_by_ft.less = opts.linters_by_ft.less or {}
|
|
||||||
table.insert(opts.linters_by_ft.less, stylelint)
|
|
||||||
return opts
|
return opts
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue