-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @schematics/angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Milestone
Description
🚀 Feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [X] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
A clear and concise description of the problem or missing capability...Using dots in component name when using component schematic (might also happen with other schematics) should fail. I.e. ng generate component a.b.x should fail.
I noticed that people who are new to Angular tend to use the schematic like this for the first time:
ng generate component hello-world.componentwhich produces something funky like this:
export class HelloWorld.ComponentComponentDescribe the solution you'd like
If you have a solution in mind, please describe it.Use some whitelist regex to check the component's name before.
By the way, why does the component's selector allow dots in the regular expression below?
| export const htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/; |
Describe alternatives you've considered
Have you considered any alternative solutions or workarounds?ng generate component hello-world.component
echo D'OH!
git reset --hard
git clean -d -f
ng generate component hello-worldAnyway, I am in for a pull request.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @schematics/angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix