Skip to content

Conversation

harshlakhara
Copy link

fix(@schematics/angular): add validation for component and directive class name

class names for directives and components when they are created using ng generate component <className>
added tests for the changes made above

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #28548

What is the new behavior?

When a component or directive is created using an invalid character, such as a class name that begins with a number or a component or directive name that contains only a number, cli will throw an error.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Oct 4, 2024
@alan-agius4 alan-agius4 merged commit 6dbfc77 into angular:main Oct 4, 2024
33 checks passed
@alan-agius4
Copy link
Collaborator

The changes were merged into the following branches: main, 18.2.x

@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 Nov 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@angular/cli accepts component name starting with numerical character which is not supported as class name

2 participants