Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Eslint configuration for a two projects workspace

I have a folder with two projects, a Nodejs backend and a Vuejs frontend. I want to open both projects at the same time, and being able to use eslint to check and format code in both.

The problem I'm having is that whenever a get the configuration sort of working for the vue project, the js files in the backend are not validated.

My main question is if it is possible at all to do this or not. I've already followed countless tutorials on getting eslint+prettier+airbnb plus all of the relevant plugins working. Else, if is it better to open two instances of VSCode, one for the backend and another for the frontend, each with its own configuration.

Thanks !!!

like image 392
Danielito Avatar asked Feb 11 '20 22:02

Danielito


People also ask

Can I open two projects in Visual Studio Code?

Open a second solution inside a single instance To open a second solution alongside your first solution, use the following steps: With your first solution already open, select File > Open. Browse the file system to find the existing solution. Select Open to open the second solution in the Solution Window.

How do I configure ESLint in Visual Studio Code?

To find the settings in Visual Studio Code, use the command palette to open Preferences: Open Workspace Settings (JSON). With this code in your settings. json file, ESLint will now automatically correct errors and validate JavaScript on save. Return back to your app.


1 Answers

Yes, you can get this working. You'll need to update your workspace settings.

https://medium.com/devityoself/monorepo-eslint-vscode-6f5982c8404d

[From Visual Studio Code]:

  1. CMD + Shift + P
  2. Start to type Workspace settings
  3. Search for ESlint extension and look for Working Directories and select Edit in settings.json.
  4. Enter the paths that need ESlint enabled
{ "eslint.workingDirectories": ["mobile/iOS", "platform/web"] }
like image 78
loyalBrown Avatar answered Sep 20 '22 00:09

loyalBrown