eslint 在 VScod 中检查HTML文件时报出大量no-unused-vars,是正常现象吗?

已全局安装eslint和eslint-plugin-html;
也设置了

"plugins": [
    "react",
    "html"],

"eslint.validate": [
    "javascript",
    "javascriptreact",
    {
        "language": "html",
        "autoFix": true
    },
    {
        "language": "vue",
        "autoFix": true
    }
],

问题就是
1.html里写的JS里的function 会被认为是no-unused-vars报错,而我在HTML里绑了onclick事件.这是正常的吗?
2.上文中那个 "language": "html","autoFix": true 的autoFix好像没什么用啊.我不明白很多人说要这么写.
3.airbnb,我下载了airbnb,看到说是需要eslint a peer of 4.9.0 ,eslint现在都是4.19了,我小试了下能用,这不会出什么问题吧?
还请各位不吝指教.

update:
Consider running eslint --debug C:Userszhaohe.eslintrc.js from a terminal to obtain a trace about the configuration files used.
[Error - 22:23:47]
Failed to load plugin html: Cannot find module 'eslint-plugin-html'
Happened while validating C:Userszhaohe.eslintrc.js
This can happen for a couple of reasons:

  1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
  2. If ESLint is installed globally, then make sure 'eslint-plugin-html' is installed globally as well.
  3. If ESLint is installed locally, then 'eslint-plugin-html' isn't installed correctly.

啊,我在输出中看到这么一大串.
我安装都是在CMD中运行

npm install -g eslint    
npm install -g eslint-plugin-html

我在VScode的设置里改了"eslint.nodePath",好像不出这个一大串了,但报变量的问题还是有的.

阅读 7k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题