Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[type-annotation-spacing] Throws Error on Constructor Interface Pattern #1669

Closed
jarretmoses opened this issue Mar 4, 2020 · 1 comment
Closed
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@jarretmoses
Copy link

jarretmoses commented Mar 4, 2020

Repro

I am using the default settings for this rule. ie spaces before and after arrows in functions needed and space after a colon is needed. You can recreate these rules with the following setup.

{
  "rules": {
    '@typescript-eslint/type-annotation-spacing': [
      2,
      {
        'overrides': {
          'arrow': {
            'before': true,
            'after': true,
          },
          'colon': {
            'before': false,
            'after': true,
          }
        }
      },
    ],
  }
}
  interface GoogleMaps {
    Polyline: new (opts?: google.maps.PolylineOptions) => google.maps.Polyline;
    LatLngBounds: new (
      sw?: google.maps.LatLng | google.maps.LatLngLiteral,
      ne?: google.maps.LatLng | google.maps.LatLngLiteral,
    ) => google.maps.LatLngBounds;
  }

Expected Result

The rule should pass as theres a space before and after the arrows on the constructor interfaces.

Actual Result

error Unexpected space before the '=>' @typescript-eslint/type-annotation-spacing

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.22.0
@typescript-eslint/parser 2.22.0
TypeScript 3.8.3
ESLint 6.6.0
node 12.4.1
npm 6.14.1
@jarretmoses jarretmoses added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 4, 2020
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Mar 4, 2020
@bradzacher
Copy link
Member

Please make sure you use the search for closed issues: #1667

There is a fix released to the canary tag, otherwise it'll be released to latest next monday.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants