Skip to content

ng new --viewEncapsulation Native|None|ShadowDom generates invalid code #13742

Closed

Description

@thojo

🐞 Bug report

Command (mark with an x)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.3.2

Description

The fix for #13689 now generates a second comma between styleUrls and encapsulation. The comma behind styleUrls is now also present if the flag --viewEncapsulation is not set at all and styleUrls is the last property.

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],, // ❗ duplicate comma
  encapsulation: ViewEncapsulation.Native
})
export class AppComponent {
}
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'], // ❗ unnecessary comma
})
export class AppComponent {
}

🔬 Minimal Reproduction

  • ng new view-test --skipGit --skipInstall --viewEncapsulation None
  • ng new view-test --skipGit --skipInstall

🔥 Exception or Error

ERROR in src/app/app.component.ts(6,38): error TS1136: Property assignment expected.

🌍 Your Environment

Angular CLI: 7.3.3
Node: 10.15.1
OS: win32 x64
Angular: 7.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.3
@angular-devkit/build-angular     0.13.3
@angular-devkit/build-optimizer   0.13.3
@angular-devkit/build-webpack     0.13.3
@angular-devkit/core              7.3.3
@angular-devkit/schematics        7.3.3
@angular/cli                      7.3.3
@ngtools/webpack                  7.3.3
@schematics/angular               7.3.3
@schematics/update                0.13.3
rxjs                              6.3.3
typescript                        3.2.4
webpack                           4.29.0

Activity

  1. alan-agius4 commented on Feb 22, 2019

    @alan-agius4
    Collaborator

    Fixed by #13740

  2. added this to the needsTriage milestone on Feb 22, 2019
  3. modified the milestones: needsTriage, Backlog on Feb 22, 2019
  4. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    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.

  5. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions