Как правильно настроить поток с eslint? - PullRequest
0 голосов
/ 27 октября 2018

Мой .eslintrc файл:

{
  "extends": "google",
  "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"
      }
    ],
    "flowtype/boolean-style": [
      2,
      "boolean"
    ],
    "flowtype/define-flow-type": 1,
    "flowtype/delimiter-dangle": [
      2,
      "never"
    ],
    "flowtype/generic-spacing": [
      2,
      "never"
    ],
    "flowtype/no-primitive-constructor-types": 2,
    "flowtype/no-types-missing-file-annotation": 2,
    "flowtype/no-weak-types": 2,
    "flowtype/object-type-delimiter": [
      2,
      "comma"
    ],
    "flowtype/require-parameter-type": 2,
    "flowtype/require-return-type": [
      2,
      "always",
      {
        "annotateUndefined": "never"
      }
    ],
    "flowtype/require-valid-file-annotation": 2,
    "flowtype/semi": [
      2,
      "always"
    ],
    "flowtype/space-after-type-colon": [
      2,
      "always"
    ],
    "flowtype/space-before-generic-bracket": [
      2,
      "never"
    ],
    "flowtype/space-before-type-colon": [
      2,
      "never"
    ],
    "flowtype/type-id-match": [
      2,
      "^([A-Z][a-z0-9]+)+Type$"
    ],
    "flowtype/union-intersection-spacing": [
      2,
      "always"
    ],
    "flowtype/use-flow-type": 1,
    "flowtype/valid-syntax": 1
  },
  "env": {
    "es6": true,
    "node": true
  },
  "settings": {
    "flowtype": {
      "onlyFilesWithFlowAnnotation": false
    }
  }
}

VSCode по-прежнему показывает: enter image description here

1 Ответ

0 голосов
/ 29 октября 2018

Изменение моего .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
    }
  }
}

помогли

...