7

Despite clearly indicating in esignore that I want to ignore everything inside lib directory, vscode is saying 9 problems found in that minimized file.

If I run eslint inside foldera in command line everything is fine

using this extension

My directory structure:

foldera/
    .eslintrc
    .eslintignore
    src/
        file.js
    lib/
        wantoignore.min.js
folderb/
    morefiles.js
    .eslintrc
    .eslintignore

.eslintrc file

{
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "ecmaVersion": 2017,
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "no-console": "off"
    }
}

.eslintignore

lib/*

workspace settings:

  "eslint.workingDirectories": [
      "./client", "./server"
   ]
Muhammad Umer
  • 17,263
  • 19
  • 97
  • 168

3 Answers3

6

I solved this problem following the official doc here.

Basically you need to add the following content to the vscode workspace settings (usually located in your project's root/.vscode/settings.json), so that vscode knows which configs to honor when you're working on a specific script file:

{
    "eslint.workingDirectories": [ "./reactApp" ],
}
JowieXiang
  • 61
  • 1
  • 3
1

My solutions is:

Source map

root/.vscode/settings.json

Script

    {  
      "eslint.workingDirectories": [{ "mode": "auto" }],
    }
Quang Dong
  • 467
  • 5
  • 7
0

I had a similar problem, figured out need to set workingDirectory to nested folder:

module
  lib
    src
      index.ts
    .eslintrc.js
    .eslintignore

VSCode setting should be:

  "eslint.workingDirectories": [ "./module/lib" ]

And not

  "eslint.workingDirectories": [ "./module" ]
Alonad
  • 1,986
  • 19
  • 17