I have some custom class-validator decorators that I would like to enforce this rule on. Currently, we detect if an import is a class-validator import by detecting if the import is from class-validator. This prevents the rule from being enforced when custom validators are applied.
Proposed solutions
Extend the available options to include an additional param customClassValidatorDecorators which will take in a list of decorator names to check. This is a simple string match check, but has the con of naming collisions if for whatever reason we have other decorators of the same name within the project not meant for validation. It is also consistent with the current additionalTypeDecorators options api.
Extend available options to take in a list of file paths for imports to check against. This file path will contain all the custom decorators we wrote. Con: This prevents naming collisions, and will not require us to update the decorator names whenever we add new decorators to the project.
Context
I have some custom class-validator decorators that I would like to enforce this rule on. Currently, we detect if an import is a
class-validator
import by detecting if the import is fromclass-validator
. This prevents the rule from being enforced when custom validators are applied.Proposed solutions
customClassValidatorDecorators
which will take in a list of decorator names to check. This is a simple string match check, but has the con of naming collisions if for whatever reason we have other decorators of the same name within the project not meant for validation. It is also consistent with the currentadditionalTypeDecorators
options api.