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: ignore return statements in dead code (fixes #11647) #11688

Merged
merged 2 commits into from May 11, 2019

Conversation

Projects
None yet
3 participants
@mysticatea
Copy link
Member

commented May 8, 2019

What is the purpose of this pull request? (put an "X" next to item)

[X] Bug fix #11647

What changes did you make? (Give an overview)

This PR fixes no-useless-return rule to ignore return statements in unreachable code.

Is there anything you'd like reviewers to focus on?

Nothing in particular.

output: "function foo() { return; }", // Other case is fixed in the second pass.
errors: [
{ message: "Unnecessary return statement.", type: "ReturnStatement" },
{ message: "Unnecessary return statement.", type: "ReturnStatement" }

This comment has been minimized.

Copy link
@mysticatea

mysticatea May 8, 2019

Author Member

The rule now ignores unreachable code, so the second return; is just ignored.

@mysticatea mysticatea force-pushed the issue11647 branch from 4fd7cc5 to f9cfb38 May 8, 2019

@mysticatea mysticatea changed the title Fix: ignore return statements in dead code (fixed #11647) Fix: ignore return statements in dead code (fixes #11647) May 8, 2019

@platinumazure
Copy link
Member

left a comment

One small suggestion, otherwise LGTM. Thanks!

Show resolved Hide resolved tests/lib/rules/no-useless-return.js Outdated
@mysticatea

This comment has been minimized.

Copy link
Member Author

commented May 9, 2019

Thank you for the review!

I added the column option to the last test case.

@platinumazure
Copy link
Member

left a comment

LGTM, thanks!

@not-an-aardvark not-an-aardvark merged commit 9484e9e into master May 11, 2019

5 checks passed

commit-message PR title follows commit message guidelines
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details

@not-an-aardvark not-an-aardvark deleted the issue11647 branch May 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.