Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Add return-undefined rule #2251

Merged
merged 3 commits into from
Mar 20, 2017
Merged

Conversation

andy-hanson
Copy link
Contributor

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Adds the return-undefined rule, which specifies when to prefer return; vs return undefined;.

CHANGELOG.md entry:

[new-rule] return-undefined

return;
}

const returnKindFromExpression = !node.expression
Copy link
Contributor

Choose a reason for hiding this comment

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

rewrite as if statements

return;
}

const functionReturningFrom = Lint.ancestorWhere(node, isFunctionLike)! as FunctionLike;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should handle undefined return value properly. This may crash TSLint later when linting invalid code.

@nchen63 nchen63 merged commit 216f319 into palantir:master Mar 20, 2017
@andy-hanson andy-hanson deleted the return-undefined branch March 20, 2017 02:12
@nchen63
Copy link
Contributor

nchen63 commented Mar 20, 2017

@andy-hanson broke master when merged. Looks like it needs to converted to use Program

@andy-hanson andy-hanson mentioned this pull request Mar 21, 2017
AJamesPhillips pushed a commit to AJamesPhillips/tslint that referenced this pull request Mar 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants