Skip to content

refactor(@angular-devkit/schematics): add consistent spacing and ordering#33247

Open
russelporosky wants to merge 2 commits into
angular:mainfrom
russelporosky:schematics_update
Open

refactor(@angular-devkit/schematics): add consistent spacing and ordering#33247
russelporosky wants to merge 2 commits into
angular:mainfrom
russelporosky:schematics_update

Conversation

@russelporosky
Copy link
Copy Markdown

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?

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), the compileComponents() 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 around if and else statements 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?

  • Yes
  • No

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.

…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
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant