fix(vim): only register linters when there is an executable
This is mainly for stylelint, I don't always have this installed and it throws an error when you open a sass file and it tries to lint the buffer. Now it will not know about any linters unless they are in the PATH.
This commit is contained in:
parent
7f95ee24f8
commit
bfe83d49f4
1 changed files with 20 additions and 9 deletions
|
|
@ -63,15 +63,26 @@ lint.linters.cspell = {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {};
|
||||||
php = {'phpcs'},
|
|
||||||
typescript = {'eslint_d'},
|
if vim.fn.executable('phpcs') == 1 then
|
||||||
javascript = {'eslint_d'},
|
lint.linters_by_ft.php = { "phpcs" }
|
||||||
typescriptreact = {'eslint_d'},
|
end
|
||||||
javascriptreact = {'eslint_d'},
|
|
||||||
lua = {'luacheck'},
|
if vim.fn.executable('eslint_d') == 1 then
|
||||||
scss = {'stylelint'},
|
lint.linters_by_ft.typescript = { "eslint_d" }
|
||||||
}
|
lint.linters_by_ft.javascript = { "eslint_d" }
|
||||||
|
lint.linters_by_ft.typescriptreact = { "eslint_d" }
|
||||||
|
lint.linters_by_ft.javascriptreact = { "eslint_d" }
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.fn.executable('luacheck') == 1 then
|
||||||
|
lint.linters_by_ft.lua = { "luacheck" }
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.fn.executable('stylelint') == 1 then
|
||||||
|
lint.linters_by_ft.scss = { "stylelint" }
|
||||||
|
end
|
||||||
|
|
||||||
local file_types_map = { [ "" ] = false, qf = false, ivy = false }
|
local file_types_map = { [ "" ] = false, qf = false, ivy = false }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue