Skip to content

Bug: [space-infix-ops] false positive since version 5.27.0 #5133

Closed
@paztis

Description

@paztis

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.7.2&sourceType=module&code=FAOwhgtgpgzgDmAxlABDANgS2QESgMxQG9gUUoAPOAewCcAXFTEeqW-JVASQGV6xWxFAF9go4ABMoidGFqpE1EDEaJ5AqDyjpp9OgC4UYEAE8A3MGCUaDFFI4BXdKtkwYKLTsR7a7kmQxsTW1dOgAKRAdaeRY+DUNA3AIAOl5+VgBKBKwk-FS4wSIUeXookBRI6KhY9KgzEUsyKH4AcxhPUNpDMJV4tByoPDy0jQyUAF4APhQAJWk6CQAeFVpmFoAaNHpVkBbp8dIyCvVWDu9w+gALTBhkxOCvH02egbGp-qDk5rA2jItRIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKWQBwEMBjRAWgEsA7AM3IA9SB7PVDSR66yAGnG0gACAFwCeeFEWjk8Q0inhUhAenzEyVWg2aswAbT7YoiaNEbQeB7FkP9FAZgBMACUXow1AvGSJLEAL6WALp8AX5AA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

namespace sliceDef {
  export interface IState { }
}

declare const createSelector: any;

export default class Selectors {
  sliceSelector(currentState: sliceDef.IState): sliceDef.IState { return currentState; }

  etagsSelector: (state: sliceDef.IState) => Record<string, string> =
    createSelector(this.sliceSelector, (slice) => slice.etags);
}

ESLint Config

{
  "rules": {
    "space-infix-ops": "off",
    "@typescript-eslint/space-infix-ops": [
      "error",
      {
        "int32Hint": false
      }
    ]
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

no error

Actual Result

11:26 error Operator ':' must be spaced @typescript-eslint/space-infix-ops

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin 5.27.0
@typescript-eslint/parser 5.27.0
TypeScript 4.7.2
ESLint 8.16.0
node 16.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions