H5W3
当前位置:H5W3 > 其他技术问题 > 正文

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”,好像不出这个一大串了,但报变量的问题还是有的.

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

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址