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

Add prefer-method-signature rule #2028

Merged
merged 2 commits into from Jan 14, 2017
Merged

Conversation

andy-hanson
Copy link
Contributor

@andy-hanson andy-hanson commented Jan 13, 2017

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update
  • Enable CircleCI for your fork (https://circleci.com/add-projects)

What changes did you make?

Added the prefer-method-signature rule, which recommends to use foo(): void over foo: () => void.

It looks like these will be semantically equivalent in TS2.2. (And were in 2.0.) microsoft/TypeScript#13148 (comment)

@adidahiya
Copy link
Contributor

How does this interact with member-ordering? I believe that rule treats these two different syntaxes differently w/r/t/ ordering.

@andy-hanson
Copy link
Contributor Author

I guess the fix wouldn't fully fix it in that case, because the method would then have to be manually re-ordered.

/* tslint:disable:object-literal-sort-keys */
public static metadata: Lint.IRuleMetadata = {
ruleName: "prefer-method-signature",
description: "Prefer `foo(): void` over `foo: () => void`.",
Copy link
Contributor

Choose a reason for hiding this comment

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

append "in interface and types"

public static metadata: Lint.IRuleMetadata = {
ruleName: "prefer-method-signature",
description: "Prefer `foo(): void` over `foo: () => void`.",
optionsDescription: "Not configurable.",
Copy link
Contributor

Choose a reason for hiding this comment

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

add hasFix: true,

@nchen63 nchen63 merged commit b2be1eb into palantir:master Jan 14, 2017
@nchen63
Copy link
Contributor

nchen63 commented Jan 14, 2017

@andy-hanson thanks!

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.

None yet

3 participants