mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-26 02:38:50 +02:00
fix(nvim-lint): use linters
for both custom and overriding linters
This commit is contained in:
parent
6bb0d1b66f
commit
31d913697b
1 changed files with 3 additions and 7 deletions
|
@ -8,11 +8,10 @@ return {
|
||||||
linters_by_ft = {
|
linters_by_ft = {
|
||||||
fish = { "fish" },
|
fish = { "fish" },
|
||||||
},
|
},
|
||||||
-- Custom linters, or fully replace a builtin
|
|
||||||
linters = {},
|
|
||||||
-- LazyVim extension to easily override linter options
|
-- LazyVim extension to easily override linter options
|
||||||
|
-- or add custom linters.
|
||||||
---@type table<string,table>
|
---@type table<string,table>
|
||||||
linter_opts = {
|
linters = {
|
||||||
-- -- Example of using selene only when a selene.toml file is present
|
-- -- Example of using selene only when a selene.toml file is present
|
||||||
-- selene = {
|
-- selene = {
|
||||||
-- -- `condition` is another LazyVim extension that allows you to
|
-- -- `condition` is another LazyVim extension that allows you to
|
||||||
|
@ -33,12 +32,9 @@ return {
|
||||||
end
|
end
|
||||||
local lint = require("lint")
|
local lint = require("lint")
|
||||||
for name, linter in pairs(opts.linters) do
|
for name, linter in pairs(opts.linters) do
|
||||||
lint.linters[name] = linter
|
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter)
|
||||||
end
|
end
|
||||||
lint.linters_by_ft = vim.tbl_extend("force", lint.linters_by_ft, opts.linters_by_ft)
|
lint.linters_by_ft = vim.tbl_extend("force", lint.linters_by_ft, opts.linters_by_ft)
|
||||||
for l, o in pairs(opts.linter_opts or {}) do
|
|
||||||
lint.linters[l] = vim.tbl_deep_extend("force", lint.linters[l], o)
|
|
||||||
end
|
|
||||||
M._did_setup = true
|
M._did_setup = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue