Custom linter checks of Typegoose code #928
Replies: 3 comments 2 replies
-
looks great, didnt know this was really possible.
PS: i converted this to a discussion as this is not really a issue |
Beta Was this translation helpful? Give feedback.
-
that's interesting, thanks, I need to check if I can inspect generic types during linting
great idea, will check that as well
for this the default warning logic of Typegoose should be enough, but will keep in mind, thanks
tricky one, looks like it will need an update when new transform option is added
that's handy, it could catch some possible issues as well, thanks |
Beta Was this translation helpful? Give feedback.
-
Is there any chance you can create official eslint plugin for Typegoose based on what I did? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I did manage to create two custom ESLint rules to check Typegoose schemas' code and detect possible issues.
Maybe you can advise more places to check or suggest improvements for the rules?
This rule checks for inconsistencies between Typegoose and Typescript property definitions, requirement option, to be precise: if property is required for Typescript (
!
operator used) but optional for Typegoose (required
property is set tofalse
or omitted in@prop
) and vice versaThis rule checks for property type annotation and if it's going to be implicitly marked as
Mixed
by Typegoose (string[]
for example, will be marked asMixed
if you won't providetype: () => [String]
option for@prop
decorator), throws an errorBeta Was this translation helpful? Give feedback.
All reactions