11return {
2-
32 { -- Linting
43 ' mfussenegger/nvim-lint' ,
54 event = { ' BufReadPre' , ' BufNewFile' },
@@ -13,37 +12,17 @@ return {
1312 typescriptreact = { ' eslint' },
1413 }
1514
16- -- To allow other plugins to add linters to require('lint').linters_by_ft,
17- -- instead set linters_by_ft like this:
18- -- lint.linters_by_ft = lint.linters_by_ft or {}
19- -- lint.linters_by_ft['markdown'] = { 'markdownlint' }
20- --
21- -- However, note that this will enable a set of default linters,
22- -- which will cause errors unless these tools are available:
23- -- {
24- -- clojure = { "clj-kondo" },
25- -- dockerfile = { "hadolint" },
26- -- inko = { "inko" },
27- -- janet = { "janet" },
28- -- json = { "jsonlint" },
29- -- markdown = { "vale" },
30- -- rst = { "vale" },
31- -- ruby = { "ruby" },
32- -- terraform = { "tflint" },
33- -- text = { "vale" }
34- -- }
35- --
36- -- You can disable the default linters by setting their filetypes to nil:
37- -- lint.linters_by_ft['clojure'] = nil
38- -- lint.linters_by_ft['dockerfile'] = nil
39- -- lint.linters_by_ft['inko'] = nil
40- -- lint.linters_by_ft['janet'] = nil
41- -- lint.linters_by_ft['json'] = nil
42- -- lint.linters_by_ft['markdown'] = nil
43- -- lint.linters_by_ft['rst'] = nil
44- -- lint.linters_by_ft['ruby'] = nil
45- -- lint.linters_by_ft['terraform'] = nil
46- -- lint.linters_by_ft['text'] = nil
15+ -- Check if eslint is installed before setting it as a linter
16+ local function is_executable (name )
17+ return vim .fn .executable (name ) == 1
18+ end
19+
20+ if not is_executable ' eslint' then
21+ lint .linters_by_ft .javascript = nil
22+ lint .linters_by_ft .javascriptreact = nil
23+ lint .linters_by_ft .typescript = nil
24+ lint .linters_by_ft .typescriptreact = nil
25+ end
4726
4827 -- Create autocommand which carries out the actual linting
4928 -- on the specified events.
0 commit comments