Closed falahati closed 2 years ago
hey, thanks for reporting this
Yup, feels like a nice way to improve this would be to allow you to pass a custom list of ignores to the rule.
Not sure if decorator names or data types is best. will think about it :D
This should be fixed for you in version 3.12.0
you can add any custom type decorators to the options now
"@darraghor/nestjs-typed/validated-non-primitive-property-needs-type-decorator": [
"error",
{additionalTypeDecorators: ["TransformDate"]},
],
I added a test for your scenario but let me know if there are any issues with it.
thanks @darraghoriordan
It is helpful if we are able to exclude some data types or list decorators that are identical in functionality to the
@Type
decorator.For example, we are currently using custom transformers for
Map<>
andDate
, and altho these decorators take care of all these, this rule still nags about not having theType
decorator which is not required at all; but for this reason, we had to disable it which is unfortunate since it is a very good rule to have active.Here,
TransformDate
takes care of transformation and noType
decorator is required:Having options to disable this rule for one or more data types, or disable it when another decorator is used will be very useful for more complex projects.
And thanks for this plugin, very useful for staying away from possible pitfalls.