Skip to content

chore: force component and route names to have dashes #467

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
Apr 20, 2016

Conversation

Brocco
Copy link
Contributor

@Brocco Brocco commented Apr 20, 2016

No description provided.

@hansl
Copy link
Contributor

hansl commented Apr 20, 2016

Could you add a test 😄

@@ -16,6 +27,11 @@ module.exports = {
var parsedPath = dynamicPathParser(this.project, entityName);

this.dynamicPath = parsedPath;

if (!validateName(parsedPath.name)) {
throw 'Invalid name. Names must be camelCase or kabob-case';
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean kebab-case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should know better than to trust my spelling, ever since 3rd grade when I spelled enough "enuff"

Thanks for catching that @gkalpak!

@Brocco Brocco force-pushed the force-dashed-components branch from 0e103c8 to 5858a5e Compare April 20, 2016 09:35
@@ -16,6 +27,11 @@ module.exports = {
var parsedPath = dynamicPathParser(this.project, entityName);

this.dynamicPath = parsedPath;

if (!validateName(parsedPath.name)) {
throw 'Invalid name. Names must be camelCase or kebab-case';
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, the message might be confusing with single-word names, since toast is technically valid camelCase and kebab-case.

More generally, validateName() isn't strict at all, which means that all sorts of non-camelCase-or-kebab-case names would pass. (But maybe that's intentional.)

Copy link
Contributor Author

@Brocco Brocco Apr 20, 2016

Choose a reason for hiding this comment

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

The purpose of this is to enforce the selector to contain a - so I agree, I'll tweak it to show a more useful message to the user.

I'm aware that the names can contain any variety of capital/lower/dash characters, but that is indeed intentional, as long as the name transformation creates a selector with at least 1 dash, then it will satisfy the HTML spec for custom elements.

I'm open to suggestions on the actual error message, I currently have this:

Names must contain a dash either include a dash or multiCase name. (i.e. multiCase -> multi-case)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's better. "Invalid name" does scare people off.

@hansl
Copy link
Contributor

hansl commented Apr 20, 2016

Change the message, then LGTM 👍

@Brocco Brocco force-pushed the force-dashed-components branch from 5858a5e to cd4dcf0 Compare April 20, 2016 17:17
@hansl hansl merged commit baa5754 into angular:master Apr 20, 2016
@Brocco Brocco deleted the force-dashed-components branch April 20, 2016 17:46
@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 Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants