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

[Feature Request] Component Selector Required #551

Closed
sam-s4s opened this issue Mar 28, 2018 · 3 comments · Fixed by #557
Closed

[Feature Request] Component Selector Required #551

sam-s4s opened this issue Mar 28, 2018 · 3 comments · Fixed by #557
Assignees

Comments

@sam-s4s
Copy link

sam-s4s commented Mar 28, 2018

Quick feature request... I'd love it if there was a rule I could enable that would force people to always include a selector for any @component. Currently if it's for a dialog (dynamically created component) or routed page, you don't technically need one, but it makes the DOM a bit messy.

Perhaps it could be added to the existing component-selector rule?

@wKoza
Copy link
Collaborator

wKoza commented Mar 28, 2018

Hi,
What do you think when you say "but it makes the DOM a bit messy." ?

@lazarljubenovic
Copy link
Contributor

It's difficult to debug or get around it at all, since the selector which Angular uses for components without a selector is ng-component.

Since you don't need it for any dynamic component, including things such as modals, flash messages and routes, you could easily end up with something like the following.

<ng-component>
  <h1>Title</h1>
  <nav> ... </nav>
  <ng-component>
    <h2>Subtitle</h2>
    <p> ... </p>
  </ng-component>
  <ng-component>
    Modal
  </ng-component>
</ng-component>

@wKoza
Copy link
Collaborator

wKoza commented Mar 28, 2018

Ok. It makes sense 👍 . Adding this check to component-selector is an option since his rationale:

Components are easy to identify in the DOM

but, this rule is embedeed with Angular CLI and we are dealing with a Breaking change...
So, we should add an option that active the check like this:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants