node.js - 禁用未找到 eslint 规则的警告消息

标签 node.js reactjs jsx eslint nodemon

我正在努力让 eslint 首次在我的应用程序中运行。我基本上可以正常工作,但是自从我开始禁用一些规则后,我导入了浏览器控制台,并且命令行开始变得困惑,并出现相同的警告。

当我运行 nodemon 时,我的命令行充满了相同的警告。 enter image description here

我也在浏览器控制台中收到类似的消息 enter image description here

我的应用程序按预期运行,并且 linting 也正常工作。我只是想知道是否有办法消除这些警告消息

以下是一些可能相关的文件:

package.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

{
  "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

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

谢谢

最佳答案

"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

关于node.js - 禁用未找到 eslint 规则的警告消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46836249/

相关文章:

node.js - 当属性不存在时使用 joi TypeError 验证模式

javascript - 如何在 React 应用程序中更新 bundle.js 文件

javascript - 如何在 Sublime Text 上对相同的文件扩展名使用不同的语法? (JS/JSX)

node.js - 在 Windows 上使用 Node 的 path.resolve

node.js - 检查 npm 包与 Node 最新版本的兼容性

javascript - Nodejs 中的 res.send 与 res.locals

reactjs - 添加新项目时如何使用无限滚动更新项目列表

reactjs - React 16 中的类与类名

javascript - ReactJS 在渲染组件时表现得很奇怪

reactjs - 如何在 JSX 中制作图像按钮?