Skip to content

[promise-function-async] Error line offset when using decorators #751

@RecuencoJones

Description

@RecuencoJones

Repro

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "tsconfig.json"
  },
  "plugins": [
    "@typescript-eslint"
  ],
  "rules": {
    "@typescript-eslint/promise-function-async": "error"
  }
}
{
  "compilerOptions": {
    "target": "es2017",
    "experimentalDecorators": true
  },
  "files": [
    "index.ts"
  ]
}
const SomeFancyDecorator = (): MethodDecorator => (target) => target;

export class Foo {
  @SomeFancyDecorator()
  method() {
    return Promise.resolve('foo');
  }
}

Expected Result

/Users/recuedav/Workspace/GitHub/RecuencoJones/typescript-eslint-issue/index.ts
  5:3  error  Functions that return promises must be async  @typescript-eslint/promise-function-async

✖ 1 problem (1 error, 0 warnings)

Actual Result

/Users/recuedav/Workspace/GitHub/RecuencoJones/typescript-eslint-issue/index.ts
  4:3  error  Functions that return promises must be async  @typescript-eslint/promise-function-async

✖ 1 problem (1 error, 0 warnings)

Additional Info

Repository for reproduction: https://github.com/RecuencoJones/typescript-eslint-issue-751

Versions

package version
@typescript-eslint/eslint-plugin 1.11.0
@typescript-eslint/parser 1.11.0
TypeScript 3.4.3
ESLint 5.16.0
node 10.15.0
npm 6.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy