I unsuccessfully tried to install ESLint globally running with babel-eslint as parser. I installed both packages globally on a Windows 10 machine:
npm list --depth=0 -g
C:\Users\UserName\AppData\Roaming\npm
+-- @angular/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
A default .eslintrc
config file exists in my home directory: C:\Users\UserName
This works fine untill i specify babel-eslint
as parser
:
{
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"parser": "babel-eslint",
"rules": {
"no-var": "error",
"no-use-before-define": "off",
"no-unused-vars": "warn",
"prefer-const": "warn",
"no-console": "off",
"func-names": "off",
"node/no-unsupported-features/es-syntax": "off"
}
}
ESLint server throws:
[Info - 11:06:04] Failed to load parser 'babel-eslint' declared in 'PersonalConfig': Cannot find module 'babel-eslint' Require stack: - C:\Users\UserName\.eslintrc
Same happens by the way, as soon as I try to extend my config with air-bnb config, which is also globally installed. How can I tell ESLint where to look for dependencies since they are not installed in C:\Users\UserName
but in C:\Users\UserName\AppData\Roaming\npm
?
Try this:
Not a perfect solution but it works.