eslint is running but not showing any lint errors/warnings

爱⌒轻易说出口 提交于 2019-12-08 05:09:54

问题


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

  1. install eslint-plugin-vue

  2. add the following to settings.json in vscode

    "eslint.validate": [
        {
          "language": "vue",
          "autoFix": true
        },
        {
          "language": "html",
          "autoFix": true
        },
        {
          "language": "javascript",
          "autoFix": true
        }
    
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!