Skip to content

fix(@schematics/angular): consecutive blank lines in routing.module.ts #18226

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

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

sacgrover
Copy link
Contributor

Fixes: #18220

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sacgrover,

Thanks for this, however I think the proper fix would be something like the below, as otherwise when there is the import for the component file there wouldn't be a blank line between the import and the const declaration.

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';<% if (lazyRoute) { %>
import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';<% } %>

const routes: Routes = [<% if (lazyRoute) { %>{ path: '', component: <%= classify(name) %>Component }<% } %>];

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release labels Jul 13, 2020
@sacgrover
Copy link
Contributor Author

sacgrover commented Jul 13, 2020

@alan-agius4 Ok, I will do that.. Actually, I made the same earlier but to make it consistent with other I modified. Because there are a blank line between module import and component import in other places.
like this https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/application/other-files/app.module.ts.template#L5

@alan-agius4
Copy link
Collaborator

@sacgrover, I see, in that case there should be a blank line in the logical statement and before the constant declaration.

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';<% if (lazyRoute) { %>

import { <%= classify(name) %>Component } from './<%= dasherize(name) %>.component';<% } %>

const routes: Routes = [<% if (lazyRoute) { %>{ path: '', component: <%= classify(name) %>Component }<% } %>];

@sacgrover
Copy link
Contributor Author

sacgrover commented Jul 14, 2020

Changes done as per asked.
Seems like it got failed without any reason. It needs to get rerun. Could you please do that?

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jul 14, 2020
@ngbot
Copy link

ngbot bot commented Jul 14, 2020

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/angular: size" is failing
    failure status "ci/circleci: e2e-cli" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@sacgrover
Copy link
Contributor Author

LGTM, thanks

Could You please rerun it as i don't have permissions for it?

@clydin clydin merged commit d4198e5 into angular:master Jul 15, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint Issue: Angular CLI generate app-routing.module.ts with consecutive blank lines
4 participants