🚀 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.component
which produces something funky like this:
export class HelloWorld.ComponentComponent
Describe 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-world
Anyway, I am in for a pull request.
🚀 Feature request
Command (mark with an
x)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.xshould fail.I noticed that people who are new to Angular tend to use the schematic like this for the first time:
which produces something funky like this:
Describe 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?
angular-cli/packages/schematics/angular/utility/validation.ts
Line 20 in eca5dc3
Describe alternatives you've considered
Have you considered any alternative solutions or workarounds?Anyway, I am in for a pull request.