-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat(@schematics/angular): support different file name style guides in ng new
#31053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@clydin
clydin
added
the
target: major
This PR is targeted for the next major release
label
Aug 27, 2025
@angular-robot
angular-robot
bot
added
detected: feature
PR contains a feature commit
area: @schematics/angular
labels
Aug 27, 2025
@clydin
clydin
added
the
action: review
The PR is still awaiting reviews from at least one requested reviewer
label
Aug 27, 2025
@clydin
clydin
force-pushed
the
ng-schematics/ng-new-style-guide
branch
3 times, most recently
from
August 28, 2025 15:40
5e447cd
to
00bca37
Compare
...n `ng new` Introduces the ability to configure the file naming convention for generated files directly within the `ng new` schematic. This allows users to create new workspaces that adhere to the 2016 style guide conventions, as an alternative to the default 2025 style guide. For more information, see the Angular Style Guide (https://angular.dev/style-guide). When a user runs `ng new --file-name-style-guide 2016`: - The `ng-new` schematic passes the style guide option down to the `application` sub-schematic. - The `application` schematic configures the `schematics` section of the new `angular.json` to use the 2016 naming conventions for future `ng generate` commands. - The `application` schematic generates the initial application files with the appropriate suffixes (e.g., `app.component.ts`). This addresses community feedback requesting a way to maintain the previous file naming structure for consistency in existing projects and workflows. Fixes angular#30594
...t schematics Introduces a new `addTypeToClassName` option to the `component`, `directive`, and `service` schematics. This option controls whether the schematic's `type` (e.g., 'Component', 'Directive', 'Service') is appended to the generated class name. When `fileNameStyleGuide` is set to `'2016'` in `ng new`, `addTypeToClassName` is automatically set to `false` for these schematics in `angular.json`. This ensures that while file names follow the 2016 style (e.g., `app.component.ts`), class names remain concise (e.g., `AppComponent` instead of `AppComponentComponent`), aligning with future selectorless template conventions. This change provides greater flexibility in naming conventions, allowing users to choose between more verbose class names (default for 2025 style guide) and more concise ones (for 2016 style guide).
@clydin
clydin
force-pushed
the
ng-schematics/ng-new-style-guide
branch
from
August 28, 2025 16:28
00bca37
to
13b34ce
Compare
@clydin
clydin
requested review from
dgp1130
and removed request for
alan-agius4
August 29, 2025 00:43
giacomo
commented
Aug 29, 2025
just in case this are my scheme settings that i use:
"schematics": {
"@schematics/angular:component": {
"type": "component",
"style": "scss",
"standalone": false
},
"@schematics/angular:directive": {
"type": "directive",
"standalone": false
},
"@schematics/angular:service": {
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"typeSeparator": ".",
"standalone": false
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
alan-agius4
alan-agius4
approved these changes
Sep 2, 2025
@alan-agius4
alan-agius4
added
action: merge
The PR is ready for merge by the caretaker
and removed
action: review
The PR is still awaiting reviews from at least one requested reviewer
labels
Sep 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Introduces the ability to configure the file naming convention for generated files directly within the
ng new
schematic. This allows users to create new workspaces that adhere to the 2016 style guide conventions, as an alternative to the default 2025 style guide. For more information, see the Angular Style Guide (https://angular.dev/style-guide).When a user runs
ng new --file-name-style-guide 2016
:ng-new
schematic passes the style guide option down to theapplication
sub-schematic.application
schematic configures theschematics
section of the newangular.json
to use the 2016 naming conventions for futureng generate
commands.application
schematic generates the initial application files with the appropriate suffixes (e.g.,app.component.ts
).Fixes #30594