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

feat(warn): Warn component names hyphenated into reserved names, fix #8025 #8051

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

feat(warn): Warn component names hyphenated into reserved names, fix #8025 #8051

wants to merge 1 commit into from

Conversation

hatashiro
Copy link
Contributor

@hatashiro hatashiro commented Apr 19, 2018

Currently, component names like 'Map' is silently ignored, because they translated into reserved names but the component names are not exactly the same as the reserved names. The component names, thus, should be hyphenated before checking if reserved.

Resolve #8025.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

The reason of using hyphenate() instead of .toLowerCase() is that we should allow a name like MaP, as it is shown as ma-p in template and thus a valid component name.

Currently, component names like 'Map' is silently ignored, because they
translated into reserved names but the component names are not exactly
the same as the reserved names. The component names, thus, should be
hyphenated before checking if reserved.

Resolve #8025.
@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented Apr 20, 2018

Vue community has at least one popular library that uses Input or Select as component name. Say vuejs/vetur#303 and vuejs/eslint-plugin-vue#181 .

I don't know if it will be an annoying warning. cc @icarusion

@hatashiro
Copy link
Contributor Author

Didn’t know that these child components actually work when we use the capitalized name as it is. But I think it’s really ambiguous, because, as described in #8025, we are sometimes not sure if a name is reserved and should be used in case-sensitive way. I think it’s generally good to warn users when they’re using CamelCased reserved names.

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 this pull request may close these issues.

Creating a component named map should warn the user (as with button)
2 participants