template-angular icon indicating copy to clipboard operation
template-angular copied to clipboard

upgrade to modern angular APIs

Open jabiinfante opened this issue 10 months ago • 2 comments

Hi, Thanks for the template. I have found it really useful and easy to understand for angular developers willing to step into Phaser.

I have a few suggestions to make (split into two commits):

upgrade to latest + ~~eslint~~

  • I have upgraded to the latest available angular version (17.3.4)
  • ~~I have added angular eslint schematic with the default configuration~~
  • I have also added a consistent type imports ~~and a couple of more rules~~

refactor to new angular APIs.

  • I have used signals to keep the state within the template (moveSprinte, spritePosition, etc)
  • Remove unused imports on some components
  • Added some type guards avoiding the use of " as "
  • remove @ViewChild in favor of viewChild.required

I hope it proves helpful. Nevertheless, I'm open to discussion or further suggestions.

jabiinfante avatar Apr 15 '24 18:04 jabiinfante

Thanks for this PR. Can I please check - the eslint configuration: Is this something you just personally find useful, or does this version of Angular actually require it? I'm asking because we generally avoid adding opinionated lint rules in our templates, because they're meant to be used the way you want to. However, if this is something Angular itself requires, that's different.

photonstorm avatar Apr 15 '24 19:04 photonstorm

I added ESLint using @angular-eslint/schematics. It's not required at all by angular (allthougth recommended).

But I see your point, and makes perfect sense. I will update the PR removing the ESLint later today.

jabiinfante avatar Apr 16 '24 04:04 jabiinfante