Skip to content

[type-annotation-spacing] 2.22.0 regression for constructor arrow function types #1663

Closed
@kryops

Description

Repro

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": [
    "@typescript-eslint"
  ],
  "rules": {
    "@typescript-eslint/type-annotation-spacing": ["error"]
  }
}
type ConstructorFn = new (...args: any[]) => any;

Expected Result
No error

Actual Result

Unexpected space before the '=>'.eslint(@typescript-eslint/type-annotation-spacing)

Additional Info

This only seems to affect 2.22.0. When downgrading to 2.21.0, the error is gone.

Normal arrow functions without a new keyword are not affected:

type ArrowFn = (...args: any[]) => any;

Versions

package version
@typescript-eslint/eslint-plugin 2.22.0
@typescript-eslint/parser 2.22.0
TypeScript 3.7.5
ESLint 6.8.0
node 10.15.3
npm yarn 1.17.3

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: 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