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

space-before-function-paren: Rewrite #2700

Merged
merged 3 commits into from
May 8, 2017

Conversation

andy-hanson
Copy link
Contributor

@andy-hanson andy-hanson commented May 6, 2017

PR checklist

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

Overview of change:

Just a refactor.
The previous implementation had special handling for FunctionDeclaration with an empty name; since this is a compiler error anyway, removed the special handling and its associated tests.

CHANGELOG.md entry:

[enhancement] space-before-function-paren: Handle get/set accessor

}
case ts.SyntaxKind.MethodDeclaration:
case ts.SyntaxKind.MethodSignature:
return options.method;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add SetAccessor and GetAccessor while you are already editing this rule?

const option = getOption(node, options);
if (option !== undefined) {
const openParen = Lint.childOfKind(node, ts.SyntaxKind.OpenParenToken)!;
const hasSpace = sourceFile.text[openParen.pos] !== "(";
Copy link
Contributor

Choose a reason for hiding this comment

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

this line should be changed to handle comments:

const hasSpace = ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(openParen.end - 2));

@andy-hanson andy-hanson force-pushed the space-before-function-paren branch from 7e28339 to 5b3f4e8 Compare May 7, 2017 21:55
@nchen63 nchen63 merged commit 8a96a2d into palantir:master May 8, 2017
@andy-hanson andy-hanson deleted the space-before-function-paren branch May 8, 2017 05:25
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.

3 participants