darraghoriordan / eslint-plugin-nestjs-typed

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

validated-non-primitive-property-needs-type-decorator doesn't work on Arrays #15

Closed iddan-flycode closed 2 years ago

iddan-flycode commented 2 years ago
// valid
class Example {
    @ApiProperty({ isArray: true })
    @ValidateNested({ each: true })
    // @Type(() => Foo)
    repositories!: Foo[];
}

// invalid
class Example {
    @ApiProperty()
    @ValidateNested()
    // @Type(() => Foo)
    repositories!: Foo;
}
darraghoriordan commented 2 years ago

I had a look at this and I wrote it so it expect @IsArray() on the array property to check if the type should be present

i changed it to also support have validate nested only

fix in version 3.5.7

thanks for reporting

iddan commented 2 years ago

Thank you 🙏