Skip to content

Commit 2aacdb4

Browse files
authored
Revert "fix(eslint): find closest ESLint directory to avoid version mismatch …" #3689
This reverts commit 9383556.
1 parent 3e87319 commit 2aacdb4

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

lua/lspconfig/configs/eslint.lua

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,6 @@ local root_file = {
4747
'eslint.config.cts',
4848
}
4949

50-
--- Find the closest directory containing the ESLint library.
51-
--- Using the repository root as the ESLint library location is a common practice
52-
--- but handling different versions in monorepos can cause the LSP not to point to
53-
--- the correct instance.
54-
---
55-
--- @return string|nil (path) The path to the closest directory containing the ESLint library, or nil if not found.
56-
local function get_eslint_closest_dir()
57-
local cwd = vim.fn.getcwd()
58-
local eslint_node_modules = vim.fn.finddir('node_modules/eslint', cwd .. ';')
59-
60-
if eslint_node_modules == '' then
61-
return nil
62-
end
63-
64-
if eslint_node_modules == 'node_modules/eslint' then
65-
return cwd
66-
end
67-
68-
-- Strip the node_modules/eslint part
69-
return eslint_node_modules:match '(.*)/node_modules/eslint'
70-
end
71-
7250
return {
7351
default_config = {
7452
cmd = { 'vscode-eslint-language-server', '--stdio' },
@@ -124,8 +102,6 @@ return {
124102
},
125103
},
126104
on_new_config = function(config, new_root_dir)
127-
new_root_dir = get_eslint_closest_dir() or new_root_dir
128-
129105
-- The "workspaceFolder" is a VSCode concept. It limits how far the
130106
-- server will traverse the file system when locating the ESLint config
131107
-- file (e.g., .eslintrc).

0 commit comments

Comments
 (0)