vscode-eslint: TypeError: Cannot read property 'language' of undefined
When I execute with eslint command, I can run normally
./node_modules/.bin/eslint XXX.jsx
I use the atom editor, eslint can also run the right
But when I use eslint plug-in, the console is wrong, the error message is as follows:
[Info - 4:47:34 PM] ESLint server is running.
[Info - 4:47:36 PM] ESLint library loaded from: /Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/api.js
[Error - 4:47:36 PM] ESLint stack trace:
[Error - 4:47:36 PM] TypeError: Cannot read property 'language' of undefined
at Object.keys.forEach.key (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:180:75)
at Array.forEach (native)
at deepmerge (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:177:30)
at Object.keys.forEach (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:159:34)
at Array.forEach (native)
at deepmerge (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:150:38)
at Object.keys.forEach.key (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:181:32)
at Array.forEach (native)
at Object.deepmerge [as merge] (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config/config-ops.js:177:30)
at Config.getConfig (/Users/liyi/Workspace/ws_ai_mdp/ai-mdp-web/node_modules/eslint/lib/config.js:341:28)
My eslint configuration file “.eslintrc.json ” is as follows:
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"impliedStrict":true
}
},
"extends": [
"eslint:recommended"
],
"plugins": [
"react"
],
"env": {
"browser": true,
"commonjs": true,
"es6": true
}
}
The eslint plug-in version number of my vscode editor is 1.4.8 The dependencies configured in package.json are as follows:
{
"devDependencies": {
"autoprefixer": "7.1.6",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^7.1.4",
"babel-plugin-import": "^1.6.7",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "^6.26.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 22 (12 by maintainers)
So, it turns out that uninstalling an extension is not actually removing it in the extension folder. So when you install again, it still the same old files. I removed eslint and stylelint and installed both again. Voila! No error! Thanks guys!