neoclide / coc-eslint

Eslint extension for coc.nvim
MIT License
396 stars 25 forks source link

coc-eslint does not detect eslintrc unless it is placed in the root folder #129

Open tmnvanderberg opened 2 years ago

tmnvanderberg commented 2 years ago

Our project requires different linting configurations for different folders /src/, /test/, etc.

When I place the .eslintrc file in the root folder of the project, coc-eslint correctly uses my configuration. When I move it to /src/ it does not correctly lint files in /src/.

chemzqm commented 2 years ago

https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders

filmaj commented 2 years ago

@tmnvanderberg I had the same issue in a monorepo project that had multiple different npm modules under subdirectories, but a single .eslintrc file in a separate subdirectory that was symlinked from each npm module in each subdir.

I was able to resolve my problem of coc-eslint looking for the eslint config in the root of the project by tweaking the "coc.preferences.rootPatterns" coc-nvim config, as linked to by @chemzqm. I changed the value of this preference from [".git", ".hg", ".projections.json"] to [".git", ".hg", ".projections.json", "package.json"].

Your situation is a bit different though.. you could try adding .eslintrc to the rootPatterns config but that might mess up other functionality, since technically the subdirs where your .eslintrc files exist are not the root directory. So some other assumptions might fail with that.

EvandroLG commented 1 year ago

I'm also struggling with it. @tmnvanderberg, did you find any solution after these months?

tmnvanderberg commented 1 year ago

Hi Evan,

No unfortunately not, I stopped using coc-eslint end moved to neovim.