TAMULib / LibraryServiceStatusSystemUI

MIT License
0 stars 0 forks source link

Inconsistent use of `const` and possible problems using `const` in AngularJS. #248

Open kaladay opened 3 months ago

kaladay commented 3 months ago

see: https://github.com/TAMULib/LibraryServiceStatusSystemUI/blob/2809f72219d3f014cd6b543b9cff4718d0563172/app/controllers/notificationController.js#L68

Changing some code such as this:

To use const instead of var produces, according to @wwelling:

Firefox 127.0 (Ubuntu 0.0.0) controller: NotificationController Are the scope methods working as expected resetNotifications should reset notifications FAILED
    TypeError: invalid assignment to const 'notification' in tests/unit/controllers/notificationControllerTest.js (line 90)
    @tests/unit/controllers/notificationControllerTest.js:90:13
    <Jasmine>

The existing code should either be replaces to avoid const or the problems should be identified and resolved and then the const should be used instead of var.

Note that changing the var to const is a bigger task and may not be worth the effort for an old AngularJS project. It may be more worth the effort to just use var instead of const consistently.