Open jattasNI opened 9 months ago
Will coordinate with the design system team / if someone has time to start looking into it sooner
- I ran
npm run print-available-rules
and found that there were the following new, unset rules available in the updated version of@angular-eslint
:@angular-eslint/prefer-standalone-component
@angular-eslint/require-localize-metadata
@angular-eslint/sort-lifecycle-methods
@angular-eslint/template/prefer-ngsrc
@angular-eslint/template/prefer-self-closing-tags
Edit: all of these now have recommendations below ✅
In #145 we identified more new rules in 17 which are currently disabled
I ran npm run print-available-rules and found that there were the following new, unset rules available in the updated version of https://github.com/angular-eslint:
- @angular-eslint/consistent-component-styles
- @angular-eslint/no-async-lifecycle-method
- @angular-eslint/no-duplicates-in-metadata-arrays
- @angular-eslint/prefer-standalone
- @angular-eslint/template/prefer-control-flow
Angular 16 rule @angular-eslint/prefer-standalone-component
was deprecated and is now called prefer-standalone
.
https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone.md
Recommendation for now is to leave this rule unset. We need to research standalone components first in the upcoming Angular feature working group. If there is an easy migration for existing non-standalone components and the working group decides we should standardize on standalone components, we would likely enable this rule. If there isn't an easy migration, we will need to decide what setting we want to encourage new projects to use.
Angular 16 rule @angular-eslint/require-localize-metadata
forces you to provide a description and/or meaning for strings passed to $localize
. We agreed to keep it disabled because our translators don't generally need this info and it would be a lot of churn to start providing it.
The rule sort-lifecycle-methods
enforces a file order for Angular lifecycle methods like ngOnInit
and ngOnDestroy
. Open questions for this rule:
3 means we are ok with the rule behavior so recommend enabling it. 1 and 2 would decide whether to fix violations in existing apps or just keep the rule disabled in those apps.
@angular-eslint/template/prefer-ngsrc
encourages you to use ngsrc
attribute on img
attributes instead of src
. This enables more optimized image loading. We don't use a lot of images but think this is probably a good rule if we ever start doing so, so recommend we enable it. It might be a good idea to sanity check it in one codebase before committing to this.
@angular-eslint/template/prefer-self-closing-tags
forces templates to use the self-closing tag syntax when an element doesn't have any content. Consensus is to keep it disabled since most of us don't love self-closing tags (not valid HTML) and don't see value in encouraging their usage.
In Angular 16, angular-eslint contains some new rules and breaking changes. We will need to publish an update to our Angular styleguide that supports 16 at a minimum and preferably configures the new rules in an opinionated way.
Changelog contents copied below for easier discussion:
Features
BREAKING CHANGES