简体   繁体   English

禁用未找到 eslint 规则的警告消息

[英]Disable warning message for eslint rule not being found

I'm working on getting eslint working in my app for the first time.我正在努力让 eslint 第一次在我的应用程序中工作。 I have it mostly working, but since I've started disabling some of the rules I imported my browser console and command line have started being cluttered up with the same warning.我大部分时间都在工作,但自从我开始禁用一些规则后,我导入的浏览器控制台和命令行开始被相同的警告弄得乱七八糟。

When I run nodemon, my command line is filled with the same warning.当我运行 nodemon 时,我的命令行充满了相同的警告。 在此处输入图片说明

I also get a similar message in the browser console我也在浏览器控制台中收到类似的消息在此处输入图片说明

My app is functioning as intended and linting is working as well.我的应用程序按预期运行,linting 也正常运行。 I was just wondering if there was a way to get rid of these warning messages我只是想知道是否有办法摆脱这些警告消息

Here are some possibly relevant files:以下是一些可能相关的文件:

package.json包.json

{
    "name": "server",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "engines": {
        "node": "8.4.0",
        "npm": "5.3.0"
    },
    "scripts": {
        "start": "node index.js",
        "server": "nodemon index.js",
        "client": "npm run start --prefix client",
        "dev": "concurrently \"npm run server\" \"npm run client\"",
        "lint": "eslint ."
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
        "concurrently": "^3.5.0",
        "cookie-session": "^1.3.1",
        "express": "^4.15.4",
        "mongoose": "^4.11.10",
        "nodemon": "^1.12.0",
        "passport": "^0.4.0",
        "passport-google-oauth20": "^1.0.0"
    },
    "devDependencies": {
        "eslint": "^4.9.0",
        "eslint-config-airbnb": "^16.1.0",
        "eslint-plugin-import": "^2.7.0",
        "eslint-plugin-jsx-a11y": "^6.0.2",
        "eslint-plugin-react": "^7.4.0"
    }
}

.eslintrc .eslintrc

{
  "extends": [
    "airbnb"
  ],
  "root": true,
  "rules": {
    "import/prefer-default-export": "off",
    "arrow-parens": ["error", "as-needed"],
    "no-tabs": "off",
    "indent": "off",
    "function-paren-newline": "off",
    "max-len": "off",
    "no-console": "off",
    "react/jsx-filename-extension": "off",
    "react/prop-types": "off",
    "consistent-return": "off",
    "jsx-a11y/anchor-is-valid": "off",
    "jsx-a11y/href-no-hash": "off"
  }
}

.eslintignore .eslintignore

node_modules
.gitignore
*.md
*.json
config/keys.js
client/src/registerServiceWorker.js

Thank you谢谢

通过将 eslint-plugin-jsx-a11y 切换到 5.1.1 版本解决的问题

变化"jsx-a11y/anchor-is-valid": "off""jsx-a11y/anchor-is-valid": 2和删除"jsx-a11y/href-no-hash": "off" ,根据https://github.com/airbnb/javascript/issues/1474

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM