如何使用eslint正确设置流量?

时间:2018-10-27 14:58:31

标签: visual-studio-code eslint flowtype

我的< approx文件是:

.eslintrc

VSCode仍然显示: enter image description here

1 个答案:

答案 0 :(得分:0)

将我的.eslintrc更改为:

{
  "extends": "google",
  "parser": "babel-eslint",
  "plugins": [
    "mocha",
    "flowtype"
  ],
  "rules": {
    "strict": [
      "error",
      "never"
    ],
    "comma-dangle": [
      "error",
      "never"
    ],
    "object-curly-spacing": [
      "error",
      "always"
    ],
    "require-jsdoc": [
      "error",
      {
        "require": {
          "FunctionDeclaration": true,
          "MethodDefinition": true,
          "ClassDeclaration": false,
          "ArrowFunctionExpression": false,
          "FunctionExpression": false
        }
      }
    ],
    "indent": [
      "error",
      2,
      {
        "SwitchCase": 1
      }
    ],
    "semi": [
      "warn",
      "always"
    ],
    "no-console": [
      "warn",
      {
        "allow": [
          "debug",
          "error"
        ]
      }
    ],
    "max-len": [
      "off"
    ],
    "no-unused-vars": [
      "error",
      {
        "varsIgnorePattern": "should"
      }
    ]
  },
  "env": {
    "es6": true,
    "node": true
  },
  "settings": {
    "flowtype": {
      "onlyFilesWithFlowAnnotation": true
    }
  }
}

已帮助