refactor(@angular-devkit/schematics): add consistent spacing and ordering#33247
Open
russelporosky wants to merge 2 commits into
Open
refactor(@angular-devkit/schematics): add consistent spacing and ordering#33247russelporosky wants to merge 2 commits into
russelporosky wants to merge 2 commits into
Conversation
…ring * add consistent spacing and tags around `<%`, `%>, and operators * reorder component decorator properties to be alphabetical * remove empty constructors * change spacing to ensure all outputs are consistently styled
There was a problem hiding this comment.
Code Review
This pull request standardizes the formatting and property ordering across various Angular schematic templates. Key changes include reordering @component decorator properties for consistency, removing unnecessary empty lines and constructors, and ensuring consistent spacing within template tags. A critical issue was identified where missing trailing commas in the reordered component properties would result in syntax errors in the generated code.
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
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.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Schematics have an inconsistent output style. Some include a blank line between system and local
imports, some have blank lines inside classes (including empty classes), thecompileComponents()call in tests is sometimes inline and sometimes not, the spacing within<%... %>tags is widely variable, closing and opening tags are occasionally combined, and component properties are randomly ordered.What is the new behavior?
This PR homogenizes code style within the templates to be more predictable and consistent. All
<%... %>usages are consistent, closing braces are not combined with a new statement (so<% } if () { %>has become<% } %><% if () { %>), spacing has been applied consistently aroundifandelsestatements and their braces, component properties are alphabetized, blank lines within classes and between imports have been removed, an empty constructor has been removed, and.compileComponents()is the same across spec files.Does this PR introduce a breaking change?
No tests required updating and no new tests are required.
Other information
This is a simple quality of life update so the schematic outputs look consistent - all imports are in a single block instead of some having blank lines and others not, classes follow the style guide by not having blank lines at the beginning and end and not having empty constructors, test files all use
compileComponents()the same way, etc.