Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object-curly-newline [2, 'always'] complains of Flow type annotation in function parameters #9577

Closed
ADagen opened this issue Nov 3, 2017 · 1 comment
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@ADagen
Copy link

ADagen commented Nov 3, 2017

Tell us about your environment

  • ESLint Version: 4.10.0
  • Node Version: 8.4.0
  • npm Version: 5.4.2

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint@8.0.1

Please show your full configuration:

Configuration
{
  "extends": "airbnb",
  "env": {
    "browser": true,
    "jest": true,
    "jasmine": true,
    "serviceworker": true,
    "shared-node-browser": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 6,
    "esversion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "plugins": [
    "filenames",
    "babel",
    "flowtype"
  ],
  "globals": {
    "$": true,
    "Raven": true,
    "angular": true
    "__DEV__": true
  },
  "rules": {
    "jsx-a11y/no-static-element-interactions": [0],

    "class-methods-use-this" : [0],

    // trailing commas only for multiline object literals
    "comma-dangle": [2, "always-multiline"],

    "complexity": [2, { "max": 8 }],

    "semi": [1, "never"],

    "key-spacing": ["error", { "mode": "strict" }],

    "no-multi-spaces": [0],

    "space-before-function-paren": ["error", "never"],

    "padded-blocks": [0],

    "no-return-assign": [0],

    "max-len": ["error", {
      "code": 100,
      "comments" : 120,
      "ignoreUrls": true
    }],

    // for es6 modules
    "strict": [0],

    // filenaming convention
    "filenames/match-regex": [0],
    "filenames/match-exported": [0],

    // es2016 и es proposal/strawman support
    // with disabling original rules
    "generator-star-spacing": [1],
    "new-cap": [0],
    "array-bracket-spacing": [1],
    "object-curly-spacing": [0],
    "object-shorthand": [1],
    "arrow-parens": [0],
    "no-await-in-loop": [1],
    "flow-object-type": [0],

    "react/jsx-filename-extension":  [2, { "extensions": [".js"] }],
    "react/no-string-refs": [1],
    "react/no-render-return-value": [0],

    "import/no-unresolved" : [0],

    "import/no-extraneous-dependencies":[0],

    "babel/new-cap": [1],
    "babel/object-curly-spacing": [0],
    "babel/arrow-parens": [0],

    "flowtype/object-type-delimiter": [1],
    "flowtype/define-flow-type": 1,
    "flowtype/use-flow-type": 1,

    "require-jsdoc": [1,
      {
        "require": {
          "FunctionDeclaration": true,
          "MethodDefinition": true,
          "ClassDeclaration": true
        }
      }
    ],

    "valid-jsdoc": [1, {
      "prefer": {
        "arg": "param",
        "argument": "param",
        "class": "class",
        "return": "returns",
        "virtual": "abstract"
      },
      "preferType": {
        "Boolean": "boolean",
        "Number": "number",
        "object": "Object",
        "String": "string"
      },
      "requireReturn": true,
      "requireReturnType": false,
      "requireReturnDescription": false
    }],

    "babel/new-cap" : [0],
    "new-cap": [2, { "capIsNewExceptions": ["express.Router"] }],

    "indent": [1, 2],

    "react/no-unused-prop-types": [0],
    "react/require-default-props": [0],

    "object-curly-newline": ["error", "always"]
  },
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

export const getSomeData = ({
  property1,
  property2,
}: ArgumentType): ResultType => {
  ...
}
npm run eslint src

What did you expect to happen?
No errors

What actually happened? Please include the actual, raw output from ESLint.
A lot of errors in every file with flow annotations.

   29:39  error    Expected a line break after this opening brace   object-curly-newline
   29:57  error    Expected a line break before this closing brace  object-curly-newline
   50:64  error    Expected a line break after this opening brace   object-curly-newline
   50:83  error    Expected a line break before this closing brace  object-curly-newline
   ...
  133:9   error    Expected a line break after this opening brace   object-curly-newline
  133:16  error    Expected a line break before this closing brace  object-curly-newline
  143:52  error    Expected a line break after this opening brace   object-curly-newline
  143:61  error    Expected a line break before this closing brace  object-curly-newline

There are some kind of workarounds:

  1. remove ArgumentType from source code (wat?!)
  2. temporarily set "object-curly-newline": 0
    But both of them does not make sense
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 3, 2017
@not-an-aardvark
Copy link
Member

Closing as a duplicate of #9458

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators May 3, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants