Search code examples
javascriptjsontypescripteslint

VS Code's instance of Eslint cannot resolve paths in monorepo


I have a project that has a following structure:

modules
│   ├── client
│       ├── .eslintrc.json
│   └── backend
│       ├── .eslintrc.json
...

The problem is, that when I open the project in the parent folder of modules (project's root folder), Eslint instance running inside of VS Code is unable to resolve any import path, aside from those pointing to node_modules. If I run Eslint inside client those paths are resolved without a problem.

I have found that if you have your Eslint config in javascript you are able to use __dirname and this I assume should combat this issue, but those features are not available to me in JSON. Is there any alternative to this inside JSON? Or will I have to remake those configs into javascript?

Thanks in advance.


Solution

  • After digging into docs, I am almost certain that you have to use .eslintrc.js instead of .json.