问题
I am using vscode with eslint. The eslint console shows the following:
[Info - 3:31:14 PM] ESLint server stopped.
[Info - 3:31:14 PM] ESLint server running in node v10.2.0
[Info - 3:31:14 PM] ESLint server is running.
[Info - 3:31:15 PM] ESLint library loaded from:
/usr/local/lib/node_modules/eslint/lib/api.js
So eslint appears to be loading and running. However, there is a .eslintrc
file in my project root that has rules and vscode is not showing me any linting errors.
How do I debug this?
回答1:
You'll need to install an extension for VSCode to show lint errrors in the editor. Otherwise you can run eslint from the terminal to see its output. I use tslint so I don't know which extension to use but https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint might be what you're looking for.
回答2:
I needed to
install
eslint-plugin-vue
add the following to settings.json in vscode
"eslint.validate": [ { "language": "vue", "autoFix": true }, { "language": "html", "autoFix": true }, { "language": "javascript", "autoFix": true }
and update .eslintrc to include
"globals: "Vue" : true,"
and
"extends": [ "eslint:recommended", "plugin:vue/recommended" ],
in addition to
"plugins": ["html"],
来源:https://stackoverflow.com/questions/54952013/eslint-is-running-but-not-showing-any-lint-errors-warnings