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

[Fix] jsx-indent: Fix false positive when a jsx element is the last statement within a do expression #2200

Merged

Conversation

Kenneth-KT
Copy link
Contributor

Fixes #2199.

… statement within a do expression (with tests)

Fixes jsx-eslint#2199.
@Kenneth-KT Kenneth-KT force-pushed the fix_wrong_expected_indent_with_do_expr branch 2 times, most recently from 6654664 to 059dd68 Compare March 13, 2019 23:35
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some test cases to cover this; both paren-wrapped and not.

@Kenneth-KT
Copy link
Contributor Author

Kenneth-KT commented Apr 28, 2019

Please add some test cases to cover this; both paren-wrapped and not.

By paren-wrapped, did you mean this?

const TestDoExpression = () => (
  <div>
    {(do {
      const num = 1 + 1;
      <div>{num}</div>;
    })}
  </div>
);

@ljharb
Copy link
Member

ljharb commented Apr 28, 2019

Yep!

@Kenneth-KT Kenneth-KT force-pushed the fix_wrong_expected_indent_with_do_expr branch from 059dd68 to 02c2230 Compare September 29, 2019 08:31
@Kenneth-KT
Copy link
Contributor Author

Pardon me for the late reply.

While adding required test cases, I discovered few more cases that need to be handled so I revisited & rewritten the code.

I've just pushed a new commit with tests, thanks for the patience.

@Kenneth-KT Kenneth-KT force-pushed the fix_wrong_expected_indent_with_do_expr branch from 02c2230 to af890c2 Compare September 29, 2019 12:29
@Kenneth-KT Kenneth-KT force-pushed the fix_wrong_expected_indent_with_do_expr branch from af890c2 to c478bc8 Compare September 30, 2019 20:50
@ljharb ljharb force-pushed the fix_wrong_expected_indent_with_do_expr branch from c478bc8 to 32e27b7 Compare October 1, 2019 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

False positive react/jsx-indent when working with DoExpression
2 participants