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

commented Mar 13, 2019

Fixes #2199.

… statement within a do expression (with tests)

Fixes #2199.
@Kenneth-KT Kenneth-KT force-pushed the Kenneth-KT:fix_wrong_expected_indent_with_do_expr branch 2 times, most recently from 6654664 to 059dd68 Mar 13, 2019
Copy link
Collaborator

left a comment

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

@Kenneth-KT

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Collaborator

commented Apr 28, 2019

Yep!

@Kenneth-KT Kenneth-KT force-pushed the Kenneth-KT:fix_wrong_expected_indent_with_do_expr branch from 059dd68 to 02c2230 Sep 29, 2019
@Kenneth-KT

This comment has been minimized.

Copy link
Contributor Author

commented Sep 29, 2019

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 Kenneth-KT:fix_wrong_expected_indent_with_do_expr branch from 02c2230 to af890c2 Sep 29, 2019
@Kenneth-KT Kenneth-KT requested a review from ljharb Sep 29, 2019
@Kenneth-KT Kenneth-KT force-pushed the Kenneth-KT:fix_wrong_expected_indent_with_do_expr branch from af890c2 to c478bc8 Sep 30, 2019
@ljharb ljharb force-pushed the Kenneth-KT:fix_wrong_expected_indent_with_do_expr branch from c478bc8 to 32e27b7 Oct 1, 2019
@ljharb
ljharb approved these changes Oct 1, 2019
@ljharb ljharb merged commit 32e27b7 into yannickcr:master Oct 1, 2019
2 of 4 checks passed
2 of 4 checks passed
Tidelift Scanning dependencies
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.01%) to 97.575%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.