darraghoriordan / eslint-plugin-nestjs-typed

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

ValidateIf should be handled like IsOptional #115

Open Inoir opened 11 months ago

Inoir commented 11 months ago

If you use ValidateIf in combination with IsDefined on an optional marked property in TS, the linter shows missing IsOptional decorator.

  @ValidateIf((o) => !o.id)
  @IsDefined()
  @IsString()
  key?: string

This should be valid. Currently @darraghor/nestjs-typed/all-properties-have-explicit-defined throws: Optional properties must have @IsOptional() decorator

darraghoriordan commented 11 months ago

oh yea i dont think i did anything special for validateif. thanks for reporting.

I'll get to this before the end of the year hopefully

adamvandenhoven commented 7 months ago

I've added a PR to implement this requested feature. First time for me, let me know what I've missed.