Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Rule Suggestion: forbids app.get() for APP_* tokens #119

Open
micalevisk opened this issue Nov 19, 2023 · 1 comment
Open

New Rule Suggestion: forbids app.get() for APP_* tokens #119

micalevisk opened this issue Nov 19, 2023 · 1 comment

Comments

@micalevisk
Copy link
Contributor

micalevisk commented Nov 19, 2023

as mentioned here: nestjs/docs.nestjs.com#2178 we can't do app.get(APP_GUARD)/app.get(APP_PIPE)/app.get(APP_FILTER)/app.get(APP_INTERCEPTOR) due to how those "providers" works. I tested it myself.

thus I'd like to have a rule that forbids calling app.get over then so we can prevent misusages that will lead to runtime errors

Also, I believe we can extend this to @Inject(APP_*) as well due to the same reason

@micalevisk micalevisk changed the title rule suggestion: forbids app.get() over APP_* tokens New Rule Suggestion: forbids app.get() over APP_* tokens Nov 19, 2023
@micalevisk micalevisk changed the title New Rule Suggestion: forbids app.get() over APP_* tokens New Rule Suggestion: forbids app.get() for APP_* tokens Nov 19, 2023
@darraghoriordan
Copy link
Owner

yea i understand what you mean. This kind of thing is perfect for ESLint to catch for sure.

It could be as simple as matching the strings because its unlikely a dev would call a pipe APP_PIPE. It might cause issues but the rule could be disabled individually for the line in those cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants