Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Mar 10, 2025

To align with the updated style guide, Angular v20 will generate components without a .component file extension type for all component related files by default. Projects will automatically use this naming convention. Projects can however opt-out by setting the type option to Component for the component schematic. This can be done as a default in the angular.json or directly on the commandline via --type=Component when executing ng generate. As an example, app.component.css will now be named app.css. Additionally, the TypeScript class name will be App instead of the previous AppComponent.

@clydin clydin added the target: major This PR is targeted for the next major release label Mar 10, 2025
@clydin clydin force-pushed the style-guide/component-empty-type branch 21 times, most recently from a724eab to 12110c1 Compare March 12, 2025 19:53
clydin added 2 commits March 13, 2025 19:39
…ule decorator

The Angular module discovery logic previously did not check for the presence
of a potential `@NgModule` decorator. This can cause false positive results
for files with a module-like naming pattern.
…extension/type

To align with the updated style guide, Angular v20 will generate components
without a `.component` file extension type for all component related
files by default. Projects will automatically use this naming convention.
Projects can however opt-out by setting the `type` option to `Component`
for the component schematic. This can be done as a default in the `angular.json`
or directly on the commandline via `--type=Component` when executing `ng generate`.
As an example, `app.component.css` will now be named `app.css`. Additionally,
the TypeScript class name will be `App` instead of the previous `AppComponent`.
@clydin clydin force-pushed the style-guide/component-empty-type branch from 12110c1 to aae346e Compare March 13, 2025 23:41
@clydin clydin marked this pull request as ready for review March 13, 2025 23:42
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Mar 14, 2025
@dgp1130 dgp1130 merged commit 23fc8e1 into angular:main Mar 14, 2025
32 checks passed
@clydin clydin deleted the style-guide/component-empty-type branch March 14, 2025 18:36
@erkamyaman
Copy link

erkamyaman commented Apr 1, 2025

@clydin @alan-agius4 @dgp1130 as I understand it, this change only affects component-related files. Are there any plans to bring similar naming updates to other constructs like directives, pipes, or services? Would love to hear your thoughts!

@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 May 2, 2025
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: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants