feat(router): enforce convention of CamelCase names in route aliases
Closes #4083
This commit is contained in:
@ -44,6 +44,12 @@ export class RouteRecognizer {
|
||||
config(config: RouteDefinition): boolean {
|
||||
var handler;
|
||||
|
||||
if (isPresent(config.as) && config.as[0].toUpperCase() != config.as[0]) {
|
||||
var suggestedAlias = config.as[0].toUpperCase() + config.as.substring(1);
|
||||
throw new BaseException(
|
||||
`Route '${config.path}' with alias '${config.as}' does not begin with an uppercase letter. Route aliases should be CamelCase like '${suggestedAlias}'.`);
|
||||
}
|
||||
|
||||
if (config instanceof AuxRoute) {
|
||||
handler = new SyncRouteHandler(config.component, config.data);
|
||||
let path = config.path.startsWith('/') ? config.path.substring(1) : config.path;
|
||||
|
Reference in New Issue
Block a user