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

feat(core): throw an exception instead of logging due to module import misusage #9596

Merged
merged 1 commit into from May 18, 2022

Conversation

micalevisk
Copy link
Member

@micalevisk micalevisk commented May 18, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

if the imports prop of @Module() has any class annotated with @Controller(), @Catch() or @Injectable(), we'll get an warning message like the following:

[DependenciesScanner] In the next major version, Nest will not allow classes annotated with @Injectable(), @Catch(), and @Controller() decorators to appear in the "imports" array of a module.
Please remove "AppController" (including forwarded occurrences, if any) from all of the "imports" arrays.

Scope [AppModule]

image

What is the new behavior?

as this is not allowed in v9, the app now exits with an error:

image

Does this PR introduce a breaking change?

  • Yes
  • No

@micalevisk
Copy link
Member Author

micalevisk commented May 18, 2022

after this PR and PR #9591 there will be no more TODO(v9) comments on master 🥳


Other changes that I found that we should make on v9 are:

/**
* Deprecated. Use the "addLeadingSlash" function instead.
* @deprecated
*/
export const validatePath = addLeadingSlash;

/**
* Starts the application (can be awaited).
* @deprecated use "listen" instead.

/**
* Starts all connected microservices and can be awaited.
* @deprecated use "startAllMicroservices" instead.

/**
* Starts the microservice (can be awaited).
* @deprecated use "listen" instead.

@coveralls
Copy link

coveralls commented May 18, 2022

Pull Request Test Coverage Report for Build fa82382f-7730-40ef-9fee-18244c47f3d1

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 94.106%

Totals Coverage Status
Change from base Build dc6b1e43-1d4d-4009-8b53-5ee2fd59bb11: -0.001%
Covered Lines: 5780
Relevant Lines: 6142

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

Other changes that I found that we should make on v9 are:

Feel free to create PRs for those @micalevisk! 🙌
LGTM

@kamilmysliwiec kamilmysliwiec changed the base branch from master to 9.0.0 May 18, 2022 07:28
@kamilmysliwiec kamilmysliwiec merged commit c5dbdaf into nestjs:9.0.0 May 18, 2022
@micalevisk micalevisk deleted the replace-warn-with-error branch May 18, 2022 11:24
@kamilmysliwiec kamilmysliwiec added this to the 9.0.0 milestone May 20, 2022
@kamilmysliwiec kamilmysliwiec mentioned this pull request May 20, 2022
12 tasks
@micalevisk micalevisk changed the title feat(core)!: throw an exception instead of logging due to module import misusage feat(core): throw an exception instead of logging due to module import misusage May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants