From ceb94f555d3f79b3203864642f2b7c5405f685ed Mon Sep 17 00:00:00 2001 From: Josean Martinez Date: Sun, 23 Oct 2022 01:20:11 -0400 Subject: [PATCH] Added condition to null-ls eslint to enable if eslint config file is present --- .config/nvim/lua/josean/plugins/lsp/null-ls.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/josean/plugins/lsp/null-ls.lua b/.config/nvim/lua/josean/plugins/lsp/null-ls.lua index bff4f20..ba24920 100644 --- a/.config/nvim/lua/josean/plugins/lsp/null-ls.lua +++ b/.config/nvim/lua/josean/plugins/lsp/null-ls.lua @@ -19,7 +19,12 @@ null_ls.setup({ -- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs) formatting.prettier, -- js/ts formatter formatting.stylua, -- lua formatter - diagnostics.eslint_d, -- js/ts linter + diagnostics.eslint_d.with({ -- js/ts linter + -- only enable eslint if root has .eslintrc.js (not in youtube nvim video) + condition = function(utils) + return utils.root_has_file(".eslintrc.js") + end, + }), }, -- configure format on save on_attach = function(current_client, bufnr)