vscode eslint not ignoring directory?
Asked Answered
A

3

8

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"
   ]
Amerson answered 22/3, 2018 at 6:36 Comment(3)
not sure if this will help anyone else, but my fix was simply to restart VSCodeKimmel
I am having the same problem and it is very annoying. Has there been any progress on that problem? – I filed and issue at the github repo. (BTW: restarting didn't help)Zingaro
after updates it stopped doing thatAmerson
H
8

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" ],
}
Hog answered 12/6, 2021 at 15:2 Comment(0)
B
2

My solutions is:

Source map

root/.vscode/settings.json

Script

    {  
      "eslint.workingDirectories": [{ "mode": "auto" }],
    }
Bazemore answered 19/1, 2022 at 10:53 Comment(0)
O
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" ]
Obovoid answered 8/9, 2021 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.