aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/eslint.lua12
1 files changed, 3 insertions, 9 deletions
diff --git a/lua/lspconfig/server_configurations/eslint.lua b/lua/lspconfig/server_configurations/eslint.lua
index 6ebe65ee..feb82c63 100644
--- a/lua/lspconfig/server_configurations/eslint.lua
+++ b/lua/lspconfig/server_configurations/eslint.lua
@@ -48,25 +48,19 @@ local root_file = {
'.eslintrc.yml',
'.eslintrc.json',
'eslint.config.js',
- 'package.json',
}
local root_with_package = util.find_package_json_ancestor(vim.fn.expand '%:p:h')
if root_with_package then
- local must_remove = false
+ -- only add package.json if it contains eslintConfig field
local path_sep = is_windows and '\\' or '/'
for line in io.lines(root_with_package .. path_sep .. 'package.json') do
if line:find 'eslintConfig' then
- must_remove = false
- else
- must_remove = true
+ table.insert(root_file, 'package.json')
+ break
end
end
-
- if must_remove then
- table.remove(root_file, #root_file)
- end
end
return {