Skip to content

[object-shorthand] autofix breaks arrow functions with function types #124

Closed
@nstepien

Description

@nstepien

What code were you trying to parse?

/* eslint object-shorthand: [1, "always", { avoidExplicitReturnArrows: true }] */
const test = {
  key: (arg: () => any) => {}
}

What did you expect to happen?
Autofix result should be

/* eslint object-shorthand: [1, "always", { avoidExplicitReturnArrows: true }] */
const test = {
  key(arg: () => any) {}
}

What actually happened?
Autofix gives

/* eslint object-shorthand: [1, "always", { avoidExplicitReturnArrows: true }] */
const test = {
  key(arg: () any) => {}
}

Versions

package version
@typescript-eslint/parser 1.0.0
TypeScript 3.2.4
ESLint 5.12.1
node 11.7.0
npm 6.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalThis issue is with another package, not typescript-eslint itselfpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions