Skip to content

Creating a component with prefix makes linting to fail #5794

Closed
@jmendiara

Description

@jmendiara

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

$ ng --version
@angular/cli: 1.0.0
node: 6.10.0
os: darwin x64
@angular/animations: 4.0.1
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1

Repro steps.

$ ng g m babies --routing
$ ng g c babies/detail --prefix babies

this generates

@Component({
  selector: 'babies-detail', // <- expected selector. OK!
  templateUrl: './detail.component.html',
  styleUrls: ['./detail.component.scss']
})
//...

But now, the linting fails!

The log given by the failure.

$ npm run lint
# ...
/src/app/babies/detail/detail.component.ts[4, 13]: The selector of the component 
"DetailComponent" should have one of the prefixes: app (https://goo.gl/cix8BY)

Lint errors found in the listed files.

Desired functionality.

Creating a component with a custom prefix should update tslint.json with the provided one
from

{
    "component-selector": [true, "element", "app", "kebab-case"],
}

to

{    
    "component-selector": [true, "element", ["app", "babies"], "kebab-case"],
}

Mention any other details that might be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussioneffort1: easy (hours)featureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions