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

component-selector stopped working in Angular v6 #620

Closed
dev054 opened this issue May 10, 2018 · 10 comments

Comments

@dev054
Copy link

@dev054 dev054 commented May 10, 2018

I have the config:

"component-selector": [true, "element", "sg", "kebab-case"],

and this component:

@Component({
  selector: 'sg-cmp' 
})
class AppCmp {}

Now I'm getting a warning

[tslint] The selector of the component "AppCmp" should have prefix "app" (https://angular.io/styleguide#style-02-07) (component-selector)

It used to working before upgrade.

ng -v:


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.0
Node: 9.10.1
OS: linux x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0
@wKoza

This comment has been minimized.

Copy link
Collaborator

@wKoza wKoza commented May 10, 2018

When you say "before upgrade", what are you talking about ? Angular, Angular CLI, Codelyzer or the both ?

@dev054

This comment has been minimized.

Copy link
Author

@dev054 dev054 commented May 11, 2018

I've upgraded everything.

Before all @angular related stuff was in 5.2.10 and Codelyzer 4.2.1. After upgrading I'm getting these warnings.

@wKoza

This comment has been minimized.

Copy link
Collaborator

@wKoza wKoza commented May 11, 2018

Are you sure about your tslint.json , maybe have you more than one component-selector entry in your file.
Can you push one repro in Github ?

@wKoza

This comment has been minimized.

Copy link
Collaborator

@wKoza wKoza commented May 16, 2018

Without further informations, I close this issue for the moment.

@wKoza wKoza closed this May 16, 2018
@SebasG22

This comment has been minimized.

Copy link

@SebasG22 SebasG22 commented Jun 1, 2018

@wKoza The issue should be open, the problem persist.
Typescript File
image
Tslint config
image

@wKoza

This comment has been minimized.

Copy link
Collaborator

@wKoza wKoza commented Jun 1, 2018

I think you confound the type (element or attribute) and the list of prefixes. You have an error because you have set prefixes app and page. You should therefore change your selector name with app-login-main or page-login-main.

@SebasG22

This comment has been minimized.

Copy link

@SebasG22 SebasG22 commented Jun 1, 2018

@wKoza You are right, but still not working.
captura de pantalla 2018-06-01 a la s 9 57 42 a m

@rafaelss95

This comment has been minimized.

Copy link
Collaborator

@rafaelss95 rafaelss95 commented Jun 3, 2018

Are you sure that your config are not being overwritten in <your-project>/src/tslint.json? It's a new file that came in angular-cli v6 and maybe you didn't notice that.

@SebasG22

This comment has been minimized.

Copy link

@SebasG22 SebasG22 commented Jun 4, 2018

@rafaelss95 thanks you, I realized that the src/tslint.json (Angular Generated) overwritten my global ( tslint.json )custom rules.

@Linkker

This comment has been minimized.

Copy link

@Linkker Linkker commented Sep 3, 2018

insert line
@component({
// tslint:disable-next-line:component-selector
selector: 'vtc-temp',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.