darraghoriordan / eslint-plugin-nestjs-typed

Some eslint rules for working with NestJs projects
http://www.darraghoriordan.com
174 stars 34 forks source link

@darraghor/nestjs-typed/param-decorator-name-matches-route-param - doesn't handle '?' #14

Closed alvipeo closed 3 years ago

alvipeo commented 3 years ago

if I have the following:

   @Get(":app?")
   @ApiOperation({ summary: "Return Releases" })
   @ApiResponse({
      isArray: true,
      status: 200,
      description: "Releases list is returned successfully."
   })
   async getReleases(@Param("app") app: SomeApp | undefined): Promise<ReleaseDto[]> {
      return this.queryBus.execute<ReleasesQuery, ReleaseDto[]>(new ReleasesQuery(app));
   }

list produces an error saying:

Param decorators with identifiers e.g. Param("myvar") should match a specified route parameter - e.g. Get(":myvar")

but this if I add '?' to the @Param("app?"), the controller doesn't work anymore (actual param value is always undefined).

darraghoriordan commented 3 years ago

ah yea. this is a bug in the plugin for sure.

you can ignore the rule for now but i'll work on fixing this

darraghoriordan commented 3 years ago

This is fixed in 3.5.5

The rule will ignore any routes with fuzzy paths for now

I made a note in the readme also.

thanks for reporting the issue