microsoft/vscode-eslint

How to configure eslint for a mono repo ?

SummySumanth opened this issue · 1 comments

I have a mono repo, having both frontend and backend in same repository, I want to specify eslint config in respective folders and have those apply in their directory itself (backend config in backend and frontend config in frontend), but eslint plugin in vscode keeps picking .eslintrc.json file instead of eslint.config.js, how to fix this ?

my project structure is as following

/.vscode
  └── settings.json
/app
  └── .vite
/backend
  └── eslint.config.js
  └── (files)
/frontend
  └── eslint.config.js
  └── (files)

./vscode/settings.json

{
  "eslint.workingDirectories": [
      {
          "directory": "../frontend",
          "changeProcessCWD": true,
          "overrideConfigFile": "./../frontend/eslint.config.js"
      },
      {
          "directory": "../backend",
          "changeProcessCWD": true,
          "overrideConfigFile": "./../backend/eslint.config.js"
      }
  ],
}

Error in vscode plugin output

[Error - 02:13:46] Request textDocument/diagnostic failed.
Message: Request textDocument/diagnostic failed with message: Cannot read config file: /project/backend/.eslintrc.json
Error: ENOENT: no such file or directory, open '/project/backend/.eslintrc.json'
Code: -32603 

Originally posted by @SummySumanth in eslint/eslint#18958

"overrideConfigFile" can't be specified on a working directory.

From how I understand your setup a working directory configuration like ["./frontend", "./backend"] should work

If not please provide me with a GitHub repository I can clone with a minimal setup that demos what you are seeing.