File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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-
7250return {
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).
You can’t perform that action at this time.
0 commit comments