darraghoriordan / eslint-plugin-nestjs-typed

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

New Rule Suggestion: disallow multiple usage of the same 'discoverable' decorator #111

Closed micalevisk closed 1 year ago

micalevisk commented 1 year ago

since @nestjs/core v10.2.0 we can use the DiscoveryService.createDecorator to create type-safe decorators

but we shouldn't be using them multiple times like this:

image

I'm not sure if this is feasbile to achieve as a lint rule.


sample code: https://stackblitz.com/edit/nestjs-discovery-service-issue-bt5oae

darraghoriordan commented 1 year ago

Yea nice, this could be a rule. It could even be configurable because most of the decorators from nest/core likely shouldnt be applied twice.

micalevisk commented 1 year ago

@darraghoriordan good ideia

are you 100% sure that something like that is possible to have as a rule? I'm not familiar with ESLint rules but I can give it a try

darraghoriordan commented 1 year ago

:tada: This issue has been resolved in version 4.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

darraghoriordan commented 1 year ago

Hey I added this rule. You can read the docs to see how you would configure it with your own list of decorators like "DiscoverDecorator".