module is not defined and process is not defined in eslint in visual studio code

MaTHwoG picture MaTHwoG · Apr 12, 2018 · Viewed 22.4k times · Source

I have installed eslint in my machine and i have used visual studio code i have certain modules and process to be exported When i try to use "module" or "process" it shows it was working fine before.

[eslint] 'module' is not defined. (no-undef)
[eslint] 'process' is not defined. (no-undef)

and here is my .eslintrc.json

{

"env": {
    "browser": true,
    "amd": true

},
"parserOptions": {
    "ecmaVersion": 6
  },
"extends": "eslint:recommended",
"rules": {
    "no-console": "off",
    "indent": [
        "error",
        "tab"
    ],
    "linebreak-style": [
        "error",
        "windows"
    ],
    "quotes": [
        "error",
        "single"
    ],
    "semi": [
        "error",
        "always"
    ]
}

}

I want to remove this error

Answer

Mihai Răducanu picture Mihai Răducanu · Aug 30, 2018

You are probably trying to run this in node environment.

The env section should look like this:

"env": {
    "browser": true,
    "amd": true,
    "node": true
},