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

jsx-closing-bracket-location when returning directly #243

Closed
danielkcz opened this issue Oct 11, 2015 · 4 comments
Closed

jsx-closing-bracket-location when returning directly #243

danielkcz opened this issue Oct 11, 2015 · 4 comments

Comments

@danielkcz
Copy link

With default settings, this is considered warning. I am wondering how do you write this kind of code.

    render() {
        return (<Application
            {...defaultProps}
            {...this.props}
            {...options}
        />);
    }

This looks totally weird in my opinion...

    render() {
        return (
        <Application
            {...defaultProps}
            {...this.props}
            {...options}
        />);
    }
@yannickcr
Copy link
Member

I personally write it this way:

    render() {
        return (
            <Application
                {...defaultProps}
                {...this.props}
                {...options}
            />
        );
    }

@danielkcz
Copy link
Author

Ah I see, that doesn't look so bad except it's two extra lines. Hmm. Do you think it would be possible to extend the rule so it can recognize alignment to return keyword ?

@yannickcr
Copy link
Member

It is possible to add another location type, with the same behavior of tag-aligned except when the tag is preceded with return.

render() {
  return (<App
    <Component
      {...defaultProps}
      {...this.props}
      {...options}
    />
  </App>);
}

@csilvers
Copy link

I think it's not just return. (We are seeing this same issue, and would prefer not to have the extra parens.) For instance, we'd like to be able to do

   var x = <App
      ...
   />;

A rule that makes sense to me is something like "equal the indentation of the line where the tag started". But I don't know if that gives bad results in other situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants