Skip to content

[explicit-function-return-type] Decorators being reported ESLint: Missing return type on function #2842

@abrarazeem

Description

@abrarazeem
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
      "@typescript-eslint/explicit-function-return-type": ["error", {
      allowExpressions: true
    }]
  }
}
import { Controller, HttpCode, HttpStatus } from '@nestjs/common'
import { AppService } from './app.service'
// Actually it's imported from @nestjs/common package but for the sake of testing and quick glimpse adding here.
export declare const Get: (path?: string | string[]) => MethodDecorator

@Controller()
export class AppController {

  constructor(private readonly appService: AppService) {}

  @Get() // ESLint: Missing return type on function.(@typescript-eslint/explicit-function-return-type)
  @HttpCode(HttpStatus.OK)
  getHello() {

    return this.appService.getHello()
  }
}

Expected Result
Decorators shouldn't be reported as missing return type.

Actual Result

Missing return type on function.eslint@typescript-eslint/explicit-function-return-type

Versions

package version
@typescript-eslint/eslint-plugin 4.9.0
@typescript-eslint/parser 4.9.0
TypeScript 4.1.2
ESLint 7.14.0
node 14.15.1

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