Skip to content

Closing braces being flushed all the way to the left for inline component props #2035

Closed
@riwu

Description

@riwu

Tell us about your environment

  • ESLint Version:
"eslint": "^5.7.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.11.1",
  • Node Version: v8.12.0
  • yarn Version: 1.9.4

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

Please show your full configuration:

Configuration
{
  "root": true,
  "extends": "airbnb",
  "parser": "babel-eslint",
  "rules": {
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "react/prop-types": 0,
    "no-console": 0,
    "no-debugger": 0,
    "react/sort-comp": 0
  }
}

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

const Component = () => (
  <View
    ListFooterComponent={
      <View
        rowSpan={3}
        placeholder="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do"
      />
    }
  />
);
eslint --fix

What did you expect to happen?
It should be formatted like this instead:

const Component = () => (
  <View
    ListFooterComponent={(
      <View
        rowSpan={3}
        placeholder="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do"
      />
    )}
  />
);

On the older versions, it will not flush the brackets to the left:

"eslint": "^4.13.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",

What actually happened? Please include the actual, raw output from ESLint.
Line 11's closing braces are being flushed to the left when eslint formats it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions