You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if we could include custom groups similar to perfectionist/sort-objects. Mainly the issue that I am trying to solve is ensuring that Angular Dependency Injections are sorted to the top of the class they are being injected in.
Code example
Which used to look like this before the inject syntax came out:
export class ExampleComponent {
public user = this.authService.user;
constructor(private readonly authService: AuthService) {
}
}
Becomes something like this:
export class ExampleComponent {
public user = this.authService.user;
private readonly authService = inject(AuthService);
}
However, this leads to an error similar to #118. If you are accessing the injected dependency before initialization (due to it's sorting order in the component).
Ideally, it would become this instead:
export class ExampleComponent {
private readonly authService = inject(AuthService);
public user = this.authService.user;
}
Additional comments
While this issue is Angular specific, I think the implications of being able to create a custom group would solve this issue, as well as other issues that users could potentially face down the line. This would also help prevent a growing complexity when it comes to adding additional groups to the sorter.
What rule do you want to change?
perfectionist/sort-classes
Describe the problem
It would be nice if we could include custom groups similar to perfectionist/sort-objects. Mainly the issue that I am trying to solve is ensuring that Angular Dependency Injections are sorted to the top of the class they are being injected in.
Code example
Which used to look like this before the
inject
syntax came out:Becomes something like this:
However, this leads to an error similar to #118. If you are accessing the injected dependency before initialization (due to it's sorting order in the component).
Ideally, it would become this instead:
Additional comments
While this issue is
Angular
specific, I think the implications of being able to create a custom group would solve this issue, as well as other issues that users could potentially face down the line. This would also help prevent a growing complexity when it comes to adding additional groups to the sorter.Validations
The text was updated successfully, but these errors were encountered: