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

Treat one-line arrow funcs like a normal statement regarding semicolons #1680

Merged
merged 1 commit into from
Nov 5, 2016

Conversation

nchen63
Copy link
Contributor

@nchen63 nchen63 commented Nov 4, 2016

PR checklist

What changes did you make?

Only apply rule of arrows and semicolons on multiline functions

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

(optional)

@nchen63 nchen63 merged commit 81dd64a into master Nov 5, 2016
@nchen63 nchen63 deleted the semicolon-one-liner branch November 5, 2016 01:04
if (initializer && initializer.kind === ts.SyntaxKind.ArrowFunction) {

// check if this is a multi-line arrow function (`[^]` in the regex matches all characters including CR & LF)
if (initializer && initializer.kind === ts.SyntaxKind.ArrowFunction && /\{[^]*\n/.test(node.getText())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this condition is getting pretty long; I think the last test with the regex belongs in its own simple function; that would allow you to move the comment elsewhere as well

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

semicolon rule should not complain about unnecessary semicolons on single-line lambdas
2 participants